|
From: <sp...@us...> - 2012-02-28 18:18:17
|
Revision: 3745
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3745&view=rev
Author: spasi
Date: 2012-02-28 18:18:06 +0000 (Tue, 28 Feb 2012)
Log Message:
-----------
Fixed clEnqueueNativeKernel crash.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
Modified: trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java 2012-02-18 18:38:57 UTC (rev 3744)
+++ trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java 2012-02-28 18:18:06 UTC (rev 3745)
@@ -362,16 +362,18 @@
return getDeclaredFieldRecursive(ByteBuffer.class, "address");
}
- private static Field getDeclaredFieldRecursive(Class<?> type, final String fieldName) throws NoSuchFieldException {
- while ( type != null ) {
+ private static Field getDeclaredFieldRecursive(final Class<?> root, final String fieldName) throws NoSuchFieldException {
+ Class<?> type = root;
+
+ do {
try {
return type.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
type = type.getSuperclass();
}
- }
+ } while ( type != null );
- throw new NoSuchFieldException(fieldName + " does not exist in " + type.getSimpleName() + " or any of its superclasses.");
+ throw new NoSuchFieldException(fieldName + " does not exist in " + root.getSimpleName() + " or any of its superclasses.");
}
}
Modified: trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2012-02-18 18:38:57 UTC (rev 3744)
+++ trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2012-02-28 18:18:06 UTC (rev 3745)
@@ -146,10 +146,10 @@
static void CL_CALLBACK nativeKernelCallback(void *args) {
JNIEnv *env = attachCurrentThread();
jobject user_func = (jobject)(intptr_t)*(jlong *)args;
- jint num_mem_objects = *(jint *)((char *)args + 8);
+ jsize num_mem_objects = *(jsize *)((char *)args + 8);
jobjectArray memobjs = NULL;
jobject buffer;
- jint i;
+ jsize i;
if ( env != NULL && !(*env)->ExceptionOccurred(env) && nativeKernelCallbackJ != NULL ) {
if ( num_mem_objects > 0 ) {
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java 2012-02-18 18:38:57 UTC (rev 3744)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java 2012-02-28 18:18:06 UTC (rev 3745)
@@ -1073,7 +1073,7 @@
nativeAfterVars = "\tvoid **args_mem_loc = num_mem_objects == 0 ? NULL : (void **)malloc(num_mem_objects * sizeof(void *));",
nativeBeforeCall = "\t_ptr_i = 0;\n" +
"\twhile ( _ptr_i < num_mem_objects ) {\n" +
- "\t\targs_mem_loc[_ptr_i] = (cl_void *)((char *)args_address + (4 + _ptr_i * (4 + sizeof(void *))));\n" +
+ "\t\targs_mem_loc[_ptr_i] = (cl_void *)((char *)args_address + (12 + 4 + _ptr_i * (4 + sizeof(void *))));\n" +
"\t\t_ptr_i++;\n" +
"\t}",
nativeAfterCall = "\tfree(args_mem_loc);"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|