aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/mbien/opencl/CLProgram.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-01-25 21:14:26 +0100
committerMichael Bien <[email protected]>2010-01-25 21:14:26 +0100
commit22a5f55a5d0e4215eacda6dbf01b34cec47a5bf0 (patch)
treeb838b8121715fb99e42231264ab050d059ecb317 /src/com/mbien/opencl/CLProgram.java
parent3ff3ea603ce0e3b0ac8fed74ce57edc2314a3dba (diff)
more direct NIO.
Diffstat (limited to 'src/com/mbien/opencl/CLProgram.java')
-rw-r--r--src/com/mbien/opencl/CLProgram.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/com/mbien/opencl/CLProgram.java b/src/com/mbien/opencl/CLProgram.java
index 0c4325ee..6f1ed551 100644
--- a/src/com/mbien/opencl/CLProgram.java
+++ b/src/com/mbien/opencl/CLProgram.java
@@ -241,12 +241,15 @@ public class CLProgram implements CLResource {
releaseKernels();
}
- long[] deviceIDs = null;
+ PointerBuffer deviceIDs = null;
+ int count = 0;
if(devices != null) {
- deviceIDs = new long[devices.length];
- for (int i = 0; i < deviceIDs.length; i++) {
- deviceIDs[i] = devices[i].ID;
+ deviceIDs = PointerBuffer.allocateDirect(devices.length);
+ for (int i = 0; i < devices.length; i++) {
+ deviceIDs.put(i, devices[i].ID);
}
+ deviceIDs.rewind();
+ count = devices.length;
}
// invalidate build status
@@ -254,7 +257,7 @@ public class CLProgram implements CLResource {
executable = false;
// Build the program
- int ret = cl.clBuildProgram(ID, deviceIDs, options, null, null);
+ int ret = cl.clBuildProgram(ID, count, deviceIDs, options, null, null);
if(ret != CL_SUCCESS) {
throw new CLException(ret, "\n"+getBuildLog());