diff options
author | Michael Bien <[email protected]> | 2010-03-16 01:07:55 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-03-16 01:07:55 +0100 |
commit | 81b94f83cb76128c481d21134c3d462590db23d0 (patch) | |
tree | 3c6665bc97d07a06a780bfc655bda73d37657c1e /src/com/mbien/opencl/CLDevice.java | |
parent | 68b70f68f42a0fce94aea9c47981edc8de5dd1d1 (diff) |
added Capabilities enum and getter to CLDevice.
updated tests.
Diffstat (limited to 'src/com/mbien/opencl/CLDevice.java')
-rw-r--r-- | src/com/mbien/opencl/CLDevice.java | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/src/com/mbien/opencl/CLDevice.java b/src/com/mbien/opencl/CLDevice.java index a4a4b380..cae250c0 100644 --- a/src/com/mbien/opencl/CLDevice.java +++ b/src/com/mbien/opencl/CLDevice.java @@ -355,6 +355,13 @@ public final class CLDevice extends CLObject { } /** + * Returns the execution capabilities as EnumSet. + */ + public EnumSet<Capabilities> getExecutionCapabilities() { + return Capabilities.valuesOf((int)deviceInfo.getLong(CL_DEVICE_EXECUTION_CAPABILITIES)); + } + + /** * Returns the optional half precision floating-point capability of the device. * The required minimum half precision floating-point capabilities as implemented by this * extension are {@link FPConfig#ROUND_TO_ZERO}, {@link FPConfig#ROUND_TO_INF} @@ -432,7 +439,7 @@ public final class CLDevice extends CLObject { /** * Returns true if the OpenCL device is a little endian device and false otherwise. */ - public boolean isLittleEndianAvailable() { + public boolean isLittleEndian() { return deviceInfo.getLong(CL_DEVICE_ENDIAN_LITTLE) == CL_TRUE; } @@ -546,6 +553,55 @@ public final class CLDevice extends CLObject { } /** + * Enumeration for the execution capabilities of the device. + */ + public enum Capabilities { + + /** + * The OpenCL device can execute OpenCL kernels. + */ + EXEC_KERNEL(CL_EXEC_KERNEL), + + /** + * The OpenCL device can execute native kernels. + */ + EXEC_NATIVE_KERNEL(CL_EXEC_NATIVE_KERNEL); + + /** + * Value of wrapped OpenCL device type. + */ + public final int CAPS; + + private Capabilities(int type) { + this.CAPS = type; + } + + public static Capabilities valueOf(int caps) { + switch(caps) { + case(CL_EXEC_KERNEL): + return EXEC_KERNEL; + case(CL_EXEC_NATIVE_KERNEL): + return EXEC_NATIVE_KERNEL; + } + return null; + } + + public static EnumSet<Capabilities> valuesOf(int bitfield) { + if((EXEC_KERNEL.CAPS & bitfield) != 0) { + if((EXEC_NATIVE_KERNEL.CAPS & bitfield) != 0) { + return EnumSet.of(EXEC_KERNEL, EXEC_NATIVE_KERNEL); + }else{ + return EnumSet.of(EXEC_KERNEL); + } + }else if((EXEC_NATIVE_KERNEL.CAPS & bitfield) != 0){ + return EnumSet.of(EXEC_NATIVE_KERNEL); + } + return null; + } + + } + + /** * Enumeration for the type of a device. */ public enum Type { |