aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-08-07 15:21:09 +0200
committerMichael Bien <[email protected]>2010-08-07 15:21:09 +0200
commitb32190b0b899e4806e85625e7b0d1e242fdf0f05 (patch)
tree2c375fee04e4d8b45095f1911830c09be2fb94bd /src
parent2f1035db067feef9111ac3cd28c6d1256efa9a18 (diff)
added a few CLImage junit tests.
Diffstat (limited to 'src')
-rw-r--r--src/com/jogamp/opencl/CLImage2d.java9
-rw-r--r--src/com/jogamp/opencl/CLImage3d.java9
2 files changed, 12 insertions, 6 deletions
diff --git a/src/com/jogamp/opencl/CLImage2d.java b/src/com/jogamp/opencl/CLImage2d.java
index 7cf04cf1..c6d4c96a 100644
--- a/src/com/jogamp/opencl/CLImage2d.java
+++ b/src/com/jogamp/opencl/CLImage2d.java
@@ -24,9 +24,12 @@ public class CLImage2d<B extends Buffer> extends CLImage<B> {
int width, int height, int rowPitch, CLImageFormat format, int flags) {
CL cl = context.cl;
- IntBuffer err = Buffers.newDirectByteBuffer(4).asIntBuffer();
-
- long id = cl.clCreateImage2D(context.ID, flags, format.getFormatImpl(), width, height, rowPitch, directBuffer, err);
+ IntBuffer err = Buffers.newDirectIntBuffer(1);
+ B host_ptr = null;
+ if(isHostPointerFlag(flags)) {
+ host_ptr = directBuffer;
+ }
+ long id = cl.clCreateImage2D(context.ID, flags, format.getFormatImpl(), width, height, rowPitch, host_ptr, err);
checkForError(err.get(), "can not create 2d image");
return new CLImage2d<B>(context, directBuffer, format, width, height, id, flags);
diff --git a/src/com/jogamp/opencl/CLImage3d.java b/src/com/jogamp/opencl/CLImage3d.java
index fd127864..efa97fd3 100644
--- a/src/com/jogamp/opencl/CLImage3d.java
+++ b/src/com/jogamp/opencl/CLImage3d.java
@@ -30,9 +30,12 @@ public class CLImage3d<B extends Buffer> extends CLImage<B> {
int width, int height, int depth, int rowPitch, int slicePitch, CLImageFormat format, int flags) {
CL cl = context.cl;
- IntBuffer err = Buffers.newDirectByteBuffer(4).asIntBuffer();
-
- long id = cl.clCreateImage3D(context.ID, flags, format.getFormatImpl(), width, height, depth, rowPitch, slicePitch, directBuffer, err);
+ IntBuffer err = Buffers.newDirectIntBuffer(1);
+ B host_ptr = null;
+ if(isHostPointerFlag(flags)) {
+ host_ptr = directBuffer;
+ }
+ long id = cl.clCreateImage3D(context.ID, flags, format.getFormatImpl(), width, height, depth, rowPitch, slicePitch, host_ptr, err);
checkForError(err.get(), "can not create 2d image");
return new CLImage3d<B>(context, directBuffer, format, width, height, depth, id, flags);