summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/jogamp/opencl/CLPlatform.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/jogamp/opencl/CLPlatform.java b/src/com/jogamp/opencl/CLPlatform.java
index 70b27a0a..802a6e9c 100644
--- a/src/com/jogamp/opencl/CLPlatform.java
+++ b/src/com/jogamp/opencl/CLPlatform.java
@@ -113,9 +113,13 @@ public final class CLPlatform {
*/
public static CLPlatform getDefault() {
CLPlatform[] platforms = listCLPlatforms();
- if(platforms.length > 0)
- return platforms[0];
- return null;
+ CLPlatform best = platforms[0];
+ for (CLPlatform platform : platforms) {
+ if(platform.version.compareTo(best.version) > 0) {
+ best = platform;
+ }
+ }
+ return best;
}
/**