summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-02-06 07:05:35 +0100
committerSven Gothel <[email protected]>2011-02-06 07:05:35 +0100
commit01bd8687e0d12146672dec42cfd3259e74eaba89 (patch)
treef24310d71049c26e32ff3665dfbe4535569c5ac3 /src
parentefecc1eb881d28d142ecc39c1635161d70f58a6c (diff)
Fix GLContext ProcAddressTable Caching: Add sw/hw accel bit to hash value due to possible diff function ptr of sw impl (NV/Win7)
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java16
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java2
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java5
3 files changed, 17 insertions, 6 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
index c597e5d88..366b7a35b 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
@@ -798,10 +798,15 @@ public abstract class GLContextImpl extends GLContext {
*
* @param force force the setting, even if is already being set.
* This might be useful if you change the OpenGL implementation.
+ * @param major OpenGL major version
+ * @param minor OpenGL minor version
+ * @param ctxProfileBits OpenGL context profile and option bits, see {@link javax.media.opengl.GLContext#CTX_OPTION_ANY}
*
* @see #setContextVersion
+ * @see javax.media.opengl.GLContext#CTX_OPTION_ANY
+ * @see javax.media.opengl.GLContext#CTX_PROFILE_COMPAT
*/
- protected final void setGLFunctionAvailability(boolean force, int major, int minor, int ctp) {
+ protected final void setGLFunctionAvailability(boolean force, int major, int minor, int ctxProfileBits) {
if(null!=this.gl && null!=glProcAddressTable && !force) {
return; // already done and not forced
}
@@ -813,7 +818,8 @@ public abstract class GLContextImpl extends GLContext {
AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
- contextFQN = getContextFQN(adevice, major, minor, ctp);
+ final int ctxImplBits = drawable.getChosenGLCapabilities().getHardwareAccelerated() ? GLContext.CTX_IMPL_ACCEL_HARD : GLContext.CTX_IMPL_ACCEL_SOFT;
+ contextFQN = getContextFQN(adevice, major, minor, ctxProfileBits, ctxImplBits);
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Context FQN: "+contextFQN);
}
@@ -856,7 +862,7 @@ public abstract class GLContextImpl extends GLContext {
//
// Set GL Version
//
- setContextVersion(major, minor, ctp);
+ setContextVersion(major, minor, ctxProfileBits);
//
// Update ExtensionAvailabilityCache
@@ -982,8 +988,8 @@ public abstract class GLContextImpl extends GLContext {
return false;
}
- protected static String getContextFQN(AbstractGraphicsDevice device, int major, int minor, int ctp) {
- return device.getUniqueID() + "-" + toHexString(compose8bit(major, minor, ctp, 0));
+ protected static String getContextFQN(AbstractGraphicsDevice device, int major, int minor, int ctxProfileBits, int ctxImplBits) {
+ return device.getUniqueID() + "-" + toHexString(compose8bit(major, minor, ctxProfileBits, ctxImplBits));
}
protected String getContextFQN() {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
index f07ba3271..cfe0a7899 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
@@ -65,7 +65,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext {
System.err.println(getThreadName() + ": !!! Created external OpenGL context " + toHexString(ctx) + " for " + this);
}
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
+ setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY); // use GL_VERSION
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 4c9b737d5..a0c0dd83f 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -82,6 +82,11 @@ public abstract class GLContext {
/** <code>ARB_create_context</code> related: flag debug */
protected static final int CTX_OPTION_DEBUG = 1 << 6;
+ /** GLContext {@link com.jogamp.gluegen.runtime.ProcAddressTable} caching related: GL software implementation */
+ protected static final int CTX_IMPL_ACCEL_SOFT = 1 << 0;
+ /** GLContext {@link com.jogamp.gluegen.runtime.ProcAddressTable} caching related: GL hardware implementation */
+ protected static final int CTX_IMPL_ACCEL_HARD = 1 << 1;
+
private static ThreadLocal currentContext = new ThreadLocal();
private HashMap/*<int, Object>*/ attachedObjects = new HashMap();