aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-01-23 00:53:47 +0100
committerSven Gothel <[email protected]>2015-01-23 00:53:47 +0100
commitdb775658a7f5d6614ae716b7492af8210f5e5f18 (patch)
tree15f9131f2b8ccb8ba97932c6bdcb61e333dc0c97
parentd0676451343e826e49d9c5732320f080d4c11c8d (diff)
Bug 1119 - GL* Efficiency: Keep ProcAddressTable instance within GL* instances
-rw-r--r--make/config/jogl/gl-es1.cfg3
-rw-r--r--make/config/jogl/gl-es3-impl.cfg3
-rw-r--r--make/config/jogl/gl-gl4bc.cfg3
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java56
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-gles1.java23
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-gles3.java22
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java101
7 files changed, 104 insertions, 107 deletions
diff --git a/make/config/jogl/gl-es1.cfg b/make/config/jogl/gl-es1.cfg
index b73b1a731..b66b18bfd 100644
--- a/make/config/jogl/gl-es1.cfg
+++ b/make/config/jogl/gl-es1.cfg
@@ -28,7 +28,8 @@ Include gl-common-extensions.cfg
EmitProcAddressTable true
ProcAddressTableClassName GLES1ProcAddressTable
-GetProcAddressTableExpr ((GLES1ProcAddressTable)_context.getGLProcAddressTable())
+GetProcAddressTableExpr _pat
+# GetProcAddressTableExpr ((GLES1ProcAddressTable)_context.getGLProcAddressTable())
# Force all of the methods to be emitted using dynamic linking so we
# don't need to link against any emulation library on the desktop or
diff --git a/make/config/jogl/gl-es3-impl.cfg b/make/config/jogl/gl-es3-impl.cfg
index 9682e49af..00929765d 100644
--- a/make/config/jogl/gl-es3-impl.cfg
+++ b/make/config/jogl/gl-es3-impl.cfg
@@ -32,7 +32,8 @@ ForceExtension GL_ARB_ES3_compatibility
EmitProcAddressTable true
ProcAddressTableClassName GLES3ProcAddressTable
-GetProcAddressTableExpr ((GLES3ProcAddressTable)_context.getGLProcAddressTable())
+GetProcAddressTableExpr _pat
+# GetProcAddressTableExpr ((GLES3ProcAddressTable)_context.getGLProcAddressTable())
# Force all of the methods to be emitted using dynamic linking so we
# don't need to link against any emulation library on the desktop or
diff --git a/make/config/jogl/gl-gl4bc.cfg b/make/config/jogl/gl-gl4bc.cfg
index 6ccbace44..344b4776a 100644
--- a/make/config/jogl/gl-gl4bc.cfg
+++ b/make/config/jogl/gl-gl4bc.cfg
@@ -116,7 +116,8 @@ LocalProcAddressCallingConvention __ALL__ APIENTRY
EmitProcAddressTable true
ProcAddressTableClassName GL4bcProcAddressTable
-GetProcAddressTableExpr ((GL4bcProcAddressTable)_context.getGLProcAddressTable())
+GetProcAddressTableExpr _pat
+# GetProcAddressTableExpr ((GL4bcProcAddressTable)_context.getGLProcAddressTable())
# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums
TagNativeBinding true
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
index c7b264bf9..8ec1b3205 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
@@ -1,3 +1,5 @@
+private final GL4bcProcAddressTable _pat;
+
// Tracks glBegin/glEnd calls to determine whether it is legal to
// query Vertex Buffer Object state
private boolean inBeginEndPair;
@@ -17,35 +19,21 @@ public void setObjectTracker(GLObjectTracker tracker) {
public GL4bcImpl(GLProfile glp, GLContextImpl context) {
this._context = context;
- if(null != context) {
- this.bufferObjectTracker = context.getBufferObjectTracker();
- this.bufferStateTracker = context.getBufferStateTracker();
- this.glStateTracker = context.getGLStateTracker();
- } else {
- this.bufferObjectTracker = null;
- this.bufferStateTracker = null;
- this.glStateTracker = null;
- }
+ this._pat = (GL4bcProcAddressTable)_context.getGLProcAddressTable();
+ this.bufferObjectTracker = context.getBufferObjectTracker();
+ this.bufferStateTracker = context.getBufferStateTracker();
+ this.glStateTracker = context.getGLStateTracker();
this.glProfile = glp;
}
public final void finalizeInit() {
- if(null != _context) {
- haveARBPixelBufferObject = isExtensionAvailable("GL_ARB_pixel_buffer_object");
- haveEXTPixelBufferObject = isExtensionAvailable("GL_EXT_pixel_buffer_object");
- haveGL15 = isExtensionAvailable("GL_VERSION_1_5");
- haveGL21 = isExtensionAvailable("GL_VERSION_2_1");
- haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object");
- haveARBVertexArrayObject = _context.getGLVersionNumber().compareTo(GLContext.Version3_0) >= 0 ||
- isExtensionAvailable("GL_ARB_vertex_array_object");
- } else {
- haveARBPixelBufferObject = false;
- haveEXTPixelBufferObject = false;
- haveGL15 = false;
- haveGL21 = false;
- haveARBVertexBufferObject = false;
- haveARBVertexArrayObject = false;
- }
+ haveARBPixelBufferObject = isExtensionAvailable("GL_ARB_pixel_buffer_object");
+ haveEXTPixelBufferObject = isExtensionAvailable("GL_EXT_pixel_buffer_object");
+ haveGL15 = isExtensionAvailable("GL_VERSION_1_5");
+ haveGL21 = isExtensionAvailable("GL_VERSION_2_1");
+ haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object");
+ haveARBVertexArrayObject = _context.getGLVersionNumber().compareTo(GLContext.Version3_0) >= 0 ||
+ isExtensionAvailable("GL_ARB_vertex_array_object");
}
private int[] imageSizeTemp = new int[1];
@@ -482,7 +470,7 @@ public final void glTexCoordPointer(GLArrayData array) {
@Override
public final void glBufferData(int target, long size, Buffer data, int usage) {
- final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glBufferData;
+ final long glProcAddress = _pat._addressof_glBufferData;
if ( 0 == glProcAddress ) {
throw new GLException(String.format("Method \"%s\" not available", "glBufferData"));
}
@@ -493,7 +481,7 @@ public final void glBufferData(int target, long size, Buffer data, int usage) {
/** FIXME Add for OpenGL 4.4
@Override
public final void glBufferStorage(int target, long size, Buffer data, int flags) {
- final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glBufferStorage;
+ final long glProcAddress = _pat._addressof_glBufferStorage;
if ( 0 == glProcAddress ) {
throw new GLException(String.format("Method \"%s\" not available", "glBufferStorage"));
}
@@ -516,7 +504,7 @@ private native void dispatch_glBufferStorage(int target, long size, Object data,
@Override
public final void glNamedBufferDataEXT(int buffer, long size, Buffer data, int usage) {
- final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glNamedBufferDataEXT;
+ final long glProcAddress = _pat._addressof_glNamedBufferDataEXT;
if ( 0 == glProcAddress ) {
throw new GLException(String.format("Method \"%s\" not available", "glNamedBufferDataEXT"));
}
@@ -538,7 +526,7 @@ private native void dispatch_glNamedBufferDataEXT(int buffer, long size, Object
@Override
public boolean glUnmapBuffer(int target) {
- final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glUnmapBuffer;
+ final long glProcAddress = _pat._addressof_glUnmapBuffer;
if ( 0 == glProcAddress ) {
throw new GLException(String.format("Method \"%s\" not available", "glUnmapBuffer"));
}
@@ -547,7 +535,7 @@ public boolean glUnmapBuffer(int target) {
@Override
public boolean glUnmapNamedBufferEXT(int buffer) {
- final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glUnmapNamedBufferEXT;
+ final long glProcAddress = _pat._addressof_glUnmapNamedBufferEXT;
if ( 0 == glProcAddress ) {
throw new GLException(String.format("Method \"%s\" not available", "glUnmapNamedBufferEXT"));
}
@@ -563,7 +551,7 @@ private native boolean dispatch_glUnmapNamedBufferEXT(int buffer, long procAddre
@Override
public final GLBufferStorage mapBuffer(final int target, final int access) {
- final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer;
+ final long glProcAddress = _pat._addressof_glMapBuffer;
if ( 0 == glProcAddress ) {
throw new GLException("Method \"glMapBuffer\" not available");
}
@@ -571,7 +559,7 @@ public final GLBufferStorage mapBuffer(final int target, final int access) {
}
@Override
public final GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) {
- final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBufferRange;
+ final long glProcAddress = _pat._addressof_glMapBufferRange;
if ( 0 == glProcAddress ) {
throw new GLException("Method \"glMapBufferRange\" not available");
}
@@ -580,7 +568,7 @@ public final GLBufferStorage mapBufferRange(final int target, final long offset,
@Override
public final GLBufferStorage mapNamedBuffer(final int bufferName, final int access) {
- final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapNamedBufferEXT;
+ final long glProcAddress = _pat._addressof_glMapNamedBufferEXT;
if ( 0 == glProcAddress ) {
throw new GLException("Method \"glMapNamedBufferEXT\" not available");
}
@@ -597,7 +585,7 @@ private native long dispatch_glMapNamedBufferEXT(int buffer, int access, long gl
@Override
public final GLBufferStorage mapNamedBufferRange(final int bufferName, final long offset, final long length, final int access) {
- final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapNamedBufferRangeEXT;
+ final long glProcAddress = _pat._addressof_glMapNamedBufferRangeEXT;
if ( 0 == glProcAddress ) {
throw new GLException("Method \"glMapNamedBufferRangeEXT\" not available");
}
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java
index 6a7e12ca1..636f20d60 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java
@@ -1,14 +1,11 @@
+private final GLES1ProcAddressTable _pat;
+
public GLES1Impl(GLProfile glp, GLContextImpl context) {
this._context = context;
- if(null != context) {
- this.bufferObjectTracker = context.getBufferObjectTracker();
- this.bufferStateTracker = context.getBufferStateTracker();
- this.glStateTracker = context.getGLStateTracker();
- } else {
- this.bufferObjectTracker = null;
- this.bufferStateTracker = null;
- this.glStateTracker = null;
- }
+ this._pat = (GLES1ProcAddressTable)_context.getGLProcAddressTable();
+ this.bufferObjectTracker = context.getBufferObjectTracker();
+ this.bufferStateTracker = context.getBufferStateTracker();
+ this.glStateTracker = context.getGLStateTracker();
this.glProfile = glp;
}
@@ -312,7 +309,7 @@ public final void glTexCoordPointer(GLArrayData array) {
@Override
public final void glBufferData(int target, long size, Buffer data, int usage) {
- final long glProcAddress = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glBufferData;
+ final long glProcAddress = _pat._addressof_glBufferData;
if ( 0 == glProcAddress ) {
throw new GLException(String.format("Method \"%s\" not available", "glBufferData"));
}
@@ -323,7 +320,7 @@ public final void glBufferData(int target, long size, Buffer data, int usage) {
@Override
public boolean glUnmapBuffer(int target) {
- final long glProcAddress = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glUnmapBuffer;
+ final long glProcAddress = _pat._addressof_glUnmapBuffer;
if ( 0 == glProcAddress ) {
throw new GLException(String.format("Method \"%s\" not available", "glUnmapBuffer"));
}
@@ -332,7 +329,7 @@ public boolean glUnmapBuffer(int target) {
@Override
public final GLBufferStorage mapBuffer(final int target, final int access) {
- final long glProcAddress = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer;
+ final long glProcAddress = _pat._addressof_glMapBuffer;
if ( 0 == glProcAddress ) {
throw new GLException("Method \"glMapBuffer\" not available");
}
@@ -340,7 +337,7 @@ public final GLBufferStorage mapBuffer(final int target, final int access) {
}
@Override
public final GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) {
- final long glProcAddress = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBufferRange;
+ final long glProcAddress = _pat._addressof_glMapBufferRange;
if ( 0 == glProcAddress ) {
throw new GLException("Method \"glMapBufferRange\" not available");
}
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java
index 42adca4b1..a0e3c6570 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java
@@ -1,15 +1,11 @@
+private final GLES3ProcAddressTable _pat;
public GLES3Impl(GLProfile glp, GLContextImpl context) {
this._context = context;
- if(null != context) {
- this.bufferObjectTracker = context.getBufferObjectTracker();
- this.bufferStateTracker = context.getBufferStateTracker();
- this.glStateTracker = context.getGLStateTracker();
- } else {
- this.bufferObjectTracker = null;
- this.bufferStateTracker = null;
- this.glStateTracker = null;
- }
+ this._pat = (GLES3ProcAddressTable)_context.getGLProcAddressTable();
+ this.bufferObjectTracker = context.getBufferObjectTracker();
+ this.bufferStateTracker = context.getBufferStateTracker();
+ this.glStateTracker = context.getGLStateTracker();
this.glProfile = glp;
this._isES3 = glp.getImplName() == GLProfile.GLES3;
}
@@ -354,7 +350,7 @@ public final void glDepthRange(double zNear, double zFar) {
@Override
public final void glBufferData(int target, long size, Buffer data, int usage) {
- final long glProcAddress = ((GLES3ProcAddressTable)_context.getGLProcAddressTable())._addressof_glBufferData;
+ final long glProcAddress = _pat._addressof_glBufferData;
if ( 0 == glProcAddress ) {
throw new GLException(String.format("Method \"%s\" not available", "glBufferData"));
}
@@ -365,7 +361,7 @@ public final void glBufferData(int target, long size, Buffer data, int usage) {
@Override
public boolean glUnmapBuffer(int target) {
- final long glProcAddress = ((GLES3ProcAddressTable)_context.getGLProcAddressTable())._addressof_glUnmapBuffer;
+ final long glProcAddress = _pat._addressof_glUnmapBuffer;
if ( 0 == glProcAddress ) {
throw new GLException(String.format("Method \"%s\" not available", "glUnmapBuffer"));
}
@@ -374,7 +370,7 @@ public boolean glUnmapBuffer(int target) {
@Override
public final GLBufferStorage mapBuffer(final int target, final int access) {
- final long glProcAddress = ((GLES3ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer;
+ final long glProcAddress = _pat._addressof_glMapBuffer;
if ( 0 == glProcAddress ) {
throw new GLException("Method \"glMapBuffer\" not available");
}
@@ -382,7 +378,7 @@ public final GLBufferStorage mapBuffer(final int target, final int access) {
}
@Override
public final GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) {
- final long glProcAddress = ((GLES3ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBufferRange;
+ final long glProcAddress = _pat._addressof_glMapBufferRange;
if ( 0 == glProcAddress ) {
throw new GLException("Method \"glMapBufferRange\" not available");
}
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index bce8e7317..44987bdec 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -1243,16 +1243,19 @@ public abstract class GLContextImpl extends GLContext {
// Helpers for various context implementations
//
- private Object createInstance(final GLProfile glp, final boolean glObject, final Object[] cstrArgs) {
+ private final Object createInstance(final GLProfile glp, final boolean glObject, final Object[] cstrArgs) {
return ReflectionUtil.createInstance(glp.getGLCtor(glObject), cstrArgs);
}
- private boolean verifyInstance(final GLProfile glp, final String suffix, final Object instance) {
+ private final boolean verifyInstance(final GLProfile glp, final String suffix, final Object instance) {
return ReflectionUtil.instanceOf(instance, glp.getGLImplBaseClassName()+suffix);
}
- /** Create the GL for this context. */
- protected GL createGL(final GLProfile glp) {
+ /**
+ * Create the GL instance for this context,
+ * requires valid {@link #getGLProcAddressTable()} result!
+ */
+ private final GL createGL(final GLProfile glp) {
final GL gl = (GL) createInstance(glp, true, new Object[] { glp, this } );
/* FIXME: refactor dependence on Java 2D / JOGL bridge
@@ -1281,6 +1284,8 @@ public abstract class GLContextImpl extends GLContext {
}
if( null != finalizeInit ) {
ReflectionUtil.callMethod(gl, finalizeInit, new Object[]{ });
+ } else {
+ throw new InternalError("Missing 'void finalizeInit(ProcAddressTable)' in "+gl.getClass().getName());
}
}
@@ -1480,7 +1485,7 @@ public abstract class GLContextImpl extends GLContext {
*/
protected final boolean setGLFunctionAvailability(final boolean force, int major, int minor, int ctxProfileBits,
final boolean strictMatch, final boolean withinGLVersionsMapping) {
- if(null!=this.gl && null!=glProcAddressTable && !force) {
+ if( null != this.gl && null != glProcAddressTable && !force ) {
return true; // already done and not forced
}
@@ -1488,11 +1493,6 @@ public abstract class GLContextImpl extends GLContext {
throw new GLException("Invalid GL Version Request "+GLContext.getGLVersion(major, minor, ctxProfileBits, null));
}
- if(null==this.gl || !verifyInstance(gl.getGLProfile(), "Impl", this.gl)) {
- setGL( createGL( drawable.getGLProfile() ) );
- }
- updateGLXProcAddressTable();
-
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
final int reqCtxProfileBits = ctxProfileBits;
@@ -1684,54 +1684,67 @@ public abstract class GLContextImpl extends GLContext {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.0 validated FQN: "+contextFQN+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, glVersion));
}
+ updateGLXProcAddressTable();
+
//
// UpdateGLProcAddressTable functionality
+ // _and_ setup GL instance, which ctor requires valid getGLProcAddressTable() result!
//
- ProcAddressTable table = null;
- synchronized(mappedContextTypeObjectLock) {
- table = mappedGLProcAddress.get( contextFQN );
- if(null != table && !verifyInstance(gl.getGLProfile(), "ProcAddressTable", table)) {
- throw new InternalError("GLContext GL ProcAddressTable mapped key("+contextFQN+" - " + GLContext.getGLVersion(major, minor, ctxProfileBits, null)+
- ") -> "+ table.getClass().getName()+" not matching "+gl.getGLProfile().getGLImplBaseClassName());
- }
- }
- if(null != table) {
- glProcAddressTable = table;
- if(DEBUG) {
- System.err.println(getThreadName() + ": GLContext GL ProcAddressTable reusing key("+contextFQN+") -> "+toHexString(table.hashCode()));
- }
- } else {
- glProcAddressTable = (ProcAddressTable) createInstance(gl.getGLProfile(), false,
- new Object[] { new GLProcAddressResolver() } );
- resetProcAddressTable(getGLProcAddressTable());
+ {
+ final GLProfile glp = drawable.getGLProfile();
+
+ ProcAddressTable table = null;
synchronized(mappedContextTypeObjectLock) {
- mappedGLProcAddress.put(contextFQN, getGLProcAddressTable());
+ table = mappedGLProcAddress.get( contextFQN );
+ if(null != table && !verifyInstance(glp, "ProcAddressTable", table)) {
+ throw new InternalError("GLContext GL ProcAddressTable mapped key("+contextFQN+" - " + GLContext.getGLVersion(major, minor, ctxProfileBits, null)+
+ ") -> "+ table.getClass().getName()+" not matching "+glp.getGLImplBaseClassName());
+ }
+ }
+ if(null != table) {
+ glProcAddressTable = table;
if(DEBUG) {
- System.err.println(getThreadName() + ": GLContext GL ProcAddressTable mapping key("+contextFQN+") -> "+toHexString(getGLProcAddressTable().hashCode()));
+ System.err.println(getThreadName() + ": GLContext GL ProcAddressTable reusing key("+contextFQN+") -> "+toHexString(table.hashCode()));
+ }
+ } else {
+ glProcAddressTable = (ProcAddressTable) createInstance(glp, false,
+ new Object[] { new GLProcAddressResolver() } );
+ resetProcAddressTable( glProcAddressTable );
+ synchronized(mappedContextTypeObjectLock) {
+ mappedGLProcAddress.put(contextFQN, glProcAddressTable);
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": GLContext GL ProcAddressTable mapping key("+contextFQN+") -> "+toHexString(glProcAddressTable.hashCode()));
+ }
}
}
+
+ if( null == this.gl || !verifyInstance(glp, "Impl", this.gl) ) {
+ setGL( createGL( glp ) );
+ }
}
//
// Update ExtensionAvailabilityCache
//
- ExtensionAvailabilityCache eCache;
- synchronized(mappedContextTypeObjectLock) {
- eCache = mappedExtensionAvailabilityCache.get( contextFQN );
- }
- if(null != eCache) {
- extensionAvailability = eCache;
- if(DEBUG) {
- System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache reusing key("+contextFQN+") -> "+toHexString(eCache.hashCode()) + " - entries: "+eCache.getTotalExtensionCount());
- }
- } else {
- extensionAvailability = new ExtensionAvailabilityCache();
- setContextVersion(major, minor, ctxProfileBits, vendorVersion, false); // pre-set of GL version, required for extension cache usage
- extensionAvailability.reset(this);
+ {
+ ExtensionAvailabilityCache eCache;
synchronized(mappedContextTypeObjectLock) {
- mappedExtensionAvailabilityCache.put(contextFQN, extensionAvailability);
+ eCache = mappedExtensionAvailabilityCache.get( contextFQN );
+ }
+ if(null != eCache) {
+ extensionAvailability = eCache;
if(DEBUG) {
- System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache mapping key("+contextFQN+") -> "+toHexString(extensionAvailability.hashCode()) + " - entries: "+extensionAvailability.getTotalExtensionCount());
+ System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache reusing key("+contextFQN+") -> "+toHexString(eCache.hashCode()) + " - entries: "+eCache.getTotalExtensionCount());
+ }
+ } else {
+ extensionAvailability = new ExtensionAvailabilityCache();
+ 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);
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache mapping key("+contextFQN+") -> "+toHexString(extensionAvailability.hashCode()) + " - entries: "+extensionAvailability.getTotalExtensionCount());
+ }
}
}
}