diff options
author | Michael Bien <[email protected]> | 2010-01-08 00:11:55 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-01-08 00:11:55 +0100 |
commit | 286f94a7b148856666d7c05853ba9b2ba799b638 (patch) | |
tree | f7dc2acfaeb18d11979c58f3e40f5da923955da1 /src/com/mbien/opencl/CLBuffer.java | |
parent | 14d666509596e5b954a5c20e0be9f5826a3ce733 (diff) |
introduced CLSampler and CLEvent.
refactored code to use internal CLInfoAccessor utility where it makes sense.
static imports.
Diffstat (limited to 'src/com/mbien/opencl/CLBuffer.java')
-rw-r--r-- | src/com/mbien/opencl/CLBuffer.java | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/com/mbien/opencl/CLBuffer.java b/src/com/mbien/opencl/CLBuffer.java index f640ac1d..0a001f6b 100644 --- a/src/com/mbien/opencl/CLBuffer.java +++ b/src/com/mbien/opencl/CLBuffer.java @@ -7,7 +7,9 @@ import java.nio.DoubleBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; + import static com.mbien.opencl.CLException.*; +import static com.mbien.opencl.CL.*; /** * @@ -110,7 +112,7 @@ public class CLBuffer<B extends Buffer> implements CLResource { * This flag specifies that the memory object will be read and * written by a kernel. */ - READ_WRITE(CL.CL_MEM_READ_WRITE), + READ_WRITE(CL_MEM_READ_WRITE), /** * This flags specifies that the memory object will be written @@ -118,14 +120,14 @@ public class CLBuffer<B extends Buffer> implements CLResource { * Reading from a buffer or image object created with WRITE_ONLY * inside a kernel is undefined. */ - WRITE_ONLY(CL.CL_MEM_WRITE_ONLY), + WRITE_ONLY(CL_MEM_WRITE_ONLY), /** * This flag specifies that the memory object is a read-only memory * object when used inside a kernel. Writing to a buffer or image object * created withREAD_ONLY inside a kernel is undefined. */ - READ_ONLY(CL.CL_MEM_READ_ONLY); + READ_ONLY(CL_MEM_READ_ONLY); /** * If specified, it indicates that the application wants the OpenCL @@ -134,9 +136,9 @@ public class CLBuffer<B extends Buffer> implements CLResource { * to cache the buffer contents pointed to by host_ptr in device memory. * This cached copy can be used when kernels are executed on a device. */ -// USE_HOST_PTR(CL.CL_MEM_USE_HOST_PTR), +// USE_HOST_PTR(CL_MEM_USE_HOST_PTR), -// ALLOC_HOST_PTR(CL.CL_MEM_ALLOC_HOST_PTR), // this is the default in java world anyway +// ALLOC_HOST_PTR(CL_MEM_ALLOC_HOST_PTR), // this is the default in java world anyway /** * If CL_MEM_COPY_HOST_PTR specified, it indicates that the application @@ -144,28 +146,28 @@ public class CLBuffer<B extends Buffer> implements CLResource { * and copy the data from memory referenced by host_ptr.<br/> * COPY_HOST_PTR and USE_HOST_PTR are mutually exclusive. */ -// COPY_HOST_PTR(CL.CL_MEM_COPY_HOST_PTR); +// COPY_HOST_PTR(CL_MEM_COPY_HOST_PTR); /** * Value of wrapped OpenCL flag. */ - public final int CL_FLAG; + public final int CONFIG; - private Mem(int CL_FLAG) { - this.CL_FLAG = CL_FLAG; + private Mem(int config) { + this.CONFIG = config; } public static Mem valueOf(int bufferFlag) { switch(bufferFlag) { - case(CL.CL_MEM_READ_WRITE): + case(CL_MEM_READ_WRITE): return READ_WRITE; - case(CL.CL_MEM_READ_ONLY): + case(CL_MEM_READ_ONLY): return READ_ONLY; -// case(CL.CL_MEM_USE_HOST_PTR): +// case(CL_MEM_USE_HOST_PTR): // return USE_HOST_PTR; -// case(CL.CL_MEM_ALLOC_HOST_PTR): +// case(CL_MEM_ALLOC_HOST_PTR): // return ALLOC_HOST_PTR; -// case(CL.CL_MEM_COPY_HOST_PTR): +// case(CL_MEM_COPY_HOST_PTR): // return COPY_HOST_PTR; } return null; @@ -175,11 +177,11 @@ public class CLBuffer<B extends Buffer> implements CLResource { int clFlags = 0; if(flags != null) { for (int i = 0; i < flags.length; i++) { - clFlags |= flags[i].CL_FLAG; + clFlags |= flags[i].CONFIG; } } if(clFlags == 0) - clFlags = CL.CL_MEM_READ_WRITE; + clFlags = CL_MEM_READ_WRITE; return clFlags; } |