diff options
Diffstat (limited to 'src/com/jogamp/opencl')
-rw-r--r-- | src/com/jogamp/opencl/CLImage2d.java | 9 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLImage3d.java | 9 |
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); |