diff options
author | Sven Gothel <[email protected]> | 2013-05-31 11:16:01 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-05-31 11:16:01 +0200 |
commit | cbd7bf1d65a253381b0775d57c0c949c75aef008 (patch) | |
tree | 3dc0c44cfba319fef78e17860f7fdf993e4fff7d | |
parent | ef8949d4bdfb21bbe423acc661affaf59369f859 (diff) |
GLVersionNumber.createVendorVersion(): Only test match result and potentially continue matching if having a pattern-match (don't loop for-ever).
-rwxr-xr-x | make/scripts/tests.sh | 4 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/FBObject.java | 15 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java | 42 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLContext.java | 18 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 84 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLVersionNumber.java | 11 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLVersionParsing00NEWT.java | 16 |
7 files changed, 133 insertions, 57 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 8fd7d2852..071c56a9b 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -281,7 +281,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestOlympicES1NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestRedSquareES1NEWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* -#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $* +testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* @@ -312,7 +312,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFloatUtil01MatrixMatrixMultNOUI $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestPMVMatrix01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestPMVMatrix02NEWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLVersionParsing00NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLVersionParsing00NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestNEWTCloseX11DisplayBug565 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $* diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java index 6f2ac3e35..7060bb7d1 100644 --- a/src/jogl/classes/com/jogamp/opengl/FBObject.java +++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java @@ -60,7 +60,6 @@ import com.jogamp.opengl.FBObject.Attachment.Type; */ public class FBObject { protected static final boolean DEBUG = Debug.debug("FBObject"); - private static final boolean forceMinimumFBOSupport = Debug.isPropertyDefined("jogl.fbo.force.min", true); private static final boolean FBOResizeQuirk = false; private static enum DetachAction { NONE, DISPOSE, RECREATE }; @@ -813,6 +812,7 @@ public class FBObject { maxColorAttachments = 1; if( fullFBOSupport || NV_fbo_color_attachments ) { try { + val[0] = 0; gl.glGetIntegerv(GL2ES2.GL_MAX_COLOR_ATTACHMENTS, val, 0); realMaxColorAttachments = 1 <= val[0] ? val[0] : 1; // cap minimum to 1 } catch (GLException gle) { gle.printStackTrace(); } @@ -823,15 +823,10 @@ public class FBObject { colorAttachmentCount = 0; maxSamples = gl.getMaxRenderbufferSamples(); - if(!forceMinimumFBOSupport) { - gl.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, val, 0); - maxTextureSize = val[0]; - gl.glGetIntegerv(GL.GL_MAX_RENDERBUFFER_SIZE, val, 0); - maxRenderbufferSize = val[0]; - } else { - maxTextureSize = 2048; - maxRenderbufferSize = 2048; - } + gl.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, val, 0); + maxTextureSize = val[0]; + gl.glGetIntegerv(GL.GL_MAX_RENDERBUFFER_SIZE, val, 0); + maxRenderbufferSize = val[0]; checkPreGLError(gl); diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java index 78bd62e42..36893f5ec 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java +++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java @@ -27,6 +27,8 @@ */ package com.jogamp.opengl; +import java.util.List; + /** * GLRendererQuirks contains information of known bugs of various GL renderer. * This information allows us to workaround them. @@ -151,14 +153,36 @@ public class GLRendererQuirks { */ public static final int NeedCurrCtx4ARBCreateContext = 10; + /** + * No full FBO support, i.e. not compliant w/ + * <ul> + * <li>GL_ARB_framebuffer_object</li> + * <li>EXT_framebuffer_object</li> + * <li>EXT_framebuffer_multisample</li> + * <li>EXT_framebuffer_blit</li> + * <li>EXT_packed_depth_stencil</li> + * </ul>. + * Drivers known exposing such bug: + * <ul> + * <li>Mesa <i>7.12-devel</i> on Windows with VMware <i>SVGA3D</i> renderer: + * <ul> + * <li>GL_VERSION: <i>2.1 Mesa 7.12-devel (git-d6c318e)</i> </li> + * <li>GL_RENDERER: <i>Gallium 0.4 on SVGA3D; build: RELEASE;</i> </li> + * </ul></li> + * </ul> + * Quirk can also be enabled via property: <code>jogl.fbo.force.min</code>. + */ + public static final int NoFullFBOSupport = 11; + /** Number of quirks known. */ - public static final int COUNT = 11; + public static final int COUNT = 12; private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval", "NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "GLSLBuggyDiscard", "GLNonCompliant", "GLFlushBeforeRelease", "DontCloseX11Display", - "NeedCurrCtx4ARBPixFmtQueries", "NeedCurrCtx4ARBCreateContext" + "NeedCurrCtx4ARBPixFmtQueries", "NeedCurrCtx4ARBCreateContext", + "NoFullFBOSupport" }; private final int _bitmask; @@ -183,6 +207,20 @@ public class GLRendererQuirks { } /** + * @param quirks a list of valid quirks + * @throws IllegalArgumentException if one of the quirks is out of range + */ + public GLRendererQuirks(List<Integer> quirks) throws IllegalArgumentException { + int bitmask = 0; + for(int i=0; i<quirks.size(); i++) { + final int quirk = quirks.get(i); + validateQuirk(quirk); + bitmask |= 1 << quirk; + } + _bitmask = bitmask; + } + + /** * @param quirk the quirk to be tested * @return true if quirk exist, otherwise false * @throws IllegalArgumentException if quirk is out of range diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index ab966a70d..abafabb1c 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -823,15 +823,15 @@ public abstract class GLContext { * </p> */ public final boolean hasFullFBOSupport() { - return !FORCE_MIN_FBO_SUPPORT && hasBasicFBOSupport() && - ( isGL3() || // GL >= 3.0 - isExtensionAvailable(GLExtensions.ARB_framebuffer_object) || // ARB_framebuffer_object - ( isExtensionAvailable(GLExtensions.EXT_framebuffer_object) && // All EXT_framebuffer_object* - isExtensionAvailable(GLExtensions.EXT_framebuffer_multisample) && - isExtensionAvailable(GLExtensions.EXT_framebuffer_blit) && - isExtensionAvailable(GLExtensions.EXT_packed_depth_stencil) - ) - ) ; + return hasBasicFBOSupport() && !hasRendererQuirk(GLRendererQuirks.NoFullFBOSupport) && + ( isGL3() || // GL >= 3.0 + isExtensionAvailable(GLExtensions.ARB_framebuffer_object) || // ARB_framebuffer_object + ( isExtensionAvailable(GLExtensions.EXT_framebuffer_object) && // All EXT_framebuffer_object* + isExtensionAvailable(GLExtensions.EXT_framebuffer_multisample) && + isExtensionAvailable(GLExtensions.EXT_framebuffer_blit) && + isExtensionAvailable(GLExtensions.EXT_packed_depth_stencil) + ) + ) ; } /** diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index e7eef61e7..cab629c3a 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -1504,7 +1504,7 @@ public abstract class GLContextImpl extends GLContext { } private final void setRendererQuirks(final AbstractGraphicsDevice adevice, int major, int minor, int ctp, final VersionNumberString vendorVersion) { - int[] quirks = new int[GLRendererQuirks.COUNT]; + int[] quirks = new int[GLRendererQuirks.COUNT + 1]; // + 1 ( NoFullFBOSupport ) int i = 0; final String MesaSP = "Mesa "; @@ -1513,6 +1513,7 @@ public abstract class GLContextImpl extends GLContext { final boolean isDriverMesa = glRenderer.contains(MesaSP) || glRenderer.contains("Gallium "); final boolean isDriverATICatalyst = !isDriverMesa && ( glVendor.contains("ATI Technologies") || glRenderer.startsWith("ATI ") ); final boolean isDriverNVIDIAGeForce = !isDriverMesa && ( glVendor.contains("NVIDIA Corporation") || glRenderer.contains("NVIDIA ") ); + // // OS related quirks // @@ -1583,6 +1584,44 @@ public abstract class GLContextImpl extends GLContext { } // + // Windowing Toolkit related quirks + // + if( NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true) ) { + // + // X11 + // + { + // + // Quirk: DontCloseX11Display + // + final int quirk = GLRendererQuirks.DontCloseX11Display; + if( glRenderer.contains(MesaSP) ) { + if ( glRenderer.contains("X11") && vendorVersion.compareTo(Version80) < 0 ) { + if(DEBUG) { + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: X11 Renderer=" + glRenderer + ", Version=[vendor " + vendorVersion + ", GL " + glVersion+"]"); + } + quirks[i++] = quirk; + } + } else if( isDriverATICatalyst ) { + { + if(DEBUG) { + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: X11 Renderer=" + glRenderer); + } + quirks[i++] = quirk; + } + } else if( jogamp.nativewindow.x11.X11Util.getMarkAllDisplaysUnclosable() ) { + { + if(DEBUG) { + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: X11Util Downstream"); + } + quirks[i++] = quirk; + } + } + } + } + + + // // RENDERER related quirks // if( isDriverMesa ) { @@ -1601,7 +1640,7 @@ public abstract class GLContextImpl extends GLContext { } quirks[i++] = quirk; } - if( glRenderer.contains("Intel(R)") && compatCtx && ( major>3 || major==3 && minor>=1 ) ) + if( glRenderer.contains("Intel(R)") && compatCtx && ( major > 3 || major == 3 && minor >= 1 ) ) { // FIXME: Apply vendor version constraints! final int quirk = GLRendererQuirks.GLNonCompliant; @@ -1610,37 +1649,30 @@ public abstract class GLContextImpl extends GLContext { } quirks[i++] = quirk; } - } - - // - // Quirk: DontCloseX11Display - // - if( NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true) ) { - final int quirk = GLRendererQuirks.DontCloseX11Display; - if( glRenderer.contains(MesaSP) ) { - if ( glRenderer.contains("X11") && vendorVersion.compareTo(Version80) < 0 ) { - if(DEBUG) { - System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: X11 Renderer=" + glRenderer + ", Version=[vendor " + vendorVersion + ", GL " + glVersion+"]"); - } - quirks[i++] = quirk; - } - } else if( isDriverATICatalyst ) { - { - if(DEBUG) { - System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: X11 Renderer=" + glRenderer); - } - quirks[i++] = quirk; - } - } else if( jogamp.nativewindow.x11.X11Util.getMarkAllDisplaysUnclosable() ) { - { + if( Platform.getOSType() == Platform.OSType.WINDOWS && glRenderer.contains("SVGA3D") ) + { + final VersionNumber mesaSafeFBOVersion = new VersionNumber(8, 0, 0); + if ( vendorVersion.compareTo(mesaSafeFBOVersion) < 0 ) { // includes: vendorVersion.isZero() + final int quirk = GLRendererQuirks.NoFullFBOSupport; if(DEBUG) { - System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: X11Util Downstream"); + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType() + " / Renderer " + glRenderer + " / Mesa-Version "+vendorVersion); } quirks[i++] = quirk; } } } + // + // Property related quirks + // + if( FORCE_MIN_FBO_SUPPORT ) { + final int quirk = GLRendererQuirks.NoFullFBOSupport; + if(DEBUG) { + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: property"); + } + quirks[i++] = quirk; + } + glRendererQuirks = new GLRendererQuirks(quirks, 0, i); } diff --git a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java index 0ce34a60d..cea3ac4ab 100644 --- a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java +++ b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java @@ -115,10 +115,15 @@ public class GLVersionNumber extends VersionNumberString { while ( str.length() > 0 ) { final VersionNumberString version = new VersionNumberString(str, getDefaultVersionNumberPattern()); - if( version.hasMajor() && version.hasMinor() ) { // Requires at least a defined major and minor version component! - return version; + final int eosm = version.endOfStringMatch(); + if( 0 < eosm ) { + if( version.hasMajor() && version.hasMinor() ) { // Requires at least a defined major and minor version component! + return version; + } + str = str.substring( eosm ); + } else { + break; // no match } - str = str.substring(version.endOfStringMatch()); } return VersionNumberString.zeroVersion; } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLVersionParsing00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLVersionParsing00NEWT.java index f2f6e4aff..a39e68abf 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLVersionParsing00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLVersionParsing00NEWT.java @@ -68,7 +68,9 @@ public class TestGLVersionParsing00NEWT extends UITestCase { public static final String[] glVersionStrings02 = new String[] { "GL_VERSION_2_1", // 0 "OpenGL ES 2.0", // 1 - "OpenGL ES GLSL ES 2.0" // 2 + "OpenGL ES GLSL ES 2.0", // 2 + "OpenGL 2.1 LaLa", // 3 + "4.2.11762 Compatibility Profile Context" // 4 }; public static final VersionNumberString[] glVersionNumbers = new VersionNumberString[] { @@ -97,7 +99,9 @@ public class TestGLVersionParsing00NEWT extends UITestCase { new VersionNumberString(2, 1, 0, glVersionStrings02[0]), new VersionNumberString(2, 0, 0, glVersionStrings02[1]), - new VersionNumberString(2, 0, 0, glVersionStrings02[1]) + new VersionNumberString(2, 0, 0, glVersionStrings02[2]), + new VersionNumberString(2, 1, 0, glVersionStrings02[3]), + new VersionNumberString(4, 2, 0, glVersionStrings02[4]) }; public static final VersionNumberString[] glVendorVersionNumbersWithSub = new VersionNumberString[] { new VersionNumberString(1, 2, 3, glVersionStrings00[0]), @@ -125,9 +129,11 @@ public class TestGLVersionParsing00NEWT extends UITestCase { new VersionNumberString(11, 33, 0, glVersionStrings01[9]) }; public static final VersionNumberString[] glVendorVersionNumbersNone = new VersionNumberString[] { - new VersionNumberString(0, 0, 0, glVersionStrings02[0]), - new VersionNumberString(0, 0, 0, glVersionStrings02[1]), - new VersionNumberString(0, 0, 0, glVersionStrings02[2]) + new VersionNumberString(0, 0, 0, glVersionStrings02[0]), + new VersionNumberString(0, 0, 0, glVersionStrings02[1]), + new VersionNumberString(0, 0, 0, glVersionStrings02[2]), + new VersionNumberString(0, 0, 0, glVersionStrings02[3]), + new VersionNumberString(0, 0, 0, glVersionStrings02[4]) }; @Test |