diff options
author | Sven Gothel <[email protected]> | 2013-11-05 11:03:33 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-11-05 11:03:33 +0100 |
commit | cf1163fc88976e7087d3a17524a49139e35a4708 (patch) | |
tree | 995f53dac2999615098994860e859e2e1fb2d25b /make | |
parent | 613e33ee8ffc1f2b9c5db1e1b5bb5253a159ed6d (diff) |
Bug 888 / Bug 891 - Enhance GLCapabilities-Query: Apply changes of commit 613e33ee8ffc1f2b9c5db1e1b5bb5253a159ed6d to EGL and WGL.
Note: WGL config query is already performed as a bulk operation.
Note: OSX does not perform such queries.
Diffstat (limited to 'make')
-rw-r--r-- | make/config/jogl/egl-CustomCCode.c | 26 | ||||
-rw-r--r-- | make/config/jogl/egl-CustomJavaCode.java | 45 | ||||
-rw-r--r-- | make/config/jogl/egl.cfg | 28 | ||||
-rw-r--r-- | make/config/jogl/eglext.cfg | 2 | ||||
-rwxr-xr-x | make/scripts/java-win.bat | 3 | ||||
-rwxr-xr-x | make/scripts/tests-win.bat | 6 | ||||
-rw-r--r-- | make/scripts/tests.sh | 5 |
7 files changed, 84 insertions, 31 deletions
diff --git a/make/config/jogl/egl-CustomCCode.c b/make/config/jogl/egl-CustomCCode.c new file mode 100644 index 000000000..0163c6742 --- /dev/null +++ b/make/config/jogl/egl-CustomCCode.c @@ -0,0 +1,26 @@ +#include <stdio.h> /* android */ +#include <gluegen_stdint.h> +#include <gluegen_stddef.h> +#include <EGL/egl.h> + +/* Java->C glue code: + * Java package: 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) { + 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); + + if ( attributeCount > 0 && NULL != attributes ) { + int i; + int * attributes_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, attributes)) + attributes_byte_offset); + EGLint * values_ptr = (EGLint *) (((char*) (*env)->GetDirectBufferAddress(env, values)) + values_byte_offset); + for(i=0; i<attributeCount; i++) { + if( 0 == (* ptr_eglGetConfigAttrib) ((EGLDisplay) (intptr_t) dpy, (EGLConfig) (intptr_t) config, (EGLint) attributes_ptr[i], (EGLint *) &values_ptr[i]) ) { + attributes_ptr[i] = 0; + } + } + } +} + diff --git a/make/config/jogl/egl-CustomJavaCode.java b/make/config/jogl/egl-CustomJavaCode.java new file mode 100644 index 000000000..15689b5d8 --- /dev/null +++ b/make/config/jogl/egl-CustomJavaCode.java @@ -0,0 +1,45 @@ + + private static EGLProcAddressTable _table = new EGLProcAddressTable(new GLProcAddressResolver()); + public static void resetProcAddressTable(DynamicLookupHelper lookup) { + _table.reset(lookup); + } + + // There are some #defines in egl.h that GlueGen and PCPP don't currently handle + public static final long EGL_DEFAULT_DISPLAY = 0; + public static final long EGL_NO_CONTEXT = 0; + public static final long EGL_NO_DISPLAY = 0; + public static final long EGL_NO_SURFACE = 0; + public static final int EGL_DONT_CARE = -1; + public static final int EGL_UNKNOWN = -1; + + protected 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> + * Entry point to C language function: <code> EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value); </code> <br>Part of <code>EGL_VERSION_1_X</code> + * </p> + */ + public static void eglGetConfigAttributes(long dpy, long config, IntBuffer attributes, IntBuffer values) { + if( attributes == null || values == null ) { + throw new RuntimeException("arrays buffers are null"); + } + if( !Buffers.isDirect(attributes) || !Buffers.isDirect(values) ) { + throw new RuntimeException("arrays buffers are not direct"); + } + if( attributes.remaining() > values.remaining() ) { + throw new RuntimeException("not enough values "+values+" for attributes "+attributes); + } + final long __addr = _table._addressof_eglGetConfigAttrib; + dispatch_eglGetConfigAttributes(dpy, config, attributes.remaining(), attributes, Buffers.getDirectBufferByteOffset(attributes), + values, Buffers.getDirectBufferByteOffset(values), __addr); + } + private static native void dispatch_eglGetConfigAttributes(long dpy, long config, int attributeCount, Object attributes, int attributes_byte_offset, Object values, int valuesOffset, long procAddr); + diff --git a/make/config/jogl/egl.cfg b/make/config/jogl/egl.cfg index b30985076..94b67951d 100644 --- a/make/config/jogl/egl.cfg +++ b/make/config/jogl/egl.cfg @@ -25,31 +25,7 @@ GetProcAddressTableExpr _table ArgumentIsString eglGetProcAddress 0 ReturnsString eglQueryString -CustomCCode #include <stdio.h> /* android */ -CustomCCode #include <gluegen_stdint.h> -CustomCCode #include <gluegen_stddef.h> -CustomCCode #include <EGL/egl.h> - -CustomJavaCode EGL private static EGLProcAddressTable _table = new EGLProcAddressTable(new GLProcAddressResolver()); -CustomJavaCode EGL public static void resetProcAddressTable(DynamicLookupHelper lookup) { -CustomJavaCode EGL _table.reset(lookup); -CustomJavaCode EGL } - -# There are some #defines in egl.h that GlueGen and PCPP don't currently handle -CustomJavaCode EGL public static final long EGL_DEFAULT_DISPLAY = 0; -CustomJavaCode EGL public static final long EGL_NO_CONTEXT = 0; -CustomJavaCode EGL public static final long EGL_NO_DISPLAY = 0; -CustomJavaCode EGL public static final long EGL_NO_SURFACE = 0; -CustomJavaCode EGL public static final int EGL_DONT_CARE = -1; -CustomJavaCode EGL public static final int EGL_UNKNOWN = -1; -CustomJavaCode EGL -CustomJavaCode EGL protected static long eglGetProcAddress(long eglGetProcAddressHandle, java.lang.String procname) -CustomJavaCode EGL { -CustomJavaCode EGL if (eglGetProcAddressHandle == 0) { -CustomJavaCode EGL throw new GLException("Passed null pointer for method \"eglGetProcAddress\""); -CustomJavaCode EGL } -CustomJavaCode EGL return dispatch_eglGetProcAddress0(procname, eglGetProcAddressHandle); -CustomJavaCode EGL } - +IncludeAs CustomJavaCode EGL egl-CustomJavaCode.java +IncludeAs CustomCCode egl-CustomCCode.c Import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver diff --git a/make/config/jogl/eglext.cfg b/make/config/jogl/eglext.cfg index a7fb45409..7fccce716 100644 --- a/make/config/jogl/eglext.cfg +++ b/make/config/jogl/eglext.cfg @@ -17,6 +17,8 @@ NIODirectOnly __ALL__ ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/jogamp/opengl/egl/EGL.java +IgnoreExtension EGL_VERSION_1_X + HierarchicalNativeOutput false # Use a ProcAddressTable so we dynamically look up the routines diff --git a/make/scripts/java-win.bat b/make/scripts/java-win.bat index 47b8184b2..2b45ae517 100755 --- a/make/scripts/java-win.bat +++ b/make/scripts/java-win.bat @@ -1,4 +1,5 @@ -%J2RE_HOME%\bin\java -classpath %CP_ALL% "-Djava.library.path=%LIB_DIR%" %D_ARGS% %X_ARGS% %* > java-win.log 2>&1
+REM %J2RE_HOME%\bin\java -classpath %CP_ALL% "-Djava.library.path=%LIB_DIR%" %D_ARGS% %X_ARGS% %* > java-win.log 2>&1
+%J2RE_HOME%\bin\java -classpath %CP_ALL% %D_ARGS% %X_ARGS% %* > java-win.log 2>&1
tail java-win.log
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat index 0632c24b0..8de40e1f4 100755 --- a/make/scripts/tests-win.bat +++ b/make/scripts/tests-win.bat @@ -17,7 +17,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedConte REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2AWT3 %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2AWT3b %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextWithJTabbedPaneAWT %* -scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 %* +REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextNewtAWTBug523 %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListAWT %* @@ -78,12 +78,14 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintin REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT -time 30000 REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT %* -scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT %* +REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -vsync -time 4000 -x 10 -y 10 -width 100 -height 100 -screen 0 REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -vsync -time 40000 -width 100 -height 100 -screen 0 %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWT -time 5000 REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT %* +scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.DemoGLJPanelPerf01AWT %* +REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.DemoGLJPanelPerf02AWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT %* diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 6fbba6adf..63a3fa8c6 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -304,7 +304,8 @@ function testawtswt() { #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $* -#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.DemoGLJPanelGridAWT $* +testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.DemoGLJPanelPerf01AWT $* +#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.DemoGLJPanelPerf02AWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* @@ -385,7 +386,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT0 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT1 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT2 $* -testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT3 $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT3 $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2AWT3 $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2AWT3b $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 $* |