summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/x11
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11')
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java52
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java4
3 files changed, 37 insertions, 23 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
index 8f7d710cd..caff16812 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
@@ -282,11 +282,11 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
return GLXFBConfig2GLCapabilities(device, glp, fbcfg, winattrmask, isMultisampleAvailable, tmp, xRenderPictFormat);
}
- static List<GLCapabilitiesImmutable> GLXFBConfig2GLCapabilities(final X11GraphicsDevice device, final GLProfile glp, final PointerBuffer fbcfgsL,
+ static ArrayList<GLCapabilitiesImmutable> GLXFBConfig2GLCapabilities(final X11GraphicsDevice device, final GLProfile glp, final PointerBuffer fbcfgsL,
final int winattrmask, final boolean isMultisampleAvailable, final boolean onlyFirstValid) {
final IntBuffer tmp = Buffers.newDirectIntBuffer(1);
final XRenderPictFormat xRenderPictFormat= XRenderPictFormat.create();
- final List<GLCapabilitiesImmutable> result = new ArrayList<GLCapabilitiesImmutable>();
+ final ArrayList<GLCapabilitiesImmutable> result = new ArrayList<GLCapabilitiesImmutable>();
for (int i = 0; i < fbcfgsL.limit(); i++) {
final long fbcfg = fbcfgsL.get(i);
final GLCapabilitiesImmutable c = GLXFBConfig2GLCapabilities(device, glp, fbcfg, winattrmask, isMultisampleAvailable, tmp, xRenderPictFormat);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index 4dc2d7e0b..739061bbe 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -37,6 +37,7 @@ import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
import com.jogamp.nativewindow.AbstractGraphicsDevice;
import com.jogamp.nativewindow.AbstractGraphicsScreen;
import com.jogamp.nativewindow.CapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesFilter;
import com.jogamp.nativewindow.CapabilitiesImmutable;
import com.jogamp.nativewindow.GraphicsConfigurationFactory;
import com.jogamp.nativewindow.VisualIDHolder;
@@ -44,11 +45,12 @@ import com.jogamp.nativewindow.VisualIDHolder.VIDType;
import com.jogamp.opengl.DefaultGLCapabilitiesChooser;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesFilter;
import com.jogamp.opengl.GLCapabilitiesImmutable;
import com.jogamp.opengl.GLDrawableFactory;
import com.jogamp.opengl.GLException;
import com.jogamp.opengl.GLProfile;
-
+import com.jogamp.opengl.GLRendererQuirks;
import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
@@ -295,7 +297,8 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
final IntBuffer count = Buffers.newDirectIntBuffer(1);
count.put(0, -1);
final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsChosen);
- List<GLCapabilitiesImmutable> availableCaps;
+ final GLRendererQuirks glrq = factory.getRendererQuirks(x11Device, glProfile);
+ ArrayList<GLCapabilitiesImmutable> availableCaps;
// 1st choice: get GLCapabilities based on users GLCapabilities setting recommendedIndex as preferred choice,
// skipped if xvisualID is given
final boolean hasGLXChosenCaps;
@@ -305,21 +308,25 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
} else {
hasGLXChosenCaps = false;
}
- final boolean useRecommendedIndex = hasGLXChosenCaps && capsChosen.isBackgroundOpaque(); // only use recommended idx if not translucent
- final boolean skipCapsChooser = null == chooser && useRecommendedIndex; // fast path: skip choosing if using recommended idx and null chooser is used
+ final boolean isPBufferOrBitmap = capsChosen.isBitmap() || capsChosen.isPBuffer();
+ final boolean dontChooseFBConfigMatch = GLRendererQuirks.exist(glrq, GLRendererQuirks.DontChooseFBConfigBestMatch) ||
+ ( isPBufferOrBitmap && GLRendererQuirks.exist(glrq, GLRendererQuirks.No10BitColorCompOffscreen) );
+ final boolean useRecommendedIndex = !dontChooseFBConfigMatch &&
+ hasGLXChosenCaps && capsChosen.isBackgroundOpaque();
+ final boolean shallSkipCapsChooser = null == chooser && useRecommendedIndex;
if (hasGLXChosenCaps) {
- availableCaps = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(x11Device, glProfile, fbcfgsL, winattrmask, isMultisampleAvailable, skipCapsChooser /* onlyFirstValid */);
+ availableCaps = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(x11Device, glProfile, fbcfgsL, winattrmask, isMultisampleAvailable, shallSkipCapsChooser /* onlyFirstValid */);
if(availableCaps.size() > 0) {
recommendedIndex = useRecommendedIndex ? 0 : -1;
if (DEBUG) {
System.err.println("glXChooseFBConfig recommended fbcfg " + toHexString(fbcfgsL.get(0)) + ", idx " + recommendedIndex);
- System.err.println("useRecommendedIndex "+useRecommendedIndex+", skipCapsChooser "+skipCapsChooser);
+ System.err.println("useRecommendedIndex "+useRecommendedIndex+", shallSkipCapsChooser "+shallSkipCapsChooser);
System.err.println("user caps " + capsChosen);
System.err.println("fbcfg caps " + fbcfgsL.limit()+", availCaps "+availableCaps.get(0));
}
} else if (DEBUG) {
System.err.println("glXChooseFBConfig no caps for recommended fbcfg " + toHexString(fbcfgsL.get(0)));
- System.err.println("useRecommendedIndex "+useRecommendedIndex+", skipCapsChooser "+skipCapsChooser);
+ System.err.println("useRecommendedIndex "+useRecommendedIndex+", shallSkipCapsChooser "+shallSkipCapsChooser);
System.err.println("user caps " + capsChosen);
}
} else {
@@ -340,21 +347,28 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
}
availableCaps = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(x11Device, glProfile, fbcfgsL, winattrmask, isMultisampleAvailable, false /* onlyOneValid */);
}
-
+ final boolean skipCapsChooser = shallSkipCapsChooser && 0 <= recommendedIndex;
if(DEBUG) {
System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: got configs: "+availableCaps.size());
for(int i=0; i<availableCaps.size(); i++) {
System.err.println(i+": "+availableCaps.get(i));
}
- }
-
- if( VisualIDHolder.VID_UNDEFINED != xvisualID ) { // implies !hasGLXChosenCaps
- for(int i=0; i<availableCaps.size(); ) {
- final VisualIDHolder vidh = availableCaps.get(i);
- if(vidh.getVisualID(VIDType.X11_XVISUAL) != xvisualID ) {
- availableCaps.remove(i);
- } else {
- i++;
+ System.err.println("recommendedIndex "+recommendedIndex+", skipCapsChooser "+skipCapsChooser);
+ }
+ // Filter availableCaps
+ {
+ final List<GLCapabilitiesImmutable> removedCaps;
+ if( !skipCapsChooser && isPBufferOrBitmap && GLRendererQuirks.exist(glrq, GLRendererQuirks.No10BitColorCompOffscreen) ) {
+ removedCaps = CapabilitiesFilter.removeMoreColorCompsAndUnmatchingNativeVisualID(availableCaps, 8, xvisualID);
+ } else {
+ removedCaps = CapabilitiesFilter.removeUnmatchingNativeVisualID(availableCaps, xvisualID);
+ }
+ if( removedCaps.size() > 0 ) {
+ if(DEBUG) {
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: filtered configs: "+availableCaps.size());
+ for(int i=0; i<availableCaps.size(); i++) {
+ System.err.println(i+": "+availableCaps.get(i));
+ }
}
}
if(0==availableCaps.size()) {
@@ -362,13 +376,11 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: post filter visualID "+toHexString(xvisualID )+" no config found, failed - return null");
}
return null;
- } else if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: post filter visualID "+toHexString(xvisualID)+" got configs: "+availableCaps.size());
}
}
final int chosenIndex;
- if( skipCapsChooser && 0 <= recommendedIndex ) {
+ if( skipCapsChooser ) {
chosenIndex = recommendedIndex;
} else {
chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
index b961c97a2..9a95857fd 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
@@ -115,7 +115,9 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
final long pbuffer = GLX.glXCreatePbuffer(display, config.getFBConfig(), iattributes);
if (pbuffer == 0) {
// FIXME: query X error code for detail error message
- throw new GLException("pbuffer creation error: glXCreatePbuffer() failed");
+ throw new GLException("pbuffer creation error: glXCreatePbuffer() failed using fbConfig 0x"+
+ Long.toHexString(config.getFBConfig())+", size "+ms.getSurfaceWidth()+"x"+ms.getSurfaceHeight()+
+ ", "+config.getChosenCapabilities());
}
// Set up instance variables