diff options
Diffstat (limited to 'src/com/mbien/opencl')
-rw-r--r-- | src/com/mbien/opencl/CLContext.java | 17 | ||||
-rw-r--r-- | src/com/mbien/opencl/CLException.java | 6 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/com/mbien/opencl/CLContext.java b/src/com/mbien/opencl/CLContext.java index c87f2310..2a4bd7d0 100644 --- a/src/com/mbien/opencl/CLContext.java +++ b/src/com/mbien/opencl/CLContext.java @@ -11,6 +11,7 @@ import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; +import java.nio.LongBuffer; import java.util.ArrayList; import java.util.Collections; @@ -111,10 +112,10 @@ public final class CLContext { } } - IntBuffer properties = null; + LongBuffer properties = null; if(platform != null) { - properties = IntBuffer.allocate(3); - properties.put(CL.CL_CONTEXT_PLATFORM).put((int)platform.ID).put(0); // TODO check if this has to be int or long + properties = LongBuffer.allocate(3); + properties.put(CL.CL_CONTEXT_PLATFORM).put(platform.ID).put(0); // 0 terminated array properties.rewind(); } @@ -133,17 +134,17 @@ public final class CLContext { deviceIDs[i] = devices[i].ID; } - IntBuffer properties = null; + LongBuffer properties = null; if(platform != null) { - properties = IntBuffer.allocate(3); - properties.put(CL.CL_CONTEXT_PLATFORM).put((int)platform.ID).put(0); // TODO check if this has to be int or long + properties = LongBuffer.allocate(3); + properties.put(CL.CL_CONTEXT_PLATFORM).put(platform.ID).put(0); // 0 terminated array properties.rewind(); } return createContext(properties, deviceIDs); } - private static final CLContext createContextFromType(IntBuffer properties, long deviceType) { + private static final CLContext createContextFromType(LongBuffer properties, long deviceType) { IntBuffer status = IntBuffer.allocate(1); long context = CLPlatform.getLowLevelBinding().clCreateContextFromType(properties, deviceType, null, null, status); @@ -153,7 +154,7 @@ public final class CLContext { return new CLContext(context); } - private static final CLContext createContext(IntBuffer properties, long[] devices) { + private static final CLContext createContext(LongBuffer properties, long[] devices) { IntBuffer status = IntBuffer.allocate(1); long context = CLPlatform.getLowLevelBinding().clCreateContext(properties, devices, null, null, status); diff --git a/src/com/mbien/opencl/CLException.java b/src/com/mbien/opencl/CLException.java index b4a66a9f..c080b164 100644 --- a/src/com/mbien/opencl/CLException.java +++ b/src/com/mbien/opencl/CLException.java @@ -167,7 +167,11 @@ public class CLException extends RuntimeException { return "CL_INVALID_MIP_LEVEL"; case CL.CL_INVALID_GLOBAL_WORK_SIZE: - return "CL_INVALID_GLOBAL_WORK_SIZE"; + return "CL_INVALID_GLOBAL_WORK_SIZE or CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR"; + +// error-code conflict with CL_INVALID_GLOBAL_WORK_SIZE +// case CL.CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR: +// return "CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR"; default: return "unknown cause: error " + error; |