diff options
author | Michael Bien <[email protected]> | 2010-03-30 18:45:01 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-03-30 18:45:01 +0200 |
commit | 11734980ca3a3457ed67fd054fa3041ba9b8040e (patch) | |
tree | 7fe5c38cfd47f2718fb681bd0fd2fb22a7ae212a /src | |
parent | 9ec0937d729faade497a3d2a394f76992dcdaa45 (diff) |
fixed newly introduced bug in CLCommandQueue, cleanup in CLContext.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/mbien/opencl/CLCommandQueue.java | 3 | ||||
-rw-r--r-- | src/com/mbien/opencl/CLContext.java | 13 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/com/mbien/opencl/CLCommandQueue.java b/src/com/mbien/opencl/CLCommandQueue.java index b1f43c50..66b0d392 100644 --- a/src/com/mbien/opencl/CLCommandQueue.java +++ b/src/com/mbien/opencl/CLCommandQueue.java @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.EnumSet; import java.util.List; +import static com.jogamp.gluegen.runtime.Buffers.*; import static com.mbien.opencl.CLException.*; import static com.mbien.opencl.CL.*; import static com.mbien.opencl.util.CLUtil.*; @@ -46,7 +47,7 @@ public class CLCommandQueue extends CLObject implements CLResource { this.ibB = Int64Buffer.allocateDirect(3); this.ibC = Int64Buffer.allocateDirect(3); - this.pbA = PointerBuffer.wrap(ibA.getBuffer()); + this.pbA = PointerBuffer.allocateDirect(1); } diff --git a/src/com/mbien/opencl/CLContext.java b/src/com/mbien/opencl/CLContext.java index 1acfbbb3..da3899ec 100644 --- a/src/com/mbien/opencl/CLContext.java +++ b/src/com/mbien/opencl/CLContext.java @@ -4,7 +4,6 @@ import com.mbien.opencl.CLDevice.Type; import com.mbien.opencl.CLMemory.Mem; import com.mbien.opencl.CLSampler.AddressingMode; import com.mbien.opencl.CLSampler.FilteringMode; -import com.jogamp.gluegen.runtime.Buffers; import com.jogamp.gluegen.runtime.Int64Buffer; import com.jogamp.gluegen.runtime.PointerBuffer; import java.io.BufferedReader; @@ -156,7 +155,7 @@ public class CLContext extends CLObject implements CLResource { protected static long createContext(PointerBuffer properties, CLDevice... devices) { - IntBuffer status = Buffers.newDirectByteBuffer(4).asIntBuffer(); + IntBuffer status = newDirectIntBuffer(1); PointerBuffer pb = null; if(devices != null && devices.length != 0) { pb = PointerBuffer.allocateDirect(devices.length); @@ -233,35 +232,35 @@ public class CLContext extends CLObject implements CLResource { * Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer. */ public final CLBuffer<ShortBuffer> createShortBuffer(int size, Mem... flags) { - return createBuffer(newDirectByteBuffer(size*SIZEOF_SHORT).asShortBuffer(), flags); + return createBuffer(newDirectShortBuffer(size), flags); } /** * Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer. */ public final CLBuffer<IntBuffer> createIntBuffer(int size, Mem... flags) { - return createBuffer(newDirectByteBuffer(size*SIZEOF_INT).asIntBuffer(), flags); + return createBuffer(newDirectIntBuffer(size), flags); } /** * Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer. */ public final CLBuffer<LongBuffer> createLongBuffer(int size, Mem... flags) { - return createBuffer(newDirectByteBuffer(size*SIZEOF_LONG).asLongBuffer(), flags); + return createBuffer(newDirectLongBuffer(size), flags); } /** * Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer. */ public final CLBuffer<FloatBuffer> createFloatBuffer(int size, Mem... flags) { - return createBuffer(newDirectByteBuffer(size*SIZEOF_FLOAT).asFloatBuffer(), flags); + return createBuffer(newDirectFloatBuffer(size), flags); } /** * Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer. */ public final CLBuffer<DoubleBuffer> createDoubleBuffer(int size, Mem... flags) { - return createBuffer(newDirectByteBuffer(size*SIZEOF_DOUBLE).asDoubleBuffer(), flags); + return createBuffer(newDirectDoubleBuffer(size), flags); } /** |