diff options
author | Michael Bien <[email protected]> | 2011-05-09 03:00:55 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2011-05-09 03:00:55 +0200 |
commit | c59bc50229181ab9cb0e5012d7bb5caf2faa781f (patch) | |
tree | 62230d2d14861c14814d6bfcc98b7ee2e7c170fc /src/com/jogamp/opencl/util/CLMultiContext.java | |
parent | dedded707fc70fda3e40cf963d208202f8d6c42b (diff) |
concurrent utils bugfixes and improvements.
- more utility methods
- generics fixes
- basic junit test for CLCommandQueuePool
- javadoc and argument validation
Diffstat (limited to 'src/com/jogamp/opencl/util/CLMultiContext.java')
-rw-r--r-- | src/com/jogamp/opencl/util/CLMultiContext.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/com/jogamp/opencl/util/CLMultiContext.java b/src/com/jogamp/opencl/util/CLMultiContext.java index f588fcef..f74c0a35 100644 --- a/src/com/jogamp/opencl/util/CLMultiContext.java +++ b/src/com/jogamp/opencl/util/CLMultiContext.java @@ -41,6 +41,13 @@ public class CLMultiContext implements CLResource { * Creates a multi context with all devices of the specified platforms and types. */ public static CLMultiContext create(CLPlatform[] platforms, CLDevice.Type... types) { + + if(platforms == null) { + throw new NullPointerException("platform list was null"); + }else if(platforms.length == 0) { + throw new IllegalArgumentException("platform list was empty"); + } + List<CLDevice> devices = new ArrayList<CLDevice>(); for (CLPlatform platform : platforms) { devices.addAll(asList(platform.listCLDevices(types))); @@ -54,6 +61,10 @@ public class CLMultiContext implements CLResource { */ public static CLMultiContext create(Collection<CLDevice> devices) { + if(devices.isEmpty()) { + throw new IllegalArgumentException("device list was empty"); + } + Map<CLPlatform, List<CLDevice>> platformDevicesMap = filterPlatformConflicts(devices); // create contexts |