aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/CLContext.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/jogamp/opencl/CLContext.java')
-rw-r--r--src/com/jogamp/opencl/CLContext.java21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java
index 7db6e4e5..837b2ebd 100644
--- a/src/com/jogamp/opencl/CLContext.java
+++ b/src/com/jogamp/opencl/CLContext.java
@@ -106,14 +106,6 @@ public class CLContext extends CLObject implements CLResource {
}
/**
- * Creates a context on the specified devices.
- * The platform to be used is implementation dependent.
- */
- public static CLContext create(CLDevice... devices) {
- return create(null, devices);
- }
-
- /**
* Creates a context on the specified platform on all available devices (CL_DEVICE_TYPE_ALL).
*/
public static CLContext create(CLPlatform platform) {
@@ -138,15 +130,18 @@ public class CLContext extends CLObject implements CLResource {
}
/**
- * Creates a context on the specified platform and with the specified
- * devices.
+ * Creates a context on the specified devices.
*/
- public static CLContext create(CLPlatform platform, CLDevice... devices) {
+ public static CLContext create(CLDevice... devices) {
- if(platform == null) {
- platform = CLPlatform.getDefault();
+ if(devices == null) {
+ throw new IllegalArgumentException("no devices specified");
+ }else if(devices[0] == null) {
+ throw new IllegalArgumentException("first device was null");
}
+ CLPlatform platform = devices[0].getPlatform();
+
PointerBuffer properties = setupContextProperties(platform);
ErrorDispatcher dispatcher = new ErrorDispatcher();
CLContext context = new CLContext(platform, createContext(dispatcher, properties, devices), dispatcher);