diff options
author | Sven Gothel <[email protected]> | 2013-10-12 22:54:56 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-12 22:54:56 +0200 |
commit | 518fcb4730256a3aaf77cf787219d5941eb3c9b4 (patch) | |
tree | 1738499c72cf6e1f41c77c2da39c07f76f0cd923 | |
parent | d587291ccfc23970647192aeffc99fc60b17829c (diff) |
Bug 552 putMapImage(..): Added variant w/ long[] imageRowPitch and long[] imageSlicePitch return values while always passing PointerBuffers (size_t*) for same values to clEnqueueMapImage(..)
-rw-r--r-- | src/com/jogamp/opencl/CLCommandQueue.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/com/jogamp/opencl/CLCommandQueue.java b/src/com/jogamp/opencl/CLCommandQueue.java index d0548acb..dd5c0f66 100644 --- a/src/com/jogamp/opencl/CLCommandQueue.java +++ b/src/com/jogamp/opencl/CLCommandQueue.java @@ -1208,6 +1208,16 @@ public class CLCommandQueue extends CLObjectResource { public ByteBuffer putMapImage(CLImage2d<?> image, CLMemory.Map flag, int offsetX, int offsetY, int rangeX, int rangeY, boolean blockingMap, CLEventList condition, CLEventList events) { + return putMapImage(image, flag, offsetX, offsetY, rangeX, rangeY, blockingMap, condition, events, null, null); + } + + /** + * Calls {@native clEnqueueMapImage}. + */ + public ByteBuffer putMapImage(CLImage2d<?> image, CLMemory.Map flag, + int offsetX, int offsetY, + int rangeX, int rangeY, boolean blockingMap, CLEventList condition, CLEventList events, + long[] imageRowPitch, long[] imageSlicePitch ) { PointerBuffer conditionIDs = null; int conditions = 0; @@ -1221,14 +1231,24 @@ public class CLCommandQueue extends CLObjectResource { // spec: CL_INVALID_VALUE if image is a 2D image object and origin[2] is not equal to 0 or region[2] is not equal to 1 copy2NIO(ibB, offsetX, offsetY, 0); copy2NIO(ibC, rangeX, rangeY, 1); + + final PointerBuffer _imageRowPitch = PointerBuffer.allocateDirect(1); // size_t* + final PointerBuffer _imageSlicePitch = PointerBuffer.allocateDirect(1); // size_t* ByteBuffer mappedImage = cl.clEnqueueMapImage(ID, image.ID, clBoolean(blockingMap), - flag.FLAGS, ibB, ibC, null, null, + flag.FLAGS, ibB, ibC, _imageRowPitch, _imageSlicePitch, conditions, conditionIDs, events==null ? null : events.IDs, error); if(error.get(0) != CL_SUCCESS) { throw newException(error.get(0), "can not map " + image + " with: " + flag + " offset: " + toStr(offsetX, offsetY) + " range: " + toStr(rangeX, rangeY) + toStr(condition, events)); } + + if( null != imageRowPitch ) { + imageRowPitch[0] = _imageRowPitch.get(0); + } + if( null != imageSlicePitch ) { + imageSlicePitch[0] = _imageSlicePitch.get(0); + } if(events != null) { events.createEvent(context); |