diff options
Diffstat (limited to 'make/config/jogl')
-rw-r--r-- | make/config/jogl/glx-CustomCCode.c | 60 | ||||
-rw-r--r-- | make/config/jogl/glx-CustomJavaCode.java | 56 | ||||
-rw-r--r-- | make/config/jogl/glx-x11.cfg | 6 | ||||
-rw-r--r-- | make/config/jogl/glxext.cfg | 4 |
4 files changed, 66 insertions, 60 deletions
diff --git a/make/config/jogl/glx-CustomCCode.c b/make/config/jogl/glx-CustomCCode.c index e372e5120..71dc68b08 100644 --- a/make/config/jogl/glx-CustomCCode.c +++ b/make/config/jogl/glx-CustomCCode.c @@ -89,36 +89,30 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXGetVisualFromFBConfig(JNIEnv *env, j /* Java->C glue code: * Java package: jogamp.opengl.x11.glx.GLX - * Java method: java.nio.LongBuffer glXChooseFBConfig(long dpy, int screen, java.nio.IntBuffer attribList, java.nio.IntBuffer nitems) + * Java method: com.jogamp.common.nio.PointerBuffer dispatch_glXChooseFBConfig(long dpy, int screen, java.nio.IntBuffer attribList, java.nio.IntBuffer nitems) * C function: GLXFBConfig * glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); */ JNIEXPORT jobject JNICALL Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseFBConfig(JNIEnv *env, jclass _unused, jlong dpy, jint screen, jobject attribList, jint attribList_byte_offset, jobject nitems, jint nitems_byte_offset, jlong procAddress) { - typedef GLXFBConfig* (APIENTRY*_local_PFNGLXCHOOSEFBCONFIG)(Display * dpy, int screen, const int * attribList, int * nitems); - _local_PFNGLXCHOOSEFBCONFIG ptr_glXChooseFBConfig; - int * _ptr2 = NULL; - int * _ptr3 = NULL; + typedef GLXFBConfig * (APIENTRY*_local_PFNGLXCHOOSEFBCONFIGPROC)(Display * dpy, int screen, const int * attribList, int * nitems); + _local_PFNGLXCHOOSEFBCONFIGPROC ptr_glXChooseFBConfig; + int * _attribList_ptr = NULL; + int * _nitems_ptr = NULL; GLXFBConfig * _res; int count; jobject jbyteSource; jobject jbyteCopy; - ptr_glXChooseFBConfig = (_local_PFNGLXCHOOSEFBCONFIG) (intptr_t) procAddress; + if ( NULL != attribList ) { + _attribList_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, attribList)) + attribList_byte_offset); + } + if ( NULL != nitems ) { + _nitems_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, nitems)) + nitems_byte_offset); + } + ptr_glXChooseFBConfig = (_local_PFNGLXCHOOSEFBCONFIGPROC) (intptr_t) procAddress; assert(ptr_glXChooseFBConfig != NULL); - if (attribList != NULL) { - _ptr2 = (int *) (((char*) (*env)->GetPrimitiveArrayCritical(env, attribList, NULL)) + attribList_byte_offset); - } - if (nitems != NULL) { - _ptr3 = (int *) (((char*) (*env)->GetPrimitiveArrayCritical(env, nitems, NULL)) + nitems_byte_offset); - } - _res = (*ptr_glXChooseFBConfig)((Display *) (intptr_t) dpy, (int) screen, (int *) _ptr2, (int *) _ptr3); - count = _ptr3[0]; - if (attribList != NULL) { - (*env)->ReleasePrimitiveArrayCritical(env, attribList, _ptr2, 0); - } - if (nitems != NULL) { - (*env)->ReleasePrimitiveArrayCritical(env, nitems, _ptr3, 0); - } - if (_res == NULL) return NULL; + _res = (* ptr_glXChooseFBConfig) ((Display *) (intptr_t) dpy, (int) screen, (int *) _attribList_ptr, (int *) _nitems_ptr); + count = _nitems_ptr[0]; + if (NULL == _res) return NULL; _initClazzAccess(env); @@ -130,29 +124,27 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseFBConfig(JNIEnv *env, jclass _ return jbyteCopy; } + /* Java->C glue code: * Java package: jogamp.opengl.x11.glx.GLX - * Java method: XVisualInfo glXChooseVisual(long dpy, int screen, java.nio.IntBuffer attribList) + * Java method: XVisualInfo dispatch_glXChooseVisual(long dpy, int screen, java.nio.IntBuffer attribList) * C function: XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); */ JNIEXPORT jobject JNICALL Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseVisual(JNIEnv *env, jclass _unused, jlong dpy, jint screen, jobject attribList, jint attribList_byte_offset, jlong procAddress) { - typedef XVisualInfo* (APIENTRY*_local_PFNGLXCHOOSEVISUAL)(Display * dpy, int screen, int * attribList); - _local_PFNGLXCHOOSEVISUAL ptr_glXChooseVisual; - int * _ptr2 = NULL; + typedef XVisualInfo * (APIENTRY*_local_PFNGLXCHOOSEVISUALPROC)(Display * dpy, int screen, int * attribList); + _local_PFNGLXCHOOSEVISUALPROC ptr_glXChooseVisual; + int * _attribList_ptr = NULL; XVisualInfo * _res; jobject jbyteSource; jobject jbyteCopy; - ptr_glXChooseVisual = (_local_PFNGLXCHOOSEVISUAL) (intptr_t) procAddress; + if ( NULL != attribList ) { + _attribList_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, attribList)) + attribList_byte_offset); + } + ptr_glXChooseVisual = (_local_PFNGLXCHOOSEVISUALPROC) (intptr_t) procAddress; assert(ptr_glXChooseVisual != NULL); - if (attribList != NULL) { - _ptr2 = (int *) (((char*) (*env)->GetPrimitiveArrayCritical(env, attribList, NULL)) + attribList_byte_offset); - } - _res = (*ptr_glXChooseVisual)((Display *) (intptr_t) dpy, (int) screen, (int *) _ptr2); - if (attribList != NULL) { - (*env)->ReleasePrimitiveArrayCritical(env, attribList, _ptr2, 0); - } - if (_res == NULL) return NULL; + _res = (* ptr_glXChooseVisual) ((Display *) (intptr_t) dpy, (int) screen, (int *) _attribList_ptr); + if (NULL == _res) return NULL; _initClazzAccess(env); diff --git a/make/config/jogl/glx-CustomJavaCode.java b/make/config/jogl/glx-CustomJavaCode.java index 36ad10031..ed126a5c9 100644 --- a/make/config/jogl/glx-CustomJavaCode.java +++ b/make/config/jogl/glx-CustomJavaCode.java @@ -16,43 +16,49 @@ private static native java.nio.ByteBuffer dispatch_glXGetVisualFromFBConfig(long dpy, long config, long procAddr); - /** Interface to C language function: <br> - Alias for: <br> <code> GLXFBConfig * glXChooseFBConfigSGIX, glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); </code> */ - public static com.jogamp.common.nio.PointerBuffer glXChooseFBConfig(long dpy, int screen, int[] attribList, int attribList_offset, int[] nitems, int nitems_offset) - { + /** Entry point to C language function: <code> GLXFBConfig * glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); </code> <br>Part of CORE FUNC + @param attribList a direct only {@link java.nio.IntBuffer} + @param nitems a direct only {@link java.nio.IntBuffer} */ + public static PointerBuffer glXChooseFBConfig(long dpy, int screen, IntBuffer attribList, IntBuffer nitems) { + + if (!Buffers.isDirect(attribList)) + throw new GLException("Argument \"attribList\" is not a direct buffer"); + if (!Buffers.isDirect(nitems)) + throw new GLException("Argument \"nitems\" is not a direct buffer"); final long __addr_ = glxProcAddressTable._addressof_glXChooseFBConfig; if (__addr_ == 0) { - throw new GLException("Method \"glXChooseFBConfig\" not available"); + throw new GLException("Method \"glXChooseFBConfig\" not available"); } - if(attribList != null && attribList.length <= attribList_offset) - throw new GLException("array offset argument \"attribList_offset\" (" + attribList_offset + ") equals or exceeds array length (" + attribList.length + ")"); - if(nitems != null && nitems.length <= nitems_offset) - throw new GLException("array offset argument \"nitems_offset\" (" + nitems_offset + ") equals or exceeds array length (" + nitems.length + ")"); - java.nio.ByteBuffer _res; - _res = dispatch_glXChooseFBConfig(dpy, screen, attribList, Buffers.SIZEOF_INT * attribList_offset, nitems, Buffers.SIZEOF_INT * nitems_offset, __addr_); - + final ByteBuffer _res; + _res = dispatch_glXChooseFBConfig(dpy, screen, attribList, Buffers.getDirectBufferByteOffset(attribList), nitems, Buffers.getDirectBufferByteOffset(nitems), __addr_); if (_res == null) return null; + Buffers.nativeOrder(_res); return PointerBuffer.wrap(_res); } - /** Entry point to C language function: - Alias for: <br> <code> GLXFBConfig * glXChooseFBConfigSGIX, glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); </code> */ - private static native java.nio.ByteBuffer dispatch_glXChooseFBConfig(long dpy, int screen, Object attribList, int attribList_byte_offset, Object nitems, int nitems_byte_offset, long procAddr); + /** Entry point to C language function: <code> GLXFBConfig * glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); </code> <br>Part of CORE FUNC + @param attribList a direct only {@link java.nio.IntBuffer} + @param nitems a direct only {@link java.nio.IntBuffer} */ + private static native ByteBuffer dispatch_glXChooseFBConfig(long dpy, int screen, Object attribList, int attribList_byte_offset, Object nitems, int nitems_byte_offset, long procAddress); - /** Interface to C language function: <br> - Alias for: <br> <code> XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); </code> */ - public static XVisualInfo glXChooseVisual(long dpy, int screen, int[] attribList, int attribList_offset) - { + + /** Entry point to C language function: <code> XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); </code> <br>Part of <code>GLX_VERSION_1_X</code> + @param attribList a direct only {@link java.nio.IntBuffer} */ + public static XVisualInfo glXChooseVisual(long dpy, int screen, IntBuffer attribList) { + + if (!Buffers.isDirect(attribList)) + throw new GLException("Argument \"attribList\" is not a direct buffer"); final long __addr_ = glxProcAddressTable._addressof_glXChooseVisual; if (__addr_ == 0) { - throw new GLException("Method \"glXChooseVisual\" not available"); + throw new GLException("Method \"glXChooseVisual\" not available"); } - if(attribList != null && attribList.length <= attribList_offset) - throw new GLException("array offset argument \"attribList_offset\" (" + attribList_offset + ") equals or exceeds array length (" + attribList.length + ")"); - java.nio.ByteBuffer _res; - _res = dispatch_glXChooseVisual(dpy, screen, attribList, Buffers.SIZEOF_INT * attribList_offset, __addr_); - + final ByteBuffer _res; + _res = dispatch_glXChooseVisual(dpy, screen, attribList, Buffers.getDirectBufferByteOffset(attribList), __addr_); if (_res == null) return null; - return XVisualInfo.create(_res); + return XVisualInfo.create(Buffers.nativeOrder(_res)); } - /** Entry point to C language function: - Alias for: <br> <code> XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); </code> */ - private static native java.nio.ByteBuffer dispatch_glXChooseVisual(long dpy, int screen, Object attribList, int attribList_byte_offset, long procAddr); + /** Entry point to C language function: <code> XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); </code> <br>Part of <code>GLX_VERSION_1_X</code> + @param attribList a direct only {@link java.nio.IntBuffer} */ + private static native ByteBuffer dispatch_glXChooseVisual(long dpy, int screen, Object attribList, int attribList_byte_offset, long procAddress); diff --git a/make/config/jogl/glx-x11.cfg b/make/config/jogl/glx-x11.cfg index 4daa78b84..017b1e00b 100644 --- a/make/config/jogl/glx-x11.cfg +++ b/make/config/jogl/glx-x11.cfg @@ -13,6 +13,10 @@ Include gl-desktop.cfg GLHeader GL/glx.h GLHeader GL/glxext.h +# Only NIO direct function, no arrays .. +NIOOnly __ALL__ +NIODirectOnly __ALL__ + ForceProcAddressGen __ALL__ LocalProcAddressCallingConvention __ALL__ APIENTRY @@ -95,6 +99,6 @@ CustomJavaCode GLX { CustomJavaCode GLX if (glXGetProcAddressHandle == 0) { CustomJavaCode GLX throw new GLException("Passed null pointer for method \"glXGetProcAddress\""); CustomJavaCode GLX } -CustomJavaCode GLX return dispatch_glXGetProcAddress1(procname, glXGetProcAddressHandle); +CustomJavaCode GLX return dispatch_glXGetProcAddress0(procname, glXGetProcAddressHandle); CustomJavaCode GLX } diff --git a/make/config/jogl/glxext.cfg b/make/config/jogl/glxext.cfg index de23b9f17..c73753e3c 100644 --- a/make/config/jogl/glxext.cfg +++ b/make/config/jogl/glxext.cfg @@ -13,6 +13,10 @@ ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/jogamp/opengl/x11/gl Include gl-common.cfg Include gl-desktop.cfg +# Only NIO direct function, no arrays .. +NIOOnly __ALL__ +NIODirectOnly __ALL__ + GLHeader GL/glx.h GLHeader GL/glxext.h |