summaryrefslogtreecommitdiffstats
path: root/make/config/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-06-17 03:07:15 +0200
committerSven Gothel <[email protected]>2014-06-17 03:07:15 +0200
commit68ca3ae8fcce28c62034299bc6e6f7eaab50bd1f (patch)
tree2021e3b1d399575889071272127808eba8bd5c10 /make/config/jogl
parent321cac1e125f806eb437e528b343d07379b31163 (diff)
Adapt to GlueGen commit c3054a01990e55ab35756ea23ab7d7c05f24dd37 (compount call-by-value extension), utilizing native JVMUtil_NewDirectByteBufferCopy(..)
Diffstat (limited to 'make/config/jogl')
-rw-r--r--make/config/jogl/glx-CustomCCode.c75
1 files changed, 6 insertions, 69 deletions
diff --git a/make/config/jogl/glx-CustomCCode.c b/make/config/jogl/glx-CustomCCode.c
index b077c65ac..7216e5b65 100644
--- a/make/config/jogl/glx-CustomCCode.c
+++ b/make/config/jogl/glx-CustomCCode.c
@@ -17,51 +17,8 @@
/* We expect glXGetProcAddressARB to be defined */
extern void (*glXGetProcAddressARB(const GLubyte *procname))();
-static const char * clazzNameBuffers = "com/jogamp/common/nio/Buffers";
-static const char * clazzNameBuffersStaticCstrName = "copyByteBuffer";
-static const char * clazzNameBuffersStaticCstrSignature = "(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;";
-static const char * clazzNameByteBuffer = "java/nio/ByteBuffer";
-static jclass clazzBuffers = NULL;
-static jmethodID cstrBuffers = NULL;
-static jclass clazzByteBuffer = NULL;
-
-static void _initClazzAccess(JNIEnv *env) {
- jclass c;
-
- if(NULL!=cstrBuffers) return ;
-
- c = (*env)->FindClass(env, clazzNameBuffers);
- if(NULL==c) {
- fprintf(stderr, "FatalError: Java_jogamp_opengl_x11_glx_GLX: can't find %s\n", clazzNameBuffers);
- (*env)->FatalError(env, clazzNameBuffers);
- }
- clazzBuffers = (jclass)(*env)->NewGlobalRef(env, c);
- if(NULL==clazzBuffers) {
- fprintf(stderr, "FatalError: Java_jogamp_opengl_x11_glx_GLX: can't use %s\n", clazzNameBuffers);
- (*env)->FatalError(env, clazzNameBuffers);
- }
- c = (*env)->FindClass(env, clazzNameByteBuffer);
- if(NULL==c) {
- fprintf(stderr, "FatalError: Java_jogamp_opengl_x11_glx_GLX: can't find %s\n", clazzNameByteBuffer);
- (*env)->FatalError(env, clazzNameByteBuffer);
- }
- clazzByteBuffer = (jclass)(*env)->NewGlobalRef(env, c);
- if(NULL==c) {
- fprintf(stderr, "FatalError: Java_jogamp_opengl_x11_glx_GLX: can't use %s\n", clazzNameByteBuffer);
- (*env)->FatalError(env, clazzNameByteBuffer);
- }
-
- cstrBuffers = (*env)->GetStaticMethodID(env, clazzBuffers,
- clazzNameBuffersStaticCstrName, clazzNameBuffersStaticCstrSignature);
- if(NULL==cstrBuffers) {
- fprintf(stderr, "FatalError: Java_jogamp_opengl_x11_glx_GLX:: can't create %s.%s %s\n",
- clazzNameBuffers,
- clazzNameBuffersStaticCstrName, clazzNameBuffersStaticCstrSignature);
- (*env)->FatalError(env, clazzNameBuffersStaticCstrName);
- }
-}
-
-/* Java->C glue code:
+/**
+ * Java->C glue code:
* Java package: jogamp.opengl.x11.glx.GLX
* Java method: int glXGetFBConfigAttributes(long dpy, long config, IntBuffer attributes, IntBuffer values)
*/
@@ -96,19 +53,13 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXGetVisualFromFBConfig(JNIEnv *env, j
typedef XVisualInfo* (APIENTRY*_local_PFNGLXGETVISUALFROMFBCONFIG)(Display * dpy, GLXFBConfig config);
_local_PFNGLXGETVISUALFROMFBCONFIG ptr_glXGetVisualFromFBConfig;
XVisualInfo * _res;
- jobject jbyteSource;
jobject jbyteCopy;
ptr_glXGetVisualFromFBConfig = (_local_PFNGLXGETVISUALFROMFBCONFIG) (intptr_t) procAddress;
assert(ptr_glXGetVisualFromFBConfig != NULL);
_res = (* ptr_glXGetVisualFromFBConfig) ((Display *) (intptr_t) dpy, (GLXFBConfig) (intptr_t) config);
if (_res == NULL) return NULL;
- _initClazzAccess(env);
-
- jbyteSource = (*env)->NewDirectByteBuffer(env, _res, sizeof(XVisualInfo));
- jbyteCopy = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffers, jbyteSource);
-
- (*env)->DeleteLocalRef(env, jbyteSource);
+ jbyteCopy = JVMUtil_NewDirectByteBufferCopy(env, _res, sizeof(XVisualInfo));
XFree(_res);
return jbyteCopy;
@@ -127,7 +78,6 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseFBConfig(JNIEnv *env, jclass _
int * _nitems_ptr = NULL;
GLXFBConfig * _res;
int count, i;
- jobject jbyteSource;
jobject jbyteCopy;
if ( NULL != attribList ) {
_attribList_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, attribList)) + attribList_byte_offset);
@@ -158,11 +108,8 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseFBConfig(JNIEnv *env, jclass _
}
}
// fprintf(stderr, "glXChooseFBConfig.X: Count %d\n", count);
- _initClazzAccess(env);
- jbyteSource = (*env)->NewDirectByteBuffer(env, _res, count * sizeof(GLXFBConfig));
- jbyteCopy = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffers, jbyteSource);
- (*env)->DeleteLocalRef(env, jbyteSource);
+ jbyteCopy = JVMUtil_NewDirectByteBufferCopy(env, _res, count * sizeof(GLXFBConfig));
XFree(_res);
return jbyteCopy;
@@ -180,7 +127,6 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXGetFBConfigs(JNIEnv *env, jclass _un
int * _nelements_ptr = NULL;
GLXFBConfig * _res;
int count, i;
- jobject jbyteSource;
jobject jbyteCopy;
if ( NULL != nelements ) {
_nelements_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, nelements)) + nelements_byte_offset);
@@ -206,11 +152,8 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXGetFBConfigs(JNIEnv *env, jclass _un
i++;
}
}
- _initClazzAccess(env);
- jbyteSource = (*env)->NewDirectByteBuffer(env, _res, count * sizeof(GLXFBConfig));
- jbyteCopy = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffers, jbyteSource);
- (*env)->DeleteLocalRef(env, jbyteSource);
+ jbyteCopy = JVMUtil_NewDirectByteBufferCopy(env, _res, count * sizeof(GLXFBConfig));
XFree(_res);
return jbyteCopy;
@@ -228,7 +171,6 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseVisual(JNIEnv *env, jclass _un
_local_PFNGLXCHOOSEVISUALPROC ptr_glXChooseVisual;
int * _attribList_ptr = NULL;
XVisualInfo * _res;
- jobject jbyteSource;
jobject jbyteCopy;
if ( NULL != attribList ) {
_attribList_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, attribList)) + attribList_byte_offset);
@@ -238,12 +180,7 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseVisual(JNIEnv *env, jclass _un
_res = (* ptr_glXChooseVisual) ((Display *) (intptr_t) dpy, (int) screen, (int *) _attribList_ptr);
if (NULL == _res) return NULL;
- _initClazzAccess(env);
-
- jbyteSource = (*env)->NewDirectByteBuffer(env, _res, sizeof(XVisualInfo));
- jbyteCopy = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffers, jbyteSource);
-
- (*env)->DeleteLocalRef(env, jbyteSource);
+ jbyteCopy = JVMUtil_NewDirectByteBufferCopy(env, _res, sizeof(XVisualInfo));
XFree(_res);
return jbyteCopy;