summaryrefslogtreecommitdiffstats
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
parent321cac1e125f806eb437e528b343d07379b31163 (diff)
Adapt to GlueGen commit c3054a01990e55ab35756ea23ab7d7c05f24dd37 (compount call-by-value extension), utilizing native JVMUtil_NewDirectByteBufferCopy(..)
-rw-r--r--make/config/jogl/glx-CustomCCode.c75
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java2
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java2
3 files changed, 8 insertions, 71 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;
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 80f46955d..3d1925214 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -1565,7 +1565,7 @@ public class GLProfile {
private static final Constructor<?> getCtor(final String clazzName, final boolean glObject, final ClassLoader cl) {
try {
- return ReflectionUtil.getConstructor(clazzName, glObject ? ctorGLArgs : ctorProcArgs, cl);
+ return ReflectionUtil.getConstructor(clazzName, glObject ? ctorGLArgs : ctorProcArgs, false, cl);
} catch (Throwable t) {
if( DEBUG ) {
System.err.println("Catched: "+t.getMessage());
diff --git a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java
index 22ac3bd94..e6b68f87b 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java
@@ -95,7 +95,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory {
nativeWindowConstructor = ReflectionUtil.getConstructor(
windowClassName, new Class[] { Object.class, AbstractGraphicsConfiguration.class },
- getClass().getClassLoader());
+ true, getClass().getClassLoader());
} catch (Exception e) {
throw new IllegalArgumentException(e);
}