diff options
Diffstat (limited to 'src')
5 files changed, 65 insertions, 5 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java index f6e671c88..f81d2f2d0 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java +++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java @@ -191,7 +191,12 @@ public class GLRendererQuirks { * <li>GL_RENDERER: <i>Gallium 0.4 on SVGA3D; build: RELEASE;</i> </li> * </ul></li> * </ul> + * <p> + * Also enabled via {@link #BuggyColorRenderbuffer}. + * </p> + * <p> * Quirk can also be enabled via property: <code>jogl.fbo.force.min</code>. + * </p> */ public static final int NoFullFBOSupport = 11; @@ -312,8 +317,32 @@ public class GLRendererQuirks { */ public static final int NoMultiSamplingBuffers = 17; + /** + * With certain drivers no reliable FBO color renderbuffer target + * is available, read <i>a crash</i> may occur. + * <p> + * Appears on: + * <ul> + * <li>GL_VENDOR Brian Paul</li> + * <li>GL_RENDERER Mesa X11</li> + * <li>GL_VERSION 2.1 Mesa 7.2</li> + * </ul> + * TODO: We have to determine the exact version range, i.e. not adding the quirk with fixed driver version! + * </p> + * <p> + * Note: Also enables {@link #NoFullFBOSupport}. + * </p> + * <p> + * Note: GLFBODrawable always uses texture attachments if set. + * </p> + * <p> + * Quirk can also be enabled via property: <code>jogl.fbo.force.nocolorrenderbuffer</code>. + * </p> + */ + public static final int BuggyColorRenderbuffer = 18; + /** Number of quirks known. */ - public static final int COUNT = 18; + public static final int COUNT = 19; private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval", "NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "GLSLBuggyDiscard", @@ -321,7 +350,7 @@ public class GLRendererQuirks { "NeedCurrCtx4ARBPixFmtQueries", "NeedCurrCtx4ARBCreateContext", "NoFullFBOSupport", "GLSLNonCompliant", "GL4NeedsGL3Request", "GLSharedContextBuggy", "GLES3ViaEGLES2Config", "SingletonEGLDisplayOnly", - "NoMultiSamplingBuffers" + "NoMultiSamplingBuffers", "BuggyColorRenderbuffer" }; private static final IdentityHashMap<String, GLRendererQuirks> stickyDeviceQuirks = new IdentityHashMap<String, GLRendererQuirks>(); diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 6334c35d0..e2498e6f1 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -108,6 +108,7 @@ public abstract class GLContext { protected static final boolean FORCE_NO_FBO_SUPPORT = Debug.isPropertyDefined("jogl.fbo.force.none", true); protected static final boolean FORCE_MIN_FBO_SUPPORT = Debug.isPropertyDefined("jogl.fbo.force.min", true); + protected static final boolean FORCE_NO_COLOR_RENDERBUFFER = Debug.isPropertyDefined("jogl.fbo.force.nocolorrenderbuffer", true); /** Reflects property jogl.debug.DebugGL. If true, the debug pipeline is enabled at context creation. */ public static final boolean DEBUG_GL = Debug.isPropertyDefined("jogl.debug.DebugGL", true); diff --git a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java index f423e0ee4..e98e5cbd5 100644 --- a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java @@ -34,6 +34,7 @@ import com.jogamp.opengl.FBObject; import com.jogamp.opengl.FBObject.Colorbuffer; import com.jogamp.opengl.FBObject.ColorAttachment; import com.jogamp.opengl.FBObject.TextureAttachment; +import com.jogamp.opengl.GLRendererQuirks; /** * Platform-independent {@link GLDrawable} specialization, @@ -95,6 +96,10 @@ public interface GLFBODrawable extends GLDrawable { * <p> * See {@link #FBOMODE_DEFAULT} values. * </p> + * <p> + * If {@link GLRendererQuirks#BuggyColorRenderbuffer} is set, + * {@link #FBOMODE_USE_TEXTURE} is always added at initialization. + * </p> * * @param modeBits custom FBO mode bits like {@link #FBOMODE_USE_TEXTURE} and {@link #FBOMODE_USE_DEPTH}. * @throws IllegalStateException if the underlying FBO is already {@link #isInitialized()}. diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 1dac79516..6239103da 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -1921,6 +1921,15 @@ public abstract class GLContextImpl extends GLContext { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: Renderer " + glRenderer); } quirks.addQuirk( quirk ); + } else { + // software + if( vendorVersion.compareTo(mesaSafeFBOVersion) < 0 ) { // FIXME: Is it fixed in >= 8.0.0 ? + final int quirk = GLRendererQuirks.BuggyColorRenderbuffer; + if(DEBUG) { + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: Renderer " + glRenderer + " / Mesa-Version "+vendorVersion); + } + quirks.addQuirk( quirk ); + } } if (compatCtx && (major > 3 || (major == 3 && minor >= 1))) { // FIXME: Apply vendor version constraints! @@ -1963,13 +1972,22 @@ public abstract class GLContextImpl extends GLContext { // // Property related quirks // - if( FORCE_MIN_FBO_SUPPORT ) { - final int quirk = GLRendererQuirks.NoFullFBOSupport; + if( FORCE_NO_COLOR_RENDERBUFFER ) { + final int quirk = GLRendererQuirks.BuggyColorRenderbuffer; if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: property"); } quirks.addQuirk( quirk ); } + if( FORCE_MIN_FBO_SUPPORT || quirks.exist(GLRendererQuirks.BuggyColorRenderbuffer) ) { + final int quirk = GLRendererQuirks.NoFullFBOSupport; + if(DEBUG) { + final String causeProps = FORCE_MIN_FBO_SUPPORT ? "property, " : ""; + final String causeQuirk = quirks.exist(GLRendererQuirks.BuggyColorRenderbuffer) ? "BuggyColorRenderbuffer" : ""; + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: "+causeProps+causeQuirk); + } + quirks.addQuirk( quirk ); + } if(DEBUG) { System.err.println("Quirks local.0: "+quirks); diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java index 0d871017e..f3954b7b6 100644 --- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java @@ -15,6 +15,7 @@ import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.VersionUtil; import com.jogamp.nativewindow.MutableGraphicsConfiguration; import com.jogamp.opengl.FBObject; +import com.jogamp.opengl.GLRendererQuirks; import com.jogamp.opengl.FBObject.Attachment; import com.jogamp.opengl.FBObject.Colorbuffer; import com.jogamp.opengl.FBObject.TextureAttachment; @@ -44,7 +45,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { static { Debug.initSingleton(); DEBUG = GLDrawableImpl.DEBUG || Debug.debug("FBObject"); - DEBUG_SWAP = DEBUG || PropertyAccess.isPropertyDefined("jogl.debug.FBObject.Swap", true); + DEBUG_SWAP = PropertyAccess.isPropertyDefined("jogl.debug.FBObject.Swap", true); } private final GLDrawableImpl parent; @@ -198,6 +199,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { fboIBack = 0; // head fboIFront = fbos.length - 1; // tail + if( 0 == ( FBOMODE_USE_TEXTURE & fboModeBits ) && + gl.getContext().hasRendererQuirk(GLRendererQuirks.BuggyColorRenderbuffer) ) { + // GLRendererQuirks.BuggyColorRenderbuffer also disables MSAA, i.e. full FBO support + fboModeBits |= FBOMODE_USE_TEXTURE; + } + final boolean useTexture = 0 != ( FBOMODE_USE_TEXTURE & fboModeBits ); final boolean useDepth = 0 != ( FBOMODE_USE_DEPTH & fboModeBits ); final boolean useStencil = chosenFBOCaps.getStencilBits() > 0; |