diff options
author | Sven Gothel <[email protected]> | 2013-04-16 05:50:55 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-04-16 05:50:55 +0200 |
commit | ff25c711fe4fa627004c57e0d308d06759156290 (patch) | |
tree | bccaf1561a0582b6567c064f45c2dc9f2a22596c /src/jogl/classes/jogamp/opengl/GLContextImpl.java | |
parent | 5b47372590ec715647ebbd75d70c41ec7a64485a (diff) |
Fix Bug 705 - Cleanup & Generalize Commit 5b47372590ec715647ebbd75d70c41ec7a64485a ; Close X11 Display in isDeviceSupported()
- Moved GL vendor version parsing to GLVersionNumber
- Moved X11Util.markAllDisplaysUnclosable() trigger into SharedResource creation of
- X11GLXDrawableFactory
- EGLDrawableFactory
- GLProfile is back to pre 5b47372590ec715647ebbd75d70c41ec7a64485a,
i.e. contains no quirk artifact (clean)
- Close X11 Display in X11GLXDrawableFactory.isDeviceSupported()
Regression of 9a4fcc7ea4ec61e4ceed791acced734ac04ea270
- TODO: Remove X11Util markAllDisplaysUnclosable detection code ?
Notes to Martin:
- Use TAB == 4 SPACES
- No author names into source code, git commit log is enough.
- No need to tag your edits, the diff is enough.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLContextImpl.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 62 |
1 files changed, 26 insertions, 36 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 74bc59c7c..3657cacda 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -49,6 +49,7 @@ import com.jogamp.common.os.DynamicLookupHelper; import com.jogamp.common.os.Platform; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.common.util.VersionNumber; +import com.jogamp.common.util.VersionNumberString; import com.jogamp.common.util.locks.RecursiveLock; import com.jogamp.gluegen.runtime.FunctionAddressResolver; import com.jogamp.gluegen.runtime.ProcAddressTable; @@ -1023,7 +1024,7 @@ public abstract class GLContextImpl extends GLContext { * If major > 0 || minor > 0 : Use passed values, determined at creation time * Otherwise .. don't touch .. */ - private final void setContextVersion(int major, int minor, int ctp, boolean setVersionString) { + private final void setContextVersion(int major, int minor, int ctp, VersionNumberString glVendorVersion, boolean useGL) { if ( 0 == ctp ) { throw new GLException("Invalid GL Version "+major+"."+minor+", ctp "+toHexString(ctp)); } @@ -1032,9 +1033,10 @@ public abstract class GLContextImpl extends GLContext { throw new GLException("Invalid GL Version "+major+"."+minor+", ctp "+toHexString(ctp)); } ctxVersion = new VersionNumber(major, minor, 0); + ctxVersionString = getGLVersion(major, minor, ctxOptions, glVersion); + ctxVendorVersion = glVendorVersion; ctxOptions = ctp; - if(setVersionString) { - ctxVersionString = getGLVersion(major, minor, ctxOptions, gl.glGetString(GL.GL_VERSION)); + if(useGL) { ctxGLSLVersion = null; if(major >= 2) { // >= ES2 || GL2.0 final String glslVersion = gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION); @@ -1192,7 +1194,7 @@ public abstract class GLContextImpl extends GLContext { */ private static final VersionNumber getGLVersionNumber(int ctp, String glVersionStr) { if( null != glVersionStr ) { - final GLVersionNumber version = new GLVersionNumber(glVersionStr); + final GLVersionNumber version = GLVersionNumber.create(glVersionStr); if ( version.isValid() ) { int[] major = new int[] { version.getMajor() }; int[] minor = new int[] { version.getMinor() }; @@ -1384,7 +1386,9 @@ public abstract class GLContextImpl extends GLContext { ctxProfileBits &= ~GLContext.CTX_IMPL_ES2_COMPAT; } - setRendererQuirks(major, minor, ctxProfileBits); + final VersionNumberString vendorVersion = GLVersionNumber.createVendorVersion(glVersion); + + setRendererQuirks(major, minor, ctxProfileBits, vendorVersion); if( strictMatch && glRendererQuirks.exist(GLRendererQuirks.GLNonCompliant) ) { if(DEBUG) { @@ -1445,7 +1449,7 @@ public abstract class GLContextImpl extends GLContext { } } else { extensionAvailability = new ExtensionAvailabilityCache(); - setContextVersion(major, minor, ctxProfileBits, false); // pre-set of GL version, required for extension cache usage + setContextVersion(major, minor, ctxProfileBits, vendorVersion, false); // pre-set of GL version, required for extension cache usage extensionAvailability.reset(this); synchronized(mappedContextTypeObjectLock) { mappedExtensionAvailabilityCache.put(contextFQN, extensionAvailability); @@ -1469,7 +1473,7 @@ public abstract class GLContextImpl extends GLContext { // // Set GL Version (complete w/ version string) // - setContextVersion(major, minor, ctxProfileBits, true); + setContextVersion(major, minor, ctxProfileBits, vendorVersion, true); setDefaultSwapInterval(); @@ -1481,7 +1485,7 @@ public abstract class GLContextImpl extends GLContext { return true; } - private final void setRendererQuirks(int major, int minor, int ctp) { + private final void setRendererQuirks(int major, int minor, int ctp, VersionNumberString vendorVersion) { int[] quirks = new int[GLRendererQuirks.COUNT]; int i = 0; @@ -1555,6 +1559,7 @@ public abstract class GLContextImpl extends GLContext { } if( glRendererLowerCase.contains("intel(r)") && compatCtx && ( major>3 || major==3 && minor>=1 ) ) { + // FIXME: Apply vendor version constraints! final int quirk = GLRendererQuirks.GLNonCompliant; if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: Renderer " + glRenderer); @@ -1562,43 +1567,28 @@ public abstract class GLContextImpl extends GLContext { quirks[i++] = quirk; } } - - // - // Mesa RENDERER related quirks - // if( glRendererLowerCase.contains("mesa") ) { - // Added March 30, 2013 - // Martin C. Hegedus - if ( glRendererLowerCase.contains("x11") && getMesaMajorVersion(glVersion) < 8.0 ) { - final int quirk = GLRendererQuirks.DontCloseX11DisplayConnection; + if ( glRendererLowerCase.contains("x11") && vendorVersion.compareTo(Version80) < 0 ) { + final int quirk = GLRendererQuirks.DontCloseX11Display; if(DEBUG) { - System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: Mesa X11 < 8 : Renderer=" + glRenderer + ", Version=" +glVersion); + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: Renderer=" + glRenderer + ", Version=[vendor " + vendorVersion + ", GL " + glVersion+"]"); } quirks[i++] = quirk; - } + } + } + if( glRendererLowerCase.contains("ati technologies") || glRendererLowerCase.startsWith("ati ") ) { + { + final int quirk = GLRendererQuirks.DontCloseX11Display; + if(DEBUG) { + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: Renderer=" + glRenderer); + } + quirks[i++] = quirk; + } } glRendererQuirks = new GLRendererQuirks(quirks, 0, i); } - // Added by Martin C. Hegedus, March 30, 2013 - private static final int getMesaMajorVersion(String version) { - if (version == null || version.length() <= 0) return -1; - String[] strings = version.trim().split("\\s+"); - if (strings.length <= 0) return -1; - version = strings[strings.length-1]; - int index = version.indexOf("."); - if (index == 0) return -1; - if (index != -1) version = version.substring(0,index); - try { - Integer iNumber = new Integer(version); - return (iNumber == null) ? -1 : iNumber.intValue(); - } catch (Throwable t) { - return -1; - } - } - - private static final boolean hasFBOImpl(int major, int ctp, ExtensionAvailabilityCache extCache) { return ( 0 != (ctp & CTX_PROFILE_ES) && major >= 2 ) || // ES >= 2.0 |