From cf1163fc88976e7087d3a17524a49139e35a4708 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Tue, 5 Nov 2013 11:03:33 +0100
Subject: 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.
---
make/config/jogl/egl-CustomCCode.c | 26 ++++++++++++++++++
make/config/jogl/egl-CustomJavaCode.java | 45 ++++++++++++++++++++++++++++++++
make/config/jogl/egl.cfg | 28 ++------------------
make/config/jogl/eglext.cfg | 2 ++
4 files changed, 75 insertions(+), 26 deletions(-)
create mode 100644 make/config/jogl/egl-CustomCCode.c
create mode 100644 make/config/jogl/egl-CustomJavaCode.java
(limited to 'make/config')
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 /* android */
+#include
+#include
+#include
+
+/* 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
+ * Entry point to C language function: EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value);
Part of EGL_VERSION_1_X
+ *
+ */
+ 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 /* android */
-CustomCCode #include
-CustomCCode #include
-CustomCCode #include
-
-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
--
cgit v1.2.3