diff options
author | Michael Bien <[email protected]> | 2009-10-22 01:26:53 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2009-10-22 01:26:53 +0200 |
commit | b3881a0924ecbe17cf27cededeae8df40b2d6933 (patch) | |
tree | a2ae7930eca5d771ab89fddd1a9e62802b6ffac9 /src/com/mbien/opencl/CLCommandQueue.java | |
parent | fe1e2739bf7596bc488de977166603edd18c41fb (diff) |
api cleanup and refactoring.
Diffstat (limited to 'src/com/mbien/opencl/CLCommandQueue.java')
-rw-r--r-- | src/com/mbien/opencl/CLCommandQueue.java | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/src/com/mbien/opencl/CLCommandQueue.java b/src/com/mbien/opencl/CLCommandQueue.java index 7d1d09f9..5abc5cd5 100644 --- a/src/com/mbien/opencl/CLCommandQueue.java +++ b/src/com/mbien/opencl/CLCommandQueue.java @@ -123,10 +123,13 @@ public class CLCommandQueue { } */ -// public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, long globalWorkOffset, long globalWorkSize, long localWorkSize) { -// return this.putNDRangeKernel(kernel, workDimension, -// new long[] {globalWorkOffset}, new long[] {globalWorkSize}, new long[] {localWorkSize}); -// } + public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, long globalWorkOffset, long globalWorkSize, long localWorkSize) { + return this.putNDRangeKernel( + kernel, workDimension, + globalWorkOffset==0 ? null : new long[] {globalWorkOffset}, + globalWorkSize ==0 ? null : new long[] {globalWorkSize }, + localWorkSize ==0 ? null : new long[] {localWorkSize } ); + } public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, long[] globalWorkOffset, long[] globalWorkSize, long[] localWorkSize) { @@ -145,11 +148,47 @@ public class CLCommandQueue { return this; } + public CLCommandQueue finish() { + int ret = cl.clFinish(ID); + checkForError(ret, "can not finish command queue"); + return this; + } + public void release() { int ret = cl.clReleaseCommandQueue(ID); - context.commandQueueReleased(device, this); + context.onCommandQueueReleased(device, this); checkForError(ret, "can not release command queue"); } + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CLCommandQueue other = (CLCommandQueue) obj; + if (this.ID != other.ID) { + return false; + } + if (this.context != other.context && (this.context == null || !this.context.equals(other.context))) { + return false; + } + if (this.device != other.device && (this.device == null || !this.device.equals(other.device))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 89 * hash + (int) (this.ID ^ (this.ID >>> 32)); + hash = 89 * hash + (this.context != null ? this.context.hashCode() : 0); + hash = 89 * hash + (this.device != null ? this.device.hashCode() : 0); + return hash; + } + } |