aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-10-29 06:30:45 +0200
committerSven Gothel <[email protected]>2010-10-29 06:30:45 +0200
commita0c7b5ca791f659d9c98654b47246092aad42665 (patch)
tree7dbc6d920657558143008a888854e70f14bec8fb /src/jogl/classes/javax/media/opengl
parentce24d32178106baa16e84f016192441ce45845a7 (diff)
JOGL: HashMap ProcAddressTable for all GL profiles incl GLX/WGL/CGL/EGL
Reduce (performance/footprint) overhead of ProcAddressTable recreation, instead use a hashmap (major, minor, profile) -> ProcAddressTable. Remove GL2ES12 implementation profile, redundant.
Diffstat (limited to 'src/jogl/classes/javax/media/opengl')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java21
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java22
2 files changed, 20 insertions, 23 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 0cc63fb1a..2f63d5c8e 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -42,6 +42,7 @@ package javax.media.opengl;
import java.util.HashMap;
import com.jogamp.common.util.IntIntHashMap;
+import com.jogamp.common.util.IntObjectHashMap;
/** Abstraction for an OpenGL rendering context. In order to perform
OpenGL rendering, a context must be "made current" on the current
@@ -505,7 +506,10 @@ public abstract class GLContext {
*/
public static final boolean getGLVersionAvailable(int reqMajor, int reqProfile, int[] major, int minor[], int ctp[]) {
int key = compose8bit(reqMajor, reqProfile, 0, 0);
- int val = mappedVersionsAvailable.get( key );
+ int val;
+ synchronized(mappedVersionsAvailableLock) {
+ val = mappedVersionsAvailable.get( key );
+ }
if(val<=0) {
return false;
}
@@ -556,15 +560,24 @@ public abstract class GLContext {
return sb.toString();
}
+ protected static final Object mappedVersionsAvailableLock;
protected static final IntIntHashMap mappedVersionsAvailable;
protected static volatile boolean mappedVersionsAvailableSet;
- protected static final Object mappedVersionsAvailableLock;
+
+ protected static final Object mappedProcAddressLock;
+ protected static final IntObjectHashMap mappedGLProcAddress;
+ protected static final IntObjectHashMap mappedGLXProcAddress;
static {
mappedVersionsAvailableLock = new Object();
mappedVersionsAvailableSet = false;
mappedVersionsAvailable = new IntIntHashMap();
mappedVersionsAvailable.setKeyNotFoundValue(-1);
+ mappedProcAddressLock = new Object();
+ mappedGLProcAddress = new IntObjectHashMap();
+ mappedGLProcAddress.setKeyNotFoundValue(null);
+ mappedGLXProcAddress = new IntObjectHashMap();
+ mappedGLXProcAddress.setKeyNotFoundValue(null);
}
private static void validateProfileBits(int bits, String argName) {
@@ -594,7 +607,9 @@ public abstract class GLContext {
int key = compose8bit(reqMajor, profile, 0, 0);
int val = compose8bit(resMajor, resMinor, resCtp, 0);
- mappedVersionsAvailable.put( key, val );
+ synchronized(mappedVersionsAvailableLock) {
+ mappedVersionsAvailable.put( key, val );
+ }
}
protected static int compose8bit(int one, int two, int three, int four) {
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 233bebcb4..102a97a33 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -47,7 +47,6 @@ import com.jogamp.opengl.impl.DesktopGLDynamicLookupHelper;
import java.util.HashMap;
import java.util.Iterator;
import java.security.*;
-import java.util.ArrayList;
import javax.media.opengl.fixedfunc.GLPointerFunc;
import javax.media.nativewindow.NativeWindowFactory;
@@ -917,10 +916,6 @@ public class GLProfile {
JVMUtil.initSingleton();
}
- // The intersection between desktop OpenGL and the union of the OpenGL ES profiles
- // This is here only to avoid having separate GL2ES1Impl and GL2ES2Impl classes
- private static final String GL2ES12 = "GL2ES12";
-
private static /*final*/ boolean isAWTAvailable;
private static /*final*/ boolean hasGL234Impl;
@@ -929,7 +924,6 @@ public class GLProfile {
private static /*final*/ boolean hasGL3bcImpl;
private static /*final*/ boolean hasGL3Impl;
private static /*final*/ boolean hasGL2Impl;
- private static /*final*/ boolean hasGL2ES12Impl;
private static /*final*/ boolean hasGLES2Impl;
private static /*final*/ boolean hasGLES1Impl;
@@ -964,11 +958,9 @@ public class GLProfile {
hasGL3bcImpl = hasGL234Impl;
hasGL3Impl = hasGL234Impl;
hasGL2Impl = hasGL234Impl;
- hasGL2ES12Impl = ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.gl2es12.GL2ES12Impl", classloader);
mappedProfiles = computeProfileMap();
boolean hasDesktopGL = false;
- boolean hasDesktopGLES12 = false;
boolean hasNativeOSFactory = false;
Throwable t;
@@ -989,7 +981,6 @@ public class GLProfile {
DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) factory.getGLDynamicLookupHelper(0);
if(null!=glLookupHelper) {
hasDesktopGL = glLookupHelper.hasGLBinding();
- hasDesktopGLES12 = glLookupHelper.hasGLES12Binding();
}
}
} catch (LinkageError le) {
@@ -1021,7 +1012,6 @@ public class GLProfile {
hasGL4Impl = false;
hasGL3bcImpl = false;
hasGL3Impl = false;
- hasGL2ES12Impl = false;
hasGL2Impl = false;
} else {
hasGL4bcImpl = hasGL4bcImpl && GLContext.isGL4bcAvailable();
@@ -1029,7 +1019,6 @@ public class GLProfile {
hasGL3bcImpl = hasGL3bcImpl && GLContext.isGL3bcAvailable();
hasGL3Impl = hasGL3Impl && GLContext.isGL3Available();
hasGL2Impl = hasGL2Impl && GLContext.isGL2Available();
- hasGL2ES12Impl = hasGL2ES12Impl && GLContext.isGL2Available();
}
if ( ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.egl.EGLDrawableFactory", classloader) ) {
@@ -1075,7 +1064,6 @@ public class GLProfile {
System.err.println("GLProfile.init isAWTAvailable "+isAWTAvailable);
System.err.println("GLProfile.init hasNativeOSFactory "+hasNativeOSFactory);
System.err.println("GLProfile.init hasDesktopGL "+hasDesktopGL);
- System.err.println("GLProfile.init hasDesktopGLES12 "+hasDesktopGLES12);
System.err.println("GLProfile.init hasGL234Impl "+hasGL234Impl);
System.err.println("GLProfile.init "+glAvailabilityToString());
}
@@ -1165,8 +1153,6 @@ public class GLProfile {
GL3.equals(profileImpl) ||
GL2.equals(profileImpl) ) {
return "com.jogamp.opengl.impl.gl4.GL4bc";
- } else if(GL2ES12.equals(profileImpl)) {
- return "com.jogamp.opengl.impl.gl2es12.GL2ES12";
} else if(GLES1.equals(profileImpl) || GL2ES1.equals(profileImpl)) {
return "com.jogamp.opengl.impl.es1.GLES1";
} else if(GLES2.equals(profileImpl) || GL2ES2.equals(profileImpl)) {
@@ -1181,9 +1167,7 @@ public class GLProfile {
*/
private static String computeProfileImpl(String profile) {
if (GL2ES1.equals(profile)) {
- if(hasGL2ES12Impl) {
- return GL2ES12;
- } else if(hasGL2Impl) {
+ if(hasGL2Impl) {
return GL2;
} else if(hasGL3bcImpl) {
return GL3bc;
@@ -1193,9 +1177,7 @@ public class GLProfile {
return GLES1;
}
} else if (GL2ES2.equals(profile)) {
- if(hasGL2ES12Impl) {
- return GL2ES12;
- } else if(hasGL2Impl) {
+ if(hasGL2Impl) {
return GL2;
} else if(hasGL3Impl) {
return GL3;