diff options
author | Michael Bien <[email protected]> | 2009-10-12 19:05:13 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2009-10-12 19:05:13 +0200 |
commit | 223e32b5ce6943abf7c1ac31f1b90d3679de5571 (patch) | |
tree | 435b04350e9be30a19077b94dce660000b975d74 /src | |
parent | 2b05a67d30bde1419c2b0f1b5b427d65b8415eb7 (diff) |
cleaned up test output, removed some internal hardcoded fields from CLDevice.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/mbien/opencl/CLContext.java | 13 | ||||
-rw-r--r-- | src/com/mbien/opencl/CLDevice.java | 18 | ||||
-rw-r--r-- | src/com/mbien/opencl/CLException.java | 5 |
3 files changed, 19 insertions, 17 deletions
diff --git a/src/com/mbien/opencl/CLContext.java b/src/com/mbien/opencl/CLContext.java index 533d45d4..bcfb09a0 100644 --- a/src/com/mbien/opencl/CLContext.java +++ b/src/com/mbien/opencl/CLContext.java @@ -1,8 +1,6 @@ package com.mbien.opencl; import com.mbien.opencl.impl.CLImpl; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; import java.nio.IntBuffer; /** @@ -48,8 +46,8 @@ public final class CLContext { type |= deviceTypes[i].CL_TYPE; } - long context = cl.clCreateContextFromType(null, 0, type, null, null, null, 0); - return new CLContext(context); + long ctxID = cl.clCreateContextFromType(null, 0, type, null, null, null, 0); + return new CLContext(ctxID); } /** @@ -124,4 +122,11 @@ public final class CLContext { return platforms; } + /** + * Returns the low level binding interface to the OpenCL APIs. + */ + public static CL getLowLevelBinding() { + return cl; + } + } diff --git a/src/com/mbien/opencl/CLDevice.java b/src/com/mbien/opencl/CLDevice.java index 3db2511f..ba20f4b2 100644 --- a/src/com/mbien/opencl/CLDevice.java +++ b/src/com/mbien/opencl/CLDevice.java @@ -13,8 +13,6 @@ import java.util.Set; */ public final class CLDevice { - //FIXME gluegen does not generate CL_DEVICE_TYPE_* remove hardcoded values ASAP - /** * Enumeration for the type of a device. */ @@ -22,19 +20,19 @@ public final class CLDevice { /** * CL_DEVICE_TYPE_CPU */ - CPU(1 << 1), + CPU(CL.CL_DEVICE_TYPE_CPU), /** * CL_DEVICE_TYPE_GPU */ - GPU(1 << 2), + GPU(CL.CL_DEVICE_TYPE_GPU), /** * CL_DEVICE_TYPE_ACCELERATOR */ - ACCELERATOR(1 << 3), + ACCELERATOR(CL.CL_DEVICE_TYPE_ACCELERATOR), /** * CL_DEVICE_TYPE_DEFAULT */ - DEFAULT(1 << 0); + DEFAULT(CL.CL_DEVICE_TYPE_DEFAULT); /** * Value of wrapped OpenCL device type. @@ -47,13 +45,13 @@ public final class CLDevice { public static Type valueOf(int clDeviceType) { switch(clDeviceType) { - case(1 << 0): + case(CL.CL_DEVICE_TYPE_DEFAULT): return DEFAULT; - case(1 << 1): + case(CL.CL_DEVICE_TYPE_CPU): return CPU; - case(1 << 2): + case(CL.CL_DEVICE_TYPE_GPU): return GPU; - case(1 << 3): + case(CL.CL_DEVICE_TYPE_ACCELERATOR): return ACCELERATOR; } return null; diff --git a/src/com/mbien/opencl/CLException.java b/src/com/mbien/opencl/CLException.java index c81dc039..e8ed771f 100644 --- a/src/com/mbien/opencl/CLException.java +++ b/src/com/mbien/opencl/CLException.java @@ -19,11 +19,10 @@ public class CLException extends RuntimeException { } public CLException(int error, String message) { - super(resolveError(error) + ": " + message); + super(identifyError(error) + ": " + message); } - - private static final String resolveError(int error) { + private static final String identifyError(int error) { switch (error) { case CL.CL_INVALID_VALUE: |