aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/impl/egl
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/com/jogamp/opengl/impl/egl
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/egl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java
index 5671b033d..65f16089b 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java
@@ -35,7 +35,6 @@
package com.jogamp.opengl.impl.egl;
-import javax.media.nativewindow.*;
import javax.media.opengl.*;
import com.jogamp.opengl.impl.*;
import com.jogamp.gluegen.runtime.ProcAddressTable;
@@ -200,12 +199,30 @@ public abstract class EGLContext extends GLContextImpl {
eglQueryStringInitialized = false;
eglQueryStringAvailable = false;
- if (eglExtProcAddressTable == null) {
- // FIXME: cache ProcAddressTables by capability bits so we can
- // share them among contexts with the same capabilities
- eglExtProcAddressTable = new EGLExtProcAddressTable(new GLProcAddressResolver());
- }
- resetProcAddressTable(getEGLExtProcAddressTable());
+ int key = compose8bit(major, minor, ctp, 0);
+ EGLExtProcAddressTable table = null;
+ synchronized(mappedProcAddressLock) {
+ table = (EGLExtProcAddressTable) mappedGLXProcAddress.get( key );
+ }
+ if(null != table) {
+ eglExtProcAddressTable = table;
+ if(DEBUG) {
+ System.err.println("GLContext EGL ProcAddressTable reusing key("+major+","+minor+","+ctp+") -> "+table.hashCode());
+ }
+ } else {
+ if (eglExtProcAddressTable == null) {
+ // FIXME: cache ProcAddressTables by capability bits so we can
+ // share them among contexts with the same capabilities
+ eglExtProcAddressTable = new EGLExtProcAddressTable(new GLProcAddressResolver());
+ }
+ resetProcAddressTable(getEGLExtProcAddressTable());
+ synchronized(mappedProcAddressLock) {
+ mappedGLXProcAddress.put(key, getEGLExtProcAddressTable());
+ if(DEBUG) {
+ System.err.println("GLContext EGL ProcAddressTable mapping key("+major+","+minor+","+ctp+") -> "+getEGLExtProcAddressTable().hashCode());
+ }
+ }
+ }
super.updateGLProcAddressTable(major, minor, ctp);
}