summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-04-04 18:56:26 +0200
committerMichael Bien <[email protected]>2011-04-04 18:56:26 +0200
commit38a1408b585fd3fe7b274708b531e98d73f1ac0c (patch)
tree42cf20267997917d4f016aeed619b8ff0c7b9297
parent612fd3e9e9c157cc28d42791fd04711701def6e3 (diff)
added queueMode to filter utilities.
-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;
+ }
+ };
+ }
}