aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl
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/windows/wgl
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/windows/wgl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
index 65a8e8ac3..027fb0065 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
@@ -340,12 +340,30 @@ public class WindowsWGLContext extends GLContextImpl {
wglMakeContextCurrentInitialized=false;
wglMakeContextCurrentAvailable=false;
- if (wglExtProcAddressTable == null) {
- // FIXME: cache ProcAddressTables by OpenGL context type bits so we can
- // share them among contexts classes (GL4, GL4bc, GL3, GL3bc, ..)
- wglExtProcAddressTable = new WGLExtProcAddressTable(new GLProcAddressResolver());
- }
- resetProcAddressTable(getWGLExtProcAddressTable());
+ int key = compose8bit(major, minor, ctp, 0);
+ WGLExtProcAddressTable table = null;
+ synchronized(mappedProcAddressLock) {
+ table = (WGLExtProcAddressTable) mappedGLXProcAddress.get( key );
+ }
+ if(null != table) {
+ wglExtProcAddressTable = table;
+ if(DEBUG) {
+ System.err.println("GLContext WGL ProcAddressTable reusing key("+major+","+minor+","+ctp+") -> "+table.hashCode());
+ }
+ } else {
+ if (wglExtProcAddressTable == null) {
+ // FIXME: cache ProcAddressTables by OpenGL context type bits so we can
+ // share them among contexts classes (GL4, GL4bc, GL3, GL3bc, ..)
+ wglExtProcAddressTable = new WGLExtProcAddressTable(new GLProcAddressResolver());
+ }
+ resetProcAddressTable(getWGLExtProcAddressTable());
+ synchronized(mappedProcAddressLock) {
+ mappedGLXProcAddress.put(key, getWGLExtProcAddressTable());
+ if(DEBUG) {
+ System.err.println("GLContext WGL ProcAddressTable mapping key("+major+","+minor+","+ctp+") -> "+getWGLExtProcAddressTable().hashCode());
+ }
+ }
+ }
super.updateGLProcAddressTable(major, minor, ctp);
}