diff options
author | Michael Bien <[email protected]> | 2011-06-29 00:27:49 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2011-06-29 00:27:49 +0200 |
commit | c3532027b08d16dd32066fb2ef4440f04b61ec26 (patch) | |
tree | 2182e6399209b2ea8d3fb53abecef69639c2e964 | |
parent | 2a4c30c9f0a479be370a3269aec7aa9b71939ddc (diff) |
added factory method (Collection<CLPlatform> ...)
-rw-r--r-- | src/com/jogamp/opencl/util/CLMultiContext.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/com/jogamp/opencl/util/CLMultiContext.java b/src/com/jogamp/opencl/util/CLMultiContext.java index 156a9fa6..8d021ae3 100644 --- a/src/com/jogamp/opencl/util/CLMultiContext.java +++ b/src/com/jogamp/opencl/util/CLMultiContext.java @@ -8,6 +8,7 @@ import com.jogamp.opencl.CLDevice; import com.jogamp.opencl.CLPlatform; import com.jogamp.opencl.CLResource; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -35,24 +36,24 @@ public class CLMultiContext implements CLResource { * Creates a multi context with all devices of the specified platforms. */ public static CLMultiContext create(CLPlatform... platforms) { - return create(platforms, ALL); + return create(platforms, CLDeviceFilters.type(ALL)); } /** - * Creates a multi context with all devices of the specified platforms and types. + * Creates a multi context with all matching devices of the specified platforms. */ - public static CLMultiContext create(CLPlatform[] platforms, CLDevice.Type... types) { - return create(platforms, CLDeviceFilters.type(types)); + public static CLMultiContext create(CLPlatform[] platforms, Filter<CLDevice>... filters) { + return create(Arrays.asList(platforms), filters); } /** * Creates a multi context with all matching devices of the specified platforms. */ - public static CLMultiContext create(CLPlatform[] platforms, Filter<CLDevice>... filters) { + public static CLMultiContext create(Collection<CLPlatform> platforms, Filter<CLDevice>... filters) { if(platforms == null) { throw new NullPointerException("platform list was null"); - }else if(platforms.length == 0) { + }else if(platforms.isEmpty()) { throw new IllegalArgumentException("platform list was empty"); } @@ -160,6 +161,7 @@ public class CLMultiContext implements CLResource { return devices; } + @Override public boolean isReleased() { return released; } |