summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/jogamp/opencl/AutoCloseable.jtemplate2
-rw-r--r--src/com/jogamp/opencl/CLEventList.java2
-rw-r--r--src/com/jogamp/opencl/CLPlatform.java5
-rw-r--r--src/com/jogamp/opencl/util/CLMultiContext.java2
-rw-r--r--src/com/jogamp/opencl/util/JOCLVersion.java1
-rw-r--r--src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java15
-rw-r--r--test/com/jogamp/opencl/CLBufferTest.java3
-rw-r--r--test/com/jogamp/opencl/CLCommandQueueTest.java1
-rw-r--r--test/com/jogamp/opencl/HighLevelBindingTest.java2
-rw-r--r--test/com/jogamp/opencl/gl/CLGLTest.java4
10 files changed, 29 insertions, 8 deletions
diff --git a/src/com/jogamp/opencl/AutoCloseable.jtemplate b/src/com/jogamp/opencl/AutoCloseable.jtemplate
index d9f4f57a..a7bd1459 100644
--- a/src/com/jogamp/opencl/AutoCloseable.jtemplate
+++ b/src/com/jogamp/opencl/AutoCloseable.jtemplate
@@ -32,5 +32,5 @@ package com.jogamp.opencl;
* import of JDK7's ARM interface allowing JDK6 backwards compatibility.
*/
public interface AutoCloseable /*extends java.lang.AutoCloseable*/ {
- void close() throws Exception;
+ void close();
}
diff --git a/src/com/jogamp/opencl/CLEventList.java b/src/com/jogamp/opencl/CLEventList.java
index 56181cfa..cae3a03c 100644
--- a/src/com/jogamp/opencl/CLEventList.java
+++ b/src/com/jogamp/opencl/CLEventList.java
@@ -151,7 +151,7 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL
*/
@Deprecated
@Override
- public final void close() throws Exception {
+ public final void close() {
release();
}
diff --git a/src/com/jogamp/opencl/CLPlatform.java b/src/com/jogamp/opencl/CLPlatform.java
index 4015dc26..b7b7389c 100644
--- a/src/com/jogamp/opencl/CLPlatform.java
+++ b/src/com/jogamp/opencl/CLPlatform.java
@@ -187,6 +187,7 @@ public class CLPlatform {
/**
* Returns the default OpenCL platform or null when no platform found.
*/
+ @SuppressWarnings("unchecked")
public static CLPlatform getDefault(Filter<CLPlatform>... filter) {
CLPlatform[] platforms = listCLPlatforms(filter);
if(platforms.length > 0) {
@@ -219,6 +220,7 @@ public class CLPlatform {
* @param filter Acceptance filter for the returned platforms.
* @throws CLException if something went wrong initializing OpenCL
*/
+ @SuppressWarnings("unchecked")
public static CLPlatform[] listCLPlatforms(Filter<CLPlatform>... filter) {
initialize();
@@ -294,6 +296,7 @@ public class CLPlatform {
/**
* Lists all physical devices available on this platform matching the given {@link Filter}.
*/
+ @SuppressWarnings("unchecked")
public CLDevice[] listCLDevices(Filter<CLDevice>... filters) {
initialize();
@@ -389,6 +392,7 @@ public class CLPlatform {
* The device speed is estimated by calculating the product of
* MAX_COMPUTE_UNITS and MAX_CLOCK_FREQUENCY.
*/
+ @SuppressWarnings("unchecked")
public CLDevice getMaxFlopsDevice(Filter<CLDevice>... filter) {
return findMaxFlopsDevice(listCLDevices(filter));
}
@@ -475,6 +479,7 @@ public class CLPlatform {
while(scanner.hasNext())
extensions.add(scanner.next());
+ scanner.close();
extensions = Collections.unmodifiableSet(extensions);
}
diff --git a/src/com/jogamp/opencl/util/CLMultiContext.java b/src/com/jogamp/opencl/util/CLMultiContext.java
index 156a9fa6..c5bed86b 100644
--- a/src/com/jogamp/opencl/util/CLMultiContext.java
+++ b/src/com/jogamp/opencl/util/CLMultiContext.java
@@ -41,6 +41,7 @@ public class CLMultiContext implements CLResource {
/**
* Creates a multi context with all devices of the specified platforms and types.
*/
+ @SuppressWarnings("unchecked")
public static CLMultiContext create(CLPlatform[] platforms, CLDevice.Type... types) {
return create(platforms, CLDeviceFilters.type(types));
}
@@ -48,6 +49,7 @@ public class CLMultiContext implements CLResource {
/**
* Creates a multi context with all matching devices of the specified platforms.
*/
+ @SuppressWarnings("unchecked")
public static CLMultiContext create(CLPlatform[] platforms, Filter<CLDevice>... filters) {
if(platforms == null) {
diff --git a/src/com/jogamp/opencl/util/JOCLVersion.java b/src/com/jogamp/opencl/util/JOCLVersion.java
index 7ffa3eb6..7b837486 100644
--- a/src/com/jogamp/opencl/util/JOCLVersion.java
+++ b/src/com/jogamp/opencl/util/JOCLVersion.java
@@ -48,6 +48,7 @@ import static com.jogamp.common.util.VersionUtil.*;
* @author Michael Bien
* @deprecated Use {@link com.jogamp.opencl.JoclVersion}
*/
+@Deprecated
public class JOCLVersion extends JogampVersion {
private static final String PACKAGE = "com.jogamp.opencl";
diff --git a/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java b/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java
index e8bd0124..a1d376ab 100644
--- a/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java
+++ b/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java
@@ -31,12 +31,12 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
private FinishAction finishAction = FinishAction.DO_NOTHING;
private boolean released;
- private CLCommandQueuePool(CLQueueContextFactory factory, Collection<CLCommandQueue> queues) {
+ private CLCommandQueuePool(CLQueueContextFactory<C> factory, Collection<CLCommandQueue> queues) {
this.contexts = initContexts(queues, factory);
initExecutor();
}
- private List<CLQueueContext> initContexts(Collection<CLCommandQueue> queues, CLQueueContextFactory factory) {
+ private List<CLQueueContext> initContexts(Collection<CLCommandQueue> queues, CLQueueContextFactory<C> factory) {
List<CLQueueContext> newContexts = new ArrayList<CLQueueContext>(queues.size());
int index = 0;
@@ -69,8 +69,8 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
return create(factory, queues);
}
- public static <C extends CLQueueContext> CLCommandQueuePool create(CLQueueContextFactory<C> factory, Collection<CLCommandQueue> queues) {
- return new CLCommandQueuePool(factory, queues);
+ public static <C extends CLQueueContext> CLCommandQueuePool<C> create(CLQueueContextFactory<C> factory, Collection<CLCommandQueue> queues) {
+ return new CLCommandQueuePool<C>(factory, queues);
}
/**
@@ -78,7 +78,7 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
* @see ExecutorService#submit(java.util.concurrent.Callable)
*/
public <R> Future<R> submit(CLTask<? super C, R> task) {
- return excecutor.submit(new TaskWrapper(task, finishAction));
+ return excecutor.submit(new TaskWrapper<C,R>(task, finishAction));
}
/**
@@ -127,7 +127,7 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
* Blocks until all tasks finish and sets up a new context for all queues.
* @return this
*/
- public <C extends CLQueueContext> CLCommandQueuePool switchContext(CLQueueContextFactory<C> factory) {
+ public CLCommandQueuePool<C> switchContext(CLQueueContextFactory<C> factory) {
excecutor.shutdown();
finishQueues(); // just to be sure
@@ -255,6 +255,9 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
public R call() throws Exception {
CLQueueContext context = ((QueueThread)Thread.currentThread()).context;
+ // we make sure to only wrap tasks on the correct kind of thread, so this
+ // shouldn't fail (trying to genericize QueueThread properly becomes tricky)
+ @SuppressWarnings("unchecked")
R result = task.execute((C)context);
if(mode.equals(FinishAction.FLUSH)) {
context.queue.flush();
diff --git a/test/com/jogamp/opencl/CLBufferTest.java b/test/com/jogamp/opencl/CLBufferTest.java
index 932266f6..635af4fc 100644
--- a/test/com/jogamp/opencl/CLBufferTest.java
+++ b/test/com/jogamp/opencl/CLBufferTest.java
@@ -263,6 +263,7 @@ public class CLBufferTest extends UITestCase {
if(MiscUtils.isOpenCLUnavailable())
return;
+ @SuppressWarnings("unchecked")
CLPlatform platform = CLPlatform.getDefault(version(CL_1_1));
if(platform == null) {
out.println("aborting subBufferTest");
@@ -309,6 +310,7 @@ public class CLBufferTest extends UITestCase {
if(MiscUtils.isOpenCLUnavailable())
return;
+ @SuppressWarnings("unchecked")
CLPlatform platform = CLPlatform.getDefault(version(CL_1_1));
if(platform == null) {
out.println("aborting subBufferTest");
@@ -359,6 +361,7 @@ public class CLBufferTest extends UITestCase {
if(MiscUtils.isOpenCLUnavailable())
return;
+ @SuppressWarnings("unchecked")
CLPlatform platform = CLPlatform.getDefault(version(CL_1_1));
if(platform == null) {
out.println("aborting destructorCallbackTest");
diff --git a/test/com/jogamp/opencl/CLCommandQueueTest.java b/test/com/jogamp/opencl/CLCommandQueueTest.java
index 491eab53..3fc17e85 100644
--- a/test/com/jogamp/opencl/CLCommandQueueTest.java
+++ b/test/com/jogamp/opencl/CLCommandQueueTest.java
@@ -170,6 +170,7 @@ public class CLCommandQueueTest extends UITestCase {
}
}
+ @SuppressWarnings("unchecked")
@Test
public void eventConditionsTest() throws IOException {
diff --git a/test/com/jogamp/opencl/HighLevelBindingTest.java b/test/com/jogamp/opencl/HighLevelBindingTest.java
index a0a67595..9fa9f921 100644
--- a/test/com/jogamp/opencl/HighLevelBindingTest.java
+++ b/test/com/jogamp/opencl/HighLevelBindingTest.java
@@ -212,7 +212,9 @@ public class HighLevelBindingTest extends UITestCase {
if(MiscUtils.isOpenCLUnavailable())
return;
+ @SuppressWarnings("unchecked")
CLPlatform platformGPU = CLPlatform.getDefault(version(CL_1_0), type(GPU));
+ @SuppressWarnings("unchecked")
CLPlatform platformCPU = CLPlatform.getDefault(version(CL_1_0), type(CPU));
if(platformGPU != null) {
diff --git a/test/com/jogamp/opencl/gl/CLGLTest.java b/test/com/jogamp/opencl/gl/CLGLTest.java
index 52f0e574..b5d85690 100644
--- a/test/com/jogamp/opencl/gl/CLGLTest.java
+++ b/test/com/jogamp/opencl/gl/CLGLTest.java
@@ -113,7 +113,9 @@ public class CLGLTest extends UITestCase {
initGL();
+ @SuppressWarnings("unchecked")
CLPlatform platform = CLPlatform.getDefault(CLPlatformFilters.glSharing());
+ @SuppressWarnings("unchecked")
CLDevice device = platform.getMaxFlopsDevice(CLDeviceFilters.glSharing());
if(device == null) {
@@ -159,12 +161,14 @@ public class CLGLTest extends UITestCase {
makeGLCurrent();
assertTrue(glcontext.isCurrent());
+ @SuppressWarnings("unchecked")
CLPlatform platform = CLPlatform.getDefault(glSharing(glcontext));
if(platform == null) {
out.println("test aborted");
return;
}
+ @SuppressWarnings("unchecked")
CLDevice theChosenOne = platform.getMaxFlopsDevice(CLDeviceFilters.glSharing());
out.println(theChosenOne);