From 38a1408b585fd3fe7b274708b531e98d73f1ac0c Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 4 Apr 2011 18:56:26 +0200 Subject: added queueMode to filter utilities. --- src/com/jogamp/opencl/util/CLDeviceFilters.java | 12 ++++++++++++ src/com/jogamp/opencl/util/CLPlatformFilters.java | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) (limited to 'src') 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 queueMode(final Mode... modes) { + return new Filter() { + 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 queueMode(final Mode... modes) { + return new Filter() { + public boolean accept(CLPlatform item) { + List modesList = Arrays.asList(modes); + for (CLDevice device : item.listCLDevices()) { + if(device.getQueueProperties().containsAll(modesList)) { + return true; + } + } + return false; + } + }; + } } -- cgit v1.2.3