diff options
author | Sven Gothel <[email protected]> | 2012-02-13 12:37:52 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-02-13 12:37:52 +0100 |
commit | 03b15ec0efc5af944da7d65aadab3a4bdf2e6c68 (patch) | |
tree | 5de9e1a688b1842e6461d304def24622f4528950 /src/jogl/classes/jogamp/opengl/GLContextImpl.java | |
parent | e213836e39a1c0a909dbe47a25ec5bc10de06196 (diff) |
Fix JOGL GLContextImpl ProcAddressTable and Extension Caching
Bug caused using wrong extension cache and probably the wrong procAddress table.
- do not reuse local field value if not cached
- issue resetState() after each createContextARBMapVersionsAvailable(..) query
- remove cache entry for extension (copy/paste bug)
- resetState() shall clean platform extProcAddressTable in specializations
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLContextImpl.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 02ac2428f..7766214b4 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -660,7 +660,6 @@ public abstract class GLContextImpl extends GLContext { createContextARBMapVersionsAvailable(4, false /* core */); // GL4 createContextARBMapVersionsAvailable(3, false /* core */); // GL3 GLContext.setAvailableGLVersionsSet(device); - resetStates(); } } @@ -737,6 +736,7 @@ public abstract class GLContextImpl extends GLContext { } else if (DEBUG) { System.err.println(getThreadName() + ": !!! createContextARBMapVersionsAvailable NOPE: "+reqMajor+"."+reqProfile); } + resetStates(); } private final long createContextARBVersions(long share, boolean direct, int ctxOptionFlags, @@ -971,19 +971,17 @@ public abstract class GLContextImpl extends GLContext { if(null != table) { glProcAddressTable = table; if(DEBUG) { - System.err.println(getThreadName() + ": !!! GLContext GL ProcAddressTable reusing key("+contextFQN+") -> "+table.hashCode()); + System.err.println(getThreadName() + ": !!! GLContext GL ProcAddressTable reusing key("+contextFQN+") -> "+toHexString(table.hashCode())); } } else { - if (glProcAddressTable == null) { - glProcAddressTable = (ProcAddressTable) createInstance(gl.getGLProfile(), "ProcAddressTable", - new Class[] { FunctionAddressResolver.class } , - new Object[] { new GLProcAddressResolver() } ); - } + glProcAddressTable = (ProcAddressTable) createInstance(gl.getGLProfile(), "ProcAddressTable", + new Class[] { FunctionAddressResolver.class } , + new Object[] { new GLProcAddressResolver() } ); resetProcAddressTable(getGLProcAddressTable()); synchronized(mappedContextTypeObjectLock) { mappedGLProcAddress.put(contextFQN, getGLProcAddressTable()); if(DEBUG) { - System.err.println(getThreadName() + ": !!! GLContext GL ProcAddressTable mapping key("+contextFQN+") -> "+getGLProcAddressTable().hashCode()); + System.err.println(getThreadName() + ": !!! GLContext GL ProcAddressTable mapping key("+contextFQN+") -> "+toHexString(getGLProcAddressTable().hashCode())); } } } @@ -998,17 +996,15 @@ public abstract class GLContextImpl extends GLContext { if(null != eCache) { extensionAvailability = eCache; if(DEBUG) { - System.err.println(getThreadName() + ": !!! GLContext GL ExtensionAvailabilityCache reusing key("+contextFQN+") -> "+eCache.hashCode()); + System.err.println(getThreadName() + ": !!! GLContext GL ExtensionAvailabilityCache reusing key("+contextFQN+") -> "+toHexString(eCache.hashCode()) + " - entries: "+eCache.getSize()); } } else { - if(null==extensionAvailability) { - extensionAvailability = new ExtensionAvailabilityCache(this); - } + extensionAvailability = new ExtensionAvailabilityCache(this); extensionAvailability.reset(); synchronized(mappedContextTypeObjectLock) { mappedExtensionAvailabilityCache.put(contextFQN, extensionAvailability); if(DEBUG) { - System.err.println(getThreadName() + ": !!! GLContext GL ExtensionAvailabilityCache mapping key("+contextFQN+") -> "+extensionAvailability.hashCode()); + System.err.println(getThreadName() + ": !!! GLContext GL ExtensionAvailabilityCache mapping key("+contextFQN+") -> "+toHexString(extensionAvailability.hashCode()) + " - entries: "+extensionAvailability.getSize()); } } } @@ -1039,9 +1035,9 @@ public abstract class GLContextImpl extends GLContext { } synchronized(mappedContextTypeObjectLock) { - ExtensionAvailabilityCache eCache = mappedExtensionAvailabilityCache.get( contextFQN ); + ExtensionAvailabilityCache eCache = mappedExtensionAvailabilityCache.remove( contextFQN ); if(DEBUG) { - System.err.println(getThreadName() + ": !!! RM GLContext GL ExtensionAvailabilityCache reusing key("+contextFQN+") -> "+eCache.hashCode()); + System.err.println(getThreadName() + ": !!! RM GLContext GL ExtensionAvailabilityCache mapping key("+contextFQN+") -> "+eCache.hashCode()); } } } |