diff options
author | Michael Bien <[email protected]> | 2010-09-15 18:33:21 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-09-15 18:33:21 +0200 |
commit | 91938387529fe220323e0c7472f788c78e1ace72 (patch) | |
tree | ff843ed5b9c26359aa2319d21f2ef60b0dcd216b /src/com/jogamp/opencl/CLContext.java | |
parent | 39d98824e916487ae838e3ade8230a3193db1ee9 (diff) |
removed CLContext factory methods with CLPlatform + CLDevice list combinations.
justification:
- information is now no longer needed since every CLDevice knows its CLPlatform
- OpenCL device IDs are not portable between CLPlatforms
changes:
- Context factories will throw CLInvalidPlatformException if the platform of all CLDevices does not match
related changes:
- [persistance] CLProgramBuilder stores now the ICD suffix to be later able to map binaries back to the platform + device
Diffstat (limited to 'src/com/jogamp/opencl/CLContext.java')
-rw-r--r-- | src/com/jogamp/opencl/CLContext.java | 21 |
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); |