diff options
author | Michael Bien <[email protected]> | 2011-01-21 23:45:39 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2011-01-21 23:45:39 +0100 |
commit | 6ca42ce154439b8c2f7f76ce4300ae08678f223a (patch) | |
tree | 88eb37098dfa38eae86497544b41cf4d92232a4b /src | |
parent | 410b03d9fd33d3efe9654694aaeb0b63d1c32842 (diff) |
missing buffer rewind in source upload code (bug id: #458).
Diffstat (limited to 'src')
-rw-r--r-- | src/com/jogamp/opencl/CLProgram.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/jogamp/opencl/CLProgram.java b/src/com/jogamp/opencl/CLProgram.java index 548997e8..e74ebed3 100644 --- a/src/com/jogamp/opencl/CLProgram.java +++ b/src/com/jogamp/opencl/CLProgram.java @@ -73,14 +73,19 @@ public class CLProgram extends CLObject implements CLResource { static CLProgram create(CLContext context, String src) { - IntBuffer status = newDirectByteBuffer(4).asIntBuffer(); + IntBuffer status = newDirectIntBuffer(1); + + PointerBuffer length = (PointerBuffer)PointerBuffer.allocateDirect(1).put(0, src.length()); + String[] srcArray = new String[] {src}; + // Create the program - long id = context.cl.clCreateProgramWithSource(context.ID, 1, new String[] {src}, - (PointerBuffer)PointerBuffer.allocateDirect(1).put(src.length()), status); + long id = context.cl.clCreateProgramWithSource(context.ID, 1, srcArray, length, status); int err = status.get(); if(err != CL_SUCCESS) { - throw newException(err, "can not create program with source on "+context); + // don't remove: locks the reference (length and srcArray) + length.rewind(); + throw newException(err, "can not create program with source (length="+srcArray[0].length()+") on "+context); } return new CLProgram(context, id); |