diff options
author | Michael Bien <[email protected]> | 2009-10-19 23:02:09 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2009-10-19 23:02:09 +0200 |
commit | 224985638b2a1486e4b7da1642a4f2cc22fc8644 (patch) | |
tree | 2540189dc43f6d6b67001cab1e7d1332ffa14dc3 /src/com/mbien/opencl/CLKernel.java | |
parent | cb7fa23952a10795215eda50848530828b92895e (diff) |
initial import of CLCommandQueue.
updated JUnit test to test CLCommandQueue.
cleand up project dependencies.
Diffstat (limited to 'src/com/mbien/opencl/CLKernel.java')
-rw-r--r-- | src/com/mbien/opencl/CLKernel.java | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/com/mbien/opencl/CLKernel.java b/src/com/mbien/opencl/CLKernel.java index be5e03b6..8f470719 100644 --- a/src/com/mbien/opencl/CLKernel.java +++ b/src/com/mbien/opencl/CLKernel.java @@ -11,25 +11,25 @@ import static com.mbien.opencl.CLException.*; */ public class CLKernel { - public final long kernelID; + public final long ID; public final String name; private final CLProgram program; private final CL cl; CLKernel(CLProgram program, long id) { - this.kernelID = id; + this.ID = id; this.program = program; this.cl = program.context.cl; long[] longArray = new long[1]; - int ret = cl.clGetKernelInfo(kernelID, CL.CL_KERNEL_FUNCTION_NAME, 0, null, longArray, 0); + int ret = cl.clGetKernelInfo(ID, CL.CL_KERNEL_FUNCTION_NAME, 0, null, longArray, 0); checkForError(ret, "error while asking for kernel function name"); ByteBuffer bb = ByteBuffer.allocate((int)longArray[0]).order(ByteOrder.nativeOrder()); - ret = cl.clGetKernelInfo(kernelID, CL.CL_KERNEL_FUNCTION_NAME, bb.capacity(), bb, null, 0); + ret = cl.clGetKernelInfo(ID, CL.CL_KERNEL_FUNCTION_NAME, bb.capacity(), bb, null, 0); checkForError(ret, "error while asking for kernel function name"); this.name = new String(bb.array(), 0, (int)longArray[0]).trim(); @@ -37,13 +37,13 @@ public class CLKernel { } public CLKernel setArg(int argumentIndex, int argumentSize, CLBuffer value) { - int ret = cl.clSetKernelArg(kernelID, argumentIndex, argumentSize, wrapLong(value.bufferID)); + int ret = cl.clSetKernelArg(ID, argumentIndex, argumentSize, wrapLong(value.ID)); checkForError(ret, "error on clSetKernelArg"); return this; } public CLKernel setArg(int argumentIndex, int argumentSize, long value) { - int ret = cl.clSetKernelArg(kernelID, argumentIndex, argumentSize, wrapLong(value)); + int ret = cl.clSetKernelArg(ID, argumentIndex, argumentSize, wrapLong(value)); checkForError(ret, "error on clSetKernelArg"); return this; } @@ -52,15 +52,14 @@ public class CLKernel { return (ByteBuffer) BufferFactory.newDirectByteBuffer(8).putLong(value).rewind(); } - public CLKernel release() { - cl.clReleaseKernel(kernelID); + public void release() { + cl.clReleaseKernel(ID); program.kernelReleased(this); - return this; } @Override public String toString() { - return "CLKernel [id: " + kernelID + return "CLKernel [id: " + ID + " name: " + name+"]"; } @@ -73,7 +72,7 @@ public class CLKernel { return false; } final CLKernel other = (CLKernel) obj; - if (this.kernelID != other.kernelID) { + if (this.ID != other.ID) { return false; } if (!this.program.equals(other.program)) { @@ -85,7 +84,7 @@ public class CLKernel { @Override public int hashCode() { int hash = 7; - hash = 43 * hash + (int) (this.kernelID ^ (this.kernelID >>> 32)); + hash = 43 * hash + (int) (this.ID ^ (this.ID >>> 32)); hash = 43 * hash + (this.program != null ? this.program.hashCode() : 0); return hash; } |