diff options
author | Michael Bien <[email protected]> | 2011-04-04 18:56:26 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2011-04-04 18:56:26 +0200 |
commit | 38a1408b585fd3fe7b274708b531e98d73f1ac0c (patch) | |
tree | 42cf20267997917d4f016aeed619b8ff0c7b9297 /src/com/jogamp/opencl/util | |
parent | 612fd3e9e9c157cc28d42791fd04711701def6e3 (diff) |
added queueMode to filter utilities.
Diffstat (limited to 'src/com/jogamp/opencl/util')
-rw-r--r-- | src/com/jogamp/opencl/util/CLDeviceFilters.java | 12 | ||||
-rw-r--r-- | src/com/jogamp/opencl/util/CLPlatformFilters.java | 19 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/com/jogamp/opencl/util/CLDeviceFilters.java b/src/com/jogamp/opencl/util/CLDeviceFilters.java index a69b11a1..a2ba0475 100644 --- a/src/com/jogamp/opencl/util/CLDeviceFilters.java +++ b/src/com/jogamp/opencl/util/CLDeviceFilters.java @@ -28,6 +28,7 @@ package com.jogamp.opencl.util; +import com.jogamp.opencl.CLCommandQueue.Mode; import com.jogamp.opencl.CLDevice; import java.nio.ByteOrder; import java.util.Arrays; @@ -87,4 +88,15 @@ public class CLDeviceFilters { }; } + /** + * Accepts all devices supporting the specified command queue modes. + */ + public static Filter<CLDevice> queueMode(final Mode... modes) { + return new Filter<CLDevice>() { + public boolean accept(CLDevice item) { + return item.getQueueProperties().containsAll(Arrays.asList(modes)); + } + }; + } + } diff --git a/src/com/jogamp/opencl/util/CLPlatformFilters.java b/src/com/jogamp/opencl/util/CLPlatformFilters.java index f5a4f55f..dab7448f 100644 --- a/src/com/jogamp/opencl/util/CLPlatformFilters.java +++ b/src/com/jogamp/opencl/util/CLPlatformFilters.java @@ -28,10 +28,12 @@ package com.jogamp.opencl.util; +import com.jogamp.opencl.CLCommandQueue.Mode; import com.jogamp.opencl.CLDevice; import com.jogamp.opencl.CLPlatform; import com.jogamp.opencl.CLVersion; import java.util.Arrays; +import java.util.List; /** * Pre-defined filters. @@ -90,4 +92,21 @@ public class CLPlatformFilters { } }; } + + /** + * Accepts all platforms containing at least one devices supporting the specified command queue modes. + */ + public static Filter<CLPlatform> queueMode(final Mode... modes) { + return new Filter<CLPlatform>() { + public boolean accept(CLPlatform item) { + List<Mode> modesList = Arrays.asList(modes); + for (CLDevice device : item.listCLDevices()) { + if(device.getQueueProperties().containsAll(modesList)) { + return true; + } + } + return false; + } + }; + } } |