summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/jogamp/opencl/util/CLDeviceFilters.java12
-rw-r--r--src/com/jogamp/opencl/util/CLPlatformFilters.java19
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;
+ }
+ };
+ }
}