From d0676451343e826e49d9c5732320f080d4c11c8d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 23 Jan 2015 00:48:16 +0100 Subject: Bug 1096 - Expose EGL to public: com.jogamp.opengl.egl.EGL ; EGLDrawableFactory: Validate static EGL func-ptr, probe EGL/ES2 first - Move EGL to public package jogamp.opengl.egl.EGL -> com.jogamp.opengl.egl.EGL - EGLDrawableFactory - Validate static EGL func-ptr against EGL/ES2, ignoring EGL/[ES|GL] collisions w/ diff. native EGL implementations due to static EGL usage. - Probe EGL/ES2 first --- src/jogl/classes/jogamp/opengl/egl/EGLContext.java | 39 +++++++++++++--------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/egl/EGLContext.java') diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index b19f9b0be..b3c848012 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -50,8 +50,6 @@ import javax.media.opengl.GLProfile; import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLDrawableImpl; -import jogamp.opengl.egl.EGL; -import jogamp.opengl.egl.EGLExt; import jogamp.opengl.egl.EGLExtImpl; import jogamp.opengl.egl.EGLExtProcAddressTable; @@ -61,12 +59,14 @@ import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.GLRendererQuirks; +import com.jogamp.opengl.egl.EGL; +import com.jogamp.opengl.egl.EGLExt; public class EGLContext extends GLContextImpl { - private EGLExt _eglExt; // Table that holds the addresses of the native C-language entry points for // EGL extension functions. private EGLExtProcAddressTable eglExtProcAddressTable; + private EGLExtImpl eglExtImpl; static final int CTX_PROFILE_COMPAT = GLContext.CTX_PROFILE_COMPAT; static final int CTX_PROFILE_CORE = GLContext.CTX_PROFILE_CORE; @@ -84,7 +84,7 @@ public class EGLContext extends GLContextImpl { @Override protected void resetStates(final boolean isInit) { eglExtProcAddressTable = null; - // no inner state _eglExt = null; + eglExtImpl = null; super.resetStates(isInit); } @@ -93,11 +93,8 @@ public class EGLContext extends GLContextImpl { return getEGLExt(); } - public EGLExt getEGLExt() { - if (_eglExt == null) { - _eglExt = new EGLExtImpl(this); - } - return _eglExt; + public final EGLExt getEGLExt() { + return eglExtImpl; } @Override @@ -105,10 +102,6 @@ public class EGLContext extends GLContextImpl { return eglExtProcAddressTable; } - public final EGLExtProcAddressTable getEGLExtProcAddressTable() { - return eglExtProcAddressTable; - } - @Override protected Map getFunctionNameMap() { return null; } @@ -359,15 +352,19 @@ public class EGLContext extends GLContextImpl { if(DEBUG) { System.err.println(getThreadName() + ": GLContext EGL ProcAddressTable reusing key("+key+") -> "+toHexString(table.hashCode())); } + if( null == eglExtImpl || eglExtImpl.getProcAdressTable() != eglExtProcAddressTable ) { + eglExtImpl = new EGLExtImpl(this, eglExtProcAddressTable); + } } else { eglExtProcAddressTable = new EGLExtProcAddressTable(new GLProcAddressResolver()); - resetProcAddressTable(getEGLExtProcAddressTable()); + resetProcAddressTable(eglExtProcAddressTable); synchronized(mappedContextTypeObjectLock) { - mappedGLXProcAddress.put(key, getEGLExtProcAddressTable()); + mappedGLXProcAddress.put(key, eglExtProcAddressTable); if(DEBUG) { - System.err.println(getThreadName() + ": GLContext EGL ProcAddressTable mapping key("+key+") -> "+toHexString(getEGLExtProcAddressTable().hashCode())); + System.err.println(getThreadName() + ": GLContext EGL ProcAddressTable mapping key("+key+") -> "+toHexString(eglExtProcAddressTable.hashCode())); } } + eglExtImpl = new EGLExtImpl(this, eglExtProcAddressTable); } } @@ -413,6 +410,16 @@ public class EGLContext extends GLContextImpl { return EGL.eglSwapInterval(drawable.getNativeSurface().getDisplayHandle(), interval); } + static long eglGetProcAddress(final long eglGetProcAddressHandle, final String procname) + { + if (0 == eglGetProcAddressHandle) { + throw new GLException("Passed null pointer for method \"eglGetProcAddress\""); + } + return dispatch_eglGetProcAddress0(procname, eglGetProcAddressHandle); + } + /** Entry point to C language function: __EGLFuncPtr eglGetProcAddress(const char * procname)
Part of EGL_VERSION_1_X */ + static private native long dispatch_eglGetProcAddress0(String procname, long procAddress); + // // Accessible .. // -- cgit v1.2.3