From dfa367a91806f7a23df269708a95482c0a6c5090 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Thu, 21 Apr 2011 22:55:41 +0200 Subject: added a set of put3DRangeKernel utility methods. --- src/com/jogamp/opencl/CLCommandQueue.java | 64 +++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 11 deletions(-) (limited to 'src/com') diff --git a/src/com/jogamp/opencl/CLCommandQueue.java b/src/com/jogamp/opencl/CLCommandQueue.java index 67b07171..7c567013 100644 --- a/src/com/jogamp/opencl/CLCommandQueue.java +++ b/src/com/jogamp/opencl/CLCommandQueue.java @@ -1499,19 +1499,69 @@ public class CLCommandQueue extends CLObject implements CLResource { PointerBuffer globalWorkSize = null; PointerBuffer localWorkSize = null; - if(globalWorkOffsetX != 0 && globalWorkOffsetY != 0) { + if(globalWorkOffsetX != 0 || globalWorkOffsetY != 0) { globalWorkOffset = copy2NIO(ibA, globalWorkOffsetX, globalWorkOffsetY); } - if(globalWorkSizeX != 0 && globalWorkSizeY != 0) { + if(globalWorkSizeX != 0 || globalWorkSizeY != 0) { globalWorkSize = copy2NIO(ibB, globalWorkSizeX, globalWorkSizeY); } - if(localWorkSizeX != 0 && localWorkSizeY !=0) { + if(localWorkSizeX != 0 || localWorkSizeY != 0) { localWorkSize = copy2NIO(ibC, localWorkSizeX, localWorkSizeY); } this.putNDRangeKernel(kernel, 2, globalWorkOffset, globalWorkSize, localWorkSize, condition, events); return this; } + /** + * Calls {@native clEnqueueNDRangeKernel}. + */ + public CLCommandQueue put3DRangeKernel(CLKernel kernel, long globalWorkOffsetX, long globalWorkOffsetY, long globalWorkOffsetZ, + long globalWorkSizeX, long globalWorkSizeY, long globalWorkSizeZ, + long localWorkSizeX, long localWorkSizeY, long localWorkSizeZ) { + this.put3DRangeKernel(kernel, + globalWorkOffsetX, globalWorkOffsetY, globalWorkOffsetZ, + globalWorkSizeX, globalWorkSizeY, globalWorkSizeZ, + localWorkSizeX, localWorkSizeY, localWorkSizeZ, null, null); + + return this; + } + + /** + * Calls {@native clEnqueueNDRangeKernel}. + */ + public CLCommandQueue put3DRangeKernel(CLKernel kernel, long globalWorkOffsetX, long globalWorkOffsetY, long globalWorkOffsetZ, + long globalWorkSizeX, long globalWorkSizeY, long globalWorkSizeZ, + long localWorkSizeX, long localWorkSizeY, long localWorkSizeZ, CLEventList events) { + this.put3DRangeKernel(kernel, + globalWorkOffsetX, globalWorkOffsetY, globalWorkOffsetZ, + globalWorkSizeX, globalWorkSizeY, globalWorkSizeZ, + localWorkSizeX, localWorkSizeY, localWorkSizeZ, null, events); + return this; + } + + /** + * Calls {@native clEnqueueNDRangeKernel}. + */ + public CLCommandQueue put3DRangeKernel(CLKernel kernel, long globalWorkOffsetX, long globalWorkOffsetY, long globalWorkOffsetZ, + long globalWorkSizeX, long globalWorkSizeY, long globalWorkSizeZ, + long localWorkSizeX, long localWorkSizeY, long localWorkSizeZ, CLEventList condition, CLEventList events) { + PointerBuffer globalWorkOffset = null; + PointerBuffer globalWorkSize = null; + PointerBuffer localWorkSize = null; + + if(globalWorkOffsetX != 0 || globalWorkOffsetY != 0 || globalWorkOffsetZ != 0) { + globalWorkOffset = copy2NIO(ibA, globalWorkOffsetX, globalWorkOffsetY, globalWorkOffsetZ); + } + if(globalWorkSizeX != 0 || globalWorkSizeY != 0 || globalWorkSizeZ != 0) { + globalWorkSize = copy2NIO(ibB, globalWorkSizeX, globalWorkSizeY, globalWorkSizeZ); + } + if(localWorkSizeX != 0 || localWorkSizeY != 0 || localWorkSizeZ != 0) { + localWorkSize = copy2NIO(ibC, localWorkSizeX, localWorkSizeY, localWorkSizeZ); + } + this.putNDRangeKernel(kernel, 3, globalWorkOffset, globalWorkSize, localWorkSize, condition, events); + return this; + } + /** * Calls {@native clEnqueueNDRangeKernel}. */ @@ -1702,14 +1752,6 @@ public class CLCommandQueue extends CLObject implements CLResource { return buffer.put(2, a).position(2); } -// private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b) { -// return buffer.position(1).put(a).put(b).position(1); -// } -// -// private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b, long c) { -// return buffer.rewind().put(a).put(b).put(c).rewind(); -// } - private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b) { return buffer.position(1).put(a).put(b).position(1); } -- cgit v1.2.3