diff options
author | Michael Bien <[email protected]> | 2010-01-19 00:14:28 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-01-19 00:14:28 +0100 |
commit | 21f0d9231227a4d2c96cb70b5061c18145591fba (patch) | |
tree | 392c64edb0571127fb83ccb003d491f179a0efa2 /src/com/mbien/opencl/CLKernel.java | |
parent | 09ac312a0645bd0d9adff580f29f20382dfbf8c9 (diff) |
temporary dissabled non direct NIO binding for methods containing long[] since its broken on 32bit systems.
refactored high level binding to use direct NIO exclusively.
temporary dissabled low level binding junit tests.
green bar on 32 and 64 bit systems.
Diffstat (limited to 'src/com/mbien/opencl/CLKernel.java')
-rw-r--r-- | src/com/mbien/opencl/CLKernel.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/com/mbien/opencl/CLKernel.java b/src/com/mbien/opencl/CLKernel.java index 33d30730..5e7330e7 100644 --- a/src/com/mbien/opencl/CLKernel.java +++ b/src/com/mbien/opencl/CLKernel.java @@ -2,6 +2,7 @@ package com.mbien.opencl; import com.sun.gluegen.runtime.BufferFactory; import com.sun.gluegen.runtime.CPU; +import com.sun.gluegen.runtime.PointerBuffer; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -37,21 +38,21 @@ public class CLKernel implements CLResource { this.cl = program.context.cl; this.buffer = BufferFactory.newDirectByteBuffer(8); - long[] longArray = new long[1]; + PointerBuffer pb = PointerBuffer.allocateDirect(1); // get function name - int ret = cl.clGetKernelInfo(ID, CL_KERNEL_FUNCTION_NAME, 0, null, longArray, 0); + int ret = cl.clGetKernelInfo(ID, CL_KERNEL_FUNCTION_NAME, 0, null, pb); checkForError(ret, "error while asking for kernel function name"); - ByteBuffer bb = ByteBuffer.allocate((int)longArray[0]).order(ByteOrder.nativeOrder()); + ByteBuffer bb = ByteBuffer.allocateDirect((int)pb.get(0)).order(ByteOrder.nativeOrder()); - ret = cl.clGetKernelInfo(ID, CL_KERNEL_FUNCTION_NAME, bb.capacity(), bb, null, 0); + ret = cl.clGetKernelInfo(ID, CL_KERNEL_FUNCTION_NAME, bb.capacity(), bb, null); checkForError(ret, "error while asking for kernel function name"); - this.name = CLUtils.clString2JavaString(bb.array(), bb.capacity()); + this.name = CLUtils.clString2JavaString(bb, bb.capacity()); // get number of arguments - ret = cl.clGetKernelInfo(ID, CL_KERNEL_NUM_ARGS, bb.capacity(), bb, null, 0); + ret = cl.clGetKernelInfo(ID, CL_KERNEL_NUM_ARGS, bb.capacity(), bb, null); checkForError(ret, "error while asking for number of function arguments."); numArgs = bb.getInt(0); |