diff options
Diffstat (limited to 'src/com/mbien/opencl/CLProgram.java')
-rw-r--r-- | src/com/mbien/opencl/CLProgram.java | 13 |
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()); |