diff options
27 files changed, 182 insertions, 105 deletions
diff --git a/make/build-jogl.xml b/make/build-jogl.xml index 4efe992de..7c34691a0 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -99,7 +99,7 @@ value="com/jogamp/opengl/cg com/jogamp/opengl/cg/* jogamp/opengl/cg/*"/> <property name="java.part.egl" - value="jogamp/opengl/egl/*"/> + value="com/jogamp/opengl/egl/* jogamp/opengl/egl/*"/> <property name="java.part.glu" value="javax/media/opengl/glu/* javax/media/opengl/glu/gl2es1/* jogamp/opengl/glu/* jogamp/opengl/glu/error/* jogamp/opengl/glu/tessellator/** jogamp/opengl/glu/mipmap/**"/> @@ -1517,6 +1517,7 @@ <patternset id="c.src.files.jogl.desktop"> <include name="${rootrel.src.c}/JoglCommon.c"/> <include name="${rootrel.src.c}/GLContext.c"/> + <include name="${rootrel.src.c}/EGLContext.c"/> <include name="${rootrel.src.c}/GLDebugMessageHandler.c"/> <include name="${rootrel.src.c}/timespec.c" if="isOSX"/> <!-- currently only used for OSX --> <include name="${rootrel.src.c}/macosx/MacOSXCustomCGLCode.c" if="isOSX"/> @@ -1543,6 +1544,7 @@ <patternset id="c.src.files.jogl.mobile"> <include name="${rootrel.src.c}/JoglCommon.c"/> <include name="${rootrel.src.c}/GLContext.c"/> + <include name="${rootrel.src.c}/EGLContext.c"/> <include name="${rootrel.src.c}/GLDebugMessageHandler.c"/> <include name="${rootrel.src.c}/GLXGetProcAddressARB.c" if="isX11"/> <include name="${rootrel.src.c.libav}/ffmpeg_static.c"/> diff --git a/make/config/jogl/egl-CustomCCode.c b/make/config/jogl/egl-CustomCCode.c index 0163c6742..5dd34232c 100644 --- a/make/config/jogl/egl-CustomCCode.c +++ b/make/config/jogl/egl-CustomCCode.c @@ -4,10 +4,10 @@ #include <EGL/egl.h> /* Java->C glue code: - * Java package: jogamp.opengl.egl.EGL + * Java package: com.jogamp.opengl.egl.EGL * Java method: void eglGetConfigAttributes(long dpy, long config, IntBuffer attributes, IntBuffer values) */ -Java_jogamp_opengl_egl_EGL_dispatch_1eglGetConfigAttributes(JNIEnv *env, jclass _unused, jlong dpy, jlong config, jint attributeCount, jobject attributes, jint attributes_byte_offset, jobject values, jint values_byte_offset, jlong procAddress) { +Java_com_jogamp_opengl_egl_EGL_dispatch_1eglGetConfigAttributes(JNIEnv *env, jclass _unused, jlong dpy, jlong config, jint attributeCount, jobject attributes, jint attributes_byte_offset, jobject values, jint values_byte_offset, jlong procAddress) { typedef EGLBoolean (EGLAPIENTRY*_local_PFNEGLGETCONFIGATTRIBPROC)(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value); _local_PFNEGLGETCONFIGATTRIBPROC ptr_eglGetConfigAttrib = (_local_PFNEGLGETCONFIGATTRIBPROC) (intptr_t) procAddress; assert(ptr_eglGetConfigAttrib != NULL); diff --git a/make/config/jogl/egl-CustomJavaCode.java b/make/config/jogl/egl-CustomJavaCode.java index 4cc486fd4..0c3935691 100644 --- a/make/config/jogl/egl-CustomJavaCode.java +++ b/make/config/jogl/egl-CustomJavaCode.java @@ -1,7 +1,8 @@ private static EGLProcAddressTable _table = new EGLProcAddressTable(new GLProcAddressResolver()); - static void resetProcAddressTable(DynamicLookupHelper lookup) { + protected static boolean resetProcAddressTable(DynamicLookupHelper lookup) { _table.reset(lookup); + return 0 != _table._addressof_eglGetDisplay && 0 != _table._addressof_eglInitialize; } // There are some #defines in egl.h that GlueGen and PCPP don't currently handle @@ -12,15 +13,6 @@ public static final int EGL_DONT_CARE = -1; public static final int EGL_UNKNOWN = -1; - static long eglGetProcAddress(long eglGetProcAddressHandle, java.lang.String procname) - { - if (eglGetProcAddressHandle == 0) { - throw new GLException("Passed null pointer for method \"eglGetProcAddress\""); - } - return dispatch_eglGetProcAddress0(procname, eglGetProcAddressHandle); - } - - /** * In case of an error on a particualr attribute, the attribute in the attributes-buffer is set to 0. * <p> diff --git a/make/config/jogl/egl-common.cfg b/make/config/jogl/egl-common.cfg index cf5d0b083..62694da53 100644 --- a/make/config/jogl/egl-common.cfg +++ b/make/config/jogl/egl-common.cfg @@ -29,7 +29,9 @@ Opaque long __EGLFuncPtr # Implement the first argument to eglGetProcAddress as String instead # of byte[] -ArgumentIsString eglGetProcAddress 0 +#ArgumentIsString eglGetProcAddress 0 +#Implemented in EGLContext +Ignore eglGetProcAddress ReturnsString eglQueryString # Force all of the methods to be emitted using dynamic linking so we diff --git a/make/config/jogl/egl.cfg b/make/config/jogl/egl.cfg index 94b67951d..453987d3e 100644 --- a/make/config/jogl/egl.cfg +++ b/make/config/jogl/egl.cfg @@ -3,7 +3,7 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/egl -Package jogamp.opengl.egl +Package com.jogamp.opengl.egl JavaClass EGL Style AllStatic # Shouldn't matter which one of these we pick up @@ -19,10 +19,13 @@ HierarchicalNativeOutput false EmitProcAddressTable true ProcAddressTableClassName EGLProcAddressTable GetProcAddressTableExpr _table +AccessControl com.jogamp.opengl.egl.EGLProcAddressTable PACKAGE_PRIVATE # Implement the first argument to eglGetProcAddress as String instead # of byte[] -ArgumentIsString eglGetProcAddress 0 +#ArgumentIsString eglGetProcAddress 0 +#Implemented in EGLContext +Ignore eglGetProcAddress ReturnsString eglQueryString IncludeAs CustomJavaCode EGL egl-CustomJavaCode.java diff --git a/make/config/jogl/eglext.cfg b/make/config/jogl/eglext.cfg index 7fccce716..1da9b253d 100644 --- a/make/config/jogl/eglext.cfg +++ b/make/config/jogl/eglext.cfg @@ -3,7 +3,7 @@ JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl/egl -Package jogamp.opengl.egl +Package com.jogamp.opengl.egl Style InterfaceAndImpl JavaClass EGLExt ImplPackage jogamp.opengl.egl @@ -15,7 +15,7 @@ Include egl-common.cfg NIOOnly __ALL__ NIODirectOnly __ALL__ -ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/jogamp/opengl/egl/EGL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/egl/EGL.java IgnoreExtension EGL_VERSION_1_X @@ -24,7 +24,11 @@ HierarchicalNativeOutput false # Use a ProcAddressTable so we dynamically look up the routines EmitProcAddressTable true ProcAddressTableClassName EGLExtProcAddressTable -GetProcAddressTableExpr _context.getEGLExtProcAddressTable() +GetProcAddressTableExpr _table +AccessControl jogamp.opengl.egl.EGLExtProcAddressTable PACKAGE_PRIVATE + +Import com.jogamp.opengl.egl.EGLExt +Import com.jogamp.opengl.egl.EGLClientPixmapHI CustomCCode #include <stdio.h> /* android */ CustomCCode #include <gluegen_stdint.h> @@ -47,8 +51,9 @@ CustomJavaCode EGLExt public static final long EGL_NO_SYNC_KHR = 0; CustomJavaCode EGLExt public boolean isFunctionAvailable(String glFunctionName); CustomJavaCode EGLExt public boolean isExtensionAvailable(String glExtensionName); -CustomJavaCode EGLExtImpl public EGLExtImpl(EGLContext context) { +CustomJavaCode EGLExtImpl public EGLExtImpl(EGLContext context, EGLExtProcAddressTable table) { CustomJavaCode EGLExtImpl this._context = context; +CustomJavaCode EGLExtImpl this._table = table; CustomJavaCode EGLExtImpl } CustomJavaCode EGLExtImpl public boolean isFunctionAvailable(String glFunctionName) @@ -61,5 +66,7 @@ CustomJavaCode EGLExtImpl { CustomJavaCode EGLExtImpl return _context.isExtensionAvailable(glExtensionName); CustomJavaCode EGLExtImpl } -CustomJavaCode EGLExtImpl private EGLContext _context; +CustomJavaCode EGLExtImpl private final EGLContext _context; +CustomJavaCode EGLExtImpl private final EGLExtProcAddressTable _table; +CustomJavaCode EGLExtImpl final EGLExtProcAddressTable getProcAdressTable() { return _table; } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-common.java b/make/config/jogl/gl-impl-CustomJavaCode-common.java index a2ca12960..6db08efa7 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-common.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-common.java @@ -1,8 +1,10 @@ + private final GLProfile glProfile; + private final GLContextImpl _context; + @Override public GLProfile getGLProfile() { return this.glProfile; } - private final GLProfile glProfile; @Override public final int getBoundBuffer(int target) { @@ -85,8 +87,6 @@ return _context; } - private final GLContextImpl _context; - /** * @see javax.media.opengl.GLContext#setSwapInterval(int) */ diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java index 10b22b08d..335bffb80 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java +++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java @@ -33,9 +33,8 @@ import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.opengl.GLCapabilitiesImmutable; import com.jogamp.common.os.Platform; - -import jogamp.opengl.egl.EGL; -import jogamp.opengl.egl.EGLExt; +import com.jogamp.opengl.egl.EGL; +import com.jogamp.opengl.egl.EGLExt; /** * GLRendererQuirks contains information of known bugs of various GL renderer. diff --git a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java index b80f123aa..245b6a945 100644 --- a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java @@ -31,8 +31,9 @@ package jogamp.opengl.egl; import java.util.ArrayList; import java.util.List; +import com.jogamp.opengl.egl.EGL; + import jogamp.opengl.GLDynamicLibraryBundleInfo; -import jogamp.opengl.egl.EGL; /** * Implementation of the DynamicLookupHelper for Desktop ES2 (AMD, ..) @@ -58,7 +59,7 @@ public final class DesktopES2DynamicLibraryBundleInfo extends GLDynamicLibraryBu @Override public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { - return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName); + return EGLContext.eglGetProcAddress(toolGetProcAddressHandle, funcName); } @Override 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<String, String> 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: <code> __EGLFuncPtr eglGetProcAddress(const char * procname) </code> <br>Part of <code>EGL_VERSION_1_X</code> */ + static private native long dispatch_eglGetProcAddress0(String procname, long procAddress); + // // Accessible .. // diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java index 98ecbbe51..199b20464 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java @@ -38,12 +38,12 @@ import javax.media.nativewindow.ToolkitLock; import javax.media.opengl.GLException; import jogamp.opengl.Debug; -import jogamp.opengl.egl.EGL; import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.LongObjectHashMap; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.egl.EGL; /** * This implementation provides recursive calls to diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java index 0cd686c5b..5b080a183 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java @@ -43,9 +43,9 @@ import javax.media.opengl.GLException; import jogamp.nativewindow.ProxySurfaceImpl; import jogamp.opengl.GLDrawableImpl; import jogamp.opengl.GLDynamicLookupHelper; -import jogamp.opengl.egl.EGL; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.egl.EGL; public class EGLDrawable extends GLDrawableImpl { static boolean DEBUG = GLDrawableImpl.DEBUG; diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index db872fec4..967bcb6da 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -72,11 +72,11 @@ import jogamp.opengl.GLDrawableImpl; import jogamp.opengl.GLDynamicLookupHelper; import jogamp.opengl.GLGraphicsConfigurationUtil; import jogamp.opengl.SharedResourceRunner; -import jogamp.opengl.egl.EGL; import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.PointerBuffer; +import com.jogamp.common.os.DynamicLookupHelper; import com.jogamp.common.os.Platform; import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; @@ -84,6 +84,7 @@ import com.jogamp.common.util.VersionNumber; import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.GLRendererQuirks; +import com.jogamp.opengl.egl.EGL; public class EGLDrawableFactory extends GLDrawableFactoryImpl { protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; // allow package access @@ -171,6 +172,13 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } + static class EGLAcc extends EGL { + protected static boolean resetProcAddressTable(final DynamicLookupHelper lookup) { + return EGL.resetProcAddressTable(lookup); + } + } + static final String eglInitializeFuncName = "eglInitialize"; + public EGLDrawableFactory() { super(); @@ -179,43 +187,30 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { return; } eglDynamicLookupHelperInit = true; - } - - // Check for other underlying stuff .. - if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true)) { - hasX11 = true; - try { - ReflectionUtil.createInstance("jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory", EGLDrawableFactory.class.getClassLoader()); - } catch (final Exception jre) { /* n/a .. */ } - } - // FIXME: Probably need to move EGL from a static model - // to a dynamic one, where there can be 2 instances - // for each ES profile with their own ProcAddressTable. - - synchronized(EGLDrawableFactory.class) { - if( null == eglES1DynamicLookupHelper ) { - GLDynamicLookupHelper tmp=null; + // Check for other underlying stuff .. + if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true)) { + hasX11 = true; try { - tmp = new GLDynamicLookupHelper(new EGLES1DynamicLibraryBundleInfo()); - } catch (final GLException gle) { - if(DEBUG) { - gle.printStackTrace(); - } - } - if(null!=tmp && tmp.isLibComplete()) { - eglES1DynamicLookupHelper = tmp; - EGL.resetProcAddressTable(eglES1DynamicLookupHelper); - final boolean isANGLEES1 = isANGLE(eglES1DynamicLookupHelper); - isANGLE |= isANGLEES1; - if (DEBUG || GLProfile.DEBUG) { - System.err.println("Info: EGLDrawableFactory: EGL ES1 - OK, isANGLE: "+isANGLEES1); - } - } else if (DEBUG || GLProfile.DEBUG) { - System.err.println("Info: EGLDrawableFactory: EGL ES1 - NOPE (ES1 lib)"); - } + ReflectionUtil.createInstance("jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory", EGLDrawableFactory.class.getClassLoader()); + } catch (final Exception jre) { /* n/a .. */ } } - if( null == eglES2DynamicLookupHelper ) { + + /** + * FIXME: Probably need to move EGL from a static model + * to a dynamic one, where there can be 2 instances + * for each ES profile with their own ProcAddressTable. + * + * Since EGL is designed to be static + * we validate the function address of 'eglInitialize' + * with all EGL/ES and EGL/GL combinations. + * In case this address doesn't match the primary tuple EGL/ES2 + * the profile is skipped! + */ + boolean eglTableReset = false; + long eglInitializeAddress = 0; + // Setup: eglES2DynamicLookupHelper[, eglES1DynamicLookupHelper] + { GLDynamicLookupHelper tmp=null; try { tmp = new GLDynamicLookupHelper(new EGLES2DynamicLibraryBundleInfo()); @@ -224,9 +219,9 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { gle.printStackTrace(); } } - if(null!=tmp && tmp.isLibComplete()) { + if( null != tmp && tmp.isLibComplete() && true == ( eglTableReset = EGLAcc.resetProcAddressTable(tmp) ) ) { + eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName); eglES2DynamicLookupHelper = tmp; - EGL.resetProcAddressTable(eglES2DynamicLookupHelper); final boolean includesES1 = null == eglES1DynamicLookupHelper && includesES1(eglES2DynamicLookupHelper); if(includesES1) { eglES1DynamicLookupHelper = tmp; @@ -234,7 +229,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { final boolean isANGLEES2 = isANGLE(eglES2DynamicLookupHelper); isANGLE |= isANGLEES2; if (DEBUG || GLProfile.DEBUG) { - System.err.println("Info: EGLDrawableFactory: EGL ES2 - OK (includesES1 "+includesES1+", isANGLE: "+isANGLEES2+")"); + System.err.println("Info: EGLDrawableFactory: EGL ES2 - OK (includesES1 "+includesES1+", isANGLE: "+isANGLEES2+", eglInitialize 0x"+Long.toHexString(eglInitializeAddress)+")"); if(includesES1) { System.err.println("Info: EGLDrawableFactory: EGL ES1 - OK (ES2 lib)"); } @@ -243,6 +238,47 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { System.err.println("Info: EGLDrawableFactory: EGL ES2 - NOPE"); } } + // Setup: eglES1DynamicLookupHelper + if( null == eglES1DynamicLookupHelper ) { + GLDynamicLookupHelper tmp=null; + try { + tmp = new GLDynamicLookupHelper(new EGLES1DynamicLibraryBundleInfo()); + } catch (final GLException gle) { + if(DEBUG) { + gle.printStackTrace(); + } + } + if( null != tmp && tmp.isLibComplete() ) { + final boolean ok; + final long _eglInitializeAddress; + if( !eglTableReset ) { + if( true == ( eglTableReset = EGLAcc.resetProcAddressTable(tmp) ) ) { + _eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName); + eglInitializeAddress = _eglInitializeAddress; + ok = true; + } else { + _eglInitializeAddress = 0; + ok = false; + } + } else { + _eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName); + ok = _eglInitializeAddress == eglInitializeAddress; + } + if( ok ) { + eglES1DynamicLookupHelper = tmp; + final boolean isANGLEES1 = isANGLE(eglES1DynamicLookupHelper); + isANGLE |= isANGLEES1; + if (DEBUG || GLProfile.DEBUG) { + System.err.println("Info: EGLDrawableFactory: EGL ES1 - OK (isANGLE: "+isANGLEES1+", eglTableReset "+eglTableReset+", eglInitialize 0x"+Long.toHexString(_eglInitializeAddress)+")"); + } + } else if (DEBUG || GLProfile.DEBUG) { + System.err.println("Info: EGLDrawableFactory: EGL ES1 - NOPE (ES1 proc, eglTableReset "+eglTableReset+", eglInitialize 0x"+Long.toHexString(_eglInitializeAddress)+")"); + } + } else if (DEBUG || GLProfile.DEBUG) { + System.err.println("Info: EGLDrawableFactory: EGL ES1 - NOPE (ES1 lib)"); + } + } + // Setup: eglGLnDynamicLookupHelper if( null == eglGLnDynamicLookupHelper ) { GLDynamicLookupHelper tmp=null; try { @@ -252,14 +288,32 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { gle.printStackTrace(); } } - if(null!=tmp && tmp.isLibComplete()) { - eglGLnDynamicLookupHelper = tmp; - EGL.resetProcAddressTable(eglGLnDynamicLookupHelper); - if (DEBUG || GLProfile.DEBUG) { - System.err.println("Info: EGLDrawableFactory: EGL GLn - OK"); + if( null != tmp && tmp.isLibComplete() ) { + final boolean ok; + final long _eglInitializeAddress; + if( !eglTableReset ) { + if( true == ( eglTableReset = EGLAcc.resetProcAddressTable(tmp) ) ) { + _eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName); + eglInitializeAddress = _eglInitializeAddress; + ok = true; + } else { + _eglInitializeAddress = 0; + ok = false; + } + } else { + _eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName); + ok = _eglInitializeAddress == eglInitializeAddress; + } + if( ok ) { + eglGLnDynamicLookupHelper = tmp; + if (DEBUG || GLProfile.DEBUG) { + System.err.println("Info: EGLDrawableFactory: EGL GLn - OK (eglTableReset "+eglTableReset+", eglInitialize 0x"+Long.toHexString(_eglInitializeAddress)+")"); + } + } else if (DEBUG || GLProfile.DEBUG) { + System.err.println("Info: EGLDrawableFactory: EGL GLn - NOPE (GLn proc, eglTableReset "+eglTableReset+", eglInitialize 0x"+Long.toHexString(_eglInitializeAddress)+")"); } } else if (DEBUG || GLProfile.DEBUG) { - System.err.println("Info: EGLDrawableFactory: EGL GLn - NOPE"); + System.err.println("Info: EGLDrawableFactory: EGL GLn - NOPE (GLn lib)"); } } if( null != eglES2DynamicLookupHelper || null != eglES1DynamicLookupHelper || null != eglGLnDynamicLookupHelper ) { @@ -286,7 +340,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { sharedResourceRunner.start(); } } - } + } // synchronized(EGLDrawableFactory.class) } @Override diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java index f00d7059d..0757bd98e 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java @@ -6,6 +6,7 @@ import javax.media.nativewindow.UpstreamSurfaceHook; import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.egl.EGL; /** Uses a PBuffer offscreen surface */ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java index 83b4d69f5..1b433cc30 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java @@ -33,10 +33,10 @@ import java.util.List; import jogamp.common.os.PlatformPropsImpl; import jogamp.opengl.GLDynamicLibraryBundleInfo; -import jogamp.opengl.egl.EGL; import com.jogamp.common.os.AndroidVersion; import com.jogamp.common.os.Platform; +import com.jogamp.opengl.egl.EGL; /** * Abstract implementation of the DynamicLookupHelper for EGL, @@ -81,7 +81,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle @Override public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { - return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName); + return EGLContext.eglGetProcAddress(toolGetProcAddressHandle, funcName); } @Override diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java index a8dd7d5c8..258765ba3 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java @@ -34,6 +34,8 @@ import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.egl.EGL; +import com.jogamp.opengl.egl.EGLExt; public class EGLGLCapabilities extends GLCapabilities { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java index 1d90e63af..6f0d7ae4d 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java @@ -57,6 +57,8 @@ import com.jogamp.common.nio.PointerBuffer; import com.jogamp.nativewindow.MutableGraphicsConfiguration; 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 EGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java index 9bfb8ced9..4aa34ce4e 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java @@ -58,12 +58,12 @@ import javax.media.opengl.GLProfile; import jogamp.opengl.GLGraphicsConfigurationFactory; import jogamp.opengl.GLGraphicsConfigurationUtil; -import jogamp.opengl.egl.EGL; import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.GLRendererQuirks; +import com.jogamp.opengl.egl.EGL; /** Subclass of GraphicsConfigurationFactory used when non-AWT tookits diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java b/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java index d00656a34..796a9e2c8 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java @@ -37,11 +37,12 @@ import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLException; import com.jogamp.common.nio.Buffers; +import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook; +import com.jogamp.opengl.egl.EGL; import jogamp.nativewindow.ProxySurfaceImpl; import jogamp.nativewindow.WrappedSurface; import jogamp.opengl.GLDrawableImpl; -import jogamp.opengl.egl.EGL; /** * <pre> @@ -80,10 +81,10 @@ public class EGLSurface extends WrappedSurface { } } - public static EGLSurface createSurfaceless(final EGLGraphicsConfiguration cfg, final EGLUpstreamSurfacelessHook upstream, final boolean ownsDevice) { + public static EGLSurface createSurfaceless(final EGLGraphicsConfiguration cfg, final GenericUpstreamSurfacelessHook upstream, final boolean ownsDevice) { return new EGLSurface(cfg, upstream, ownsDevice); } - private EGLSurface(final EGLGraphicsConfiguration cfg, final EGLUpstreamSurfacelessHook upstream, final boolean ownsDevice) { + private EGLSurface(final EGLGraphicsConfiguration cfg, final GenericUpstreamSurfacelessHook upstream, final boolean ownsDevice) { super(cfg, EGL.EGL_NO_SURFACE, upstream, ownsDevice); if(EGLDrawableFactory.DEBUG) { System.err.println("EGLSurface.ctor().3: "+this); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java index 694f2d30d..92e13dc61 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java @@ -41,6 +41,7 @@ import javax.media.opengl.GLException; import jogamp.nativewindow.WrappedSurface; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.egl.EGL; /** * <pre> diff --git a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java index f9df9153f..8e60b9cc7 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java @@ -33,13 +33,13 @@ import java.nio.IntBuffer; import javax.media.opengl.GL; import com.jogamp.common.nio.Buffers; +import com.jogamp.opengl.egl.EGL; +import com.jogamp.opengl.egl.EGLExt; import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.TextureSequence; -import jogamp.opengl.egl.EGL; import jogamp.opengl.egl.EGLContext; import jogamp.opengl.egl.EGLDrawable; -import jogamp.opengl.egl.EGLExt; public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl { final protected TextureType texType; diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java index 5baf9e543..74a051b77 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java @@ -33,9 +33,9 @@ import java.io.IOException; import javax.media.opengl.GL; import javax.media.opengl.GLException; +import com.jogamp.opengl.egl.EGL; import com.jogamp.opengl.util.texture.TextureSequence; -import jogamp.opengl.egl.EGL; import jogamp.opengl.util.av.EGLMediaPlayerImpl; /** diff --git a/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java index a5f4fc769..fd3beb209 100644 --- a/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java @@ -33,6 +33,8 @@ import jogamp.opengl.egl.*; import javax.media.nativewindow.*; +import com.jogamp.opengl.egl.EGL; + public class DisplayDriver extends jogamp.newt.DisplayImpl { static { NEWTJNILibLoader.loadNEWT(); diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java index 6179626d4..908a55604 100644 --- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java @@ -52,8 +52,8 @@ import com.jogamp.common.os.AndroidVersion; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.Window; +import com.jogamp.opengl.egl.EGL; -import jogamp.opengl.egl.EGL; import jogamp.opengl.egl.EGLDisplayUtil; import jogamp.opengl.egl.EGLGraphicsConfiguration; import jogamp.opengl.egl.EGLGraphicsConfigurationFactory; diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java index ceb337150..6fb93bf97 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java @@ -38,9 +38,9 @@ import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.NativeWindowException; import jogamp.newt.NEWTJNILibLoader; -import jogamp.opengl.egl.EGL; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; +import com.jogamp.opengl.egl.EGL; public class DisplayDriver extends jogamp.newt.DisplayImpl { diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java index 1b67fa755..407668718 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java @@ -38,13 +38,13 @@ import javax.media.nativewindow.util.PixelFormat; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IOUtil; +import com.jogamp.opengl.egl.EGL; import com.jogamp.opengl.util.PNGPixelRect; import jogamp.newt.DisplayImpl; import jogamp.newt.NEWTJNILibLoader; import jogamp.newt.PointerIconImpl; import jogamp.newt.driver.linux.LinuxMouseTracker; -import jogamp.opengl.egl.EGL; import jogamp.opengl.egl.EGLDisplayUtil; public class DisplayDriver extends DisplayImpl { diff --git a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java index e72ddbc11..64e7e698e 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java @@ -37,9 +37,10 @@ package jogamp.newt.driver.kd; import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.NativeWindowException; +import com.jogamp.opengl.egl.EGL; + import jogamp.newt.DisplayImpl; import jogamp.newt.NEWTJNILibLoader; -import jogamp.opengl.egl.EGL; import jogamp.opengl.egl.EGLDisplayUtil; public class DisplayDriver extends DisplayImpl { |