From 91938387529fe220323e0c7472f788c78e1ace72 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Wed, 15 Sep 2010 18:33:21 +0200 Subject: 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 --- src/com/jogamp/opencl/CLContext.java | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/com/jogamp/opencl/CLContext.java') 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 @@ -105,14 +105,6 @@ public class CLContext extends CLObject implements CLResource { return create(null, deviceTypes); } - /** - * 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). */ @@ -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); -- cgit v1.2.3