aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/impl/x11
diff options
context:
space:
mode:
authorSven Gothel <sgothel@jausoft.com>2010-10-29 06:30:45 +0200
committerSven Gothel <sgothel@jausoft.com>2010-10-29 06:30:45 +0200
commita0c7b5ca791f659d9c98654b47246092aad42665 (patch)
tree7dbc6d920657558143008a888854e70f14bec8fb /src/jogl/classes/com/jogamp/opengl/impl/x11
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/com/jogamp/opengl/impl/x11')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
index 3cf691493..697ee6353 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
@@ -392,12 +392,28 @@ public abstract class X11GLXContext extends GLContextImpl {
glXQueryExtensionsStringInitialized = false;
glXQueryExtensionsStringAvailable = false;
- if (glXExtProcAddressTable == null) {
- // FIXME: cache ProcAddressTables by OpenGL context type bits so we can
- // share them among contexts classes (GL4, GL4bc, GL3, GL3bc, ..)
- glXExtProcAddressTable = new GLXExtProcAddressTable(new GLProcAddressResolver());
- }
- resetProcAddressTable(getGLXExtProcAddressTable());
+ int key = compose8bit(major, minor, ctp, 0);
+ GLXExtProcAddressTable table = null;
+ synchronized(mappedProcAddressLock) {
+ table = (GLXExtProcAddressTable) mappedGLXProcAddress.get( key );
+ }
+ if(null != table) {
+ glXExtProcAddressTable = table;
+ if(DEBUG) {
+ System.err.println("GLContext GLX ProcAddressTable reusing key("+major+","+minor+","+ctp+") -> "+table.hashCode());
+ }
+ } else {
+ if (glXExtProcAddressTable == null) {
+ glXExtProcAddressTable = new GLXExtProcAddressTable(new GLProcAddressResolver());
+ }
+ resetProcAddressTable(getGLXExtProcAddressTable());
+ synchronized(mappedProcAddressLock) {
+ mappedGLXProcAddress.put(key, getGLXExtProcAddressTable());
+ if(DEBUG) {
+ System.err.println("GLContext GLX ProcAddressTable mapping key("+major+","+minor+","+ctp+") -> "+getGLXExtProcAddressTable().hashCode());
+ }
+ }
+ }
super.updateGLProcAddressTable(major, minor, ctp);
}