summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/util/concurrent/CLTask.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-07-11 19:36:33 +0200
committerMichael Bien <[email protected]>2011-07-11 19:36:33 +0200
commit6bd00879eec56c2753d84708f551557a2684904b (patch)
treeaf16bbc18053dade601f202b85c6efbb08f6a0a7 /src/com/jogamp/opencl/util/concurrent/CLTask.java
parent29deee58472b1c475955718db7b1246fbb1df9d6 (diff)
redesigned CLCommandQueuePool.
Diffstat (limited to 'src/com/jogamp/opencl/util/concurrent/CLTask.java')
-rw-r--r--src/com/jogamp/opencl/util/concurrent/CLTask.java23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/com/jogamp/opencl/util/concurrent/CLTask.java b/src/com/jogamp/opencl/util/concurrent/CLTask.java
index 0cfd24a5..04d433c8 100644
--- a/src/com/jogamp/opencl/util/concurrent/CLTask.java
+++ b/src/com/jogamp/opencl/util/concurrent/CLTask.java
@@ -3,16 +3,35 @@
*/
package com.jogamp.opencl.util.concurrent;
+import com.jogamp.opencl.CLCommandQueue;
+
/**
* A task executed on a command queue.
* @author Michael Bien
*/
-public interface CLTask<C extends CLQueueContext, R> {
+public abstract class CLTask<C extends CLQueueContext, R> {
+
+
+ /**
+ * Creates a CLQueueContext for this task. A context may contain static resources
+ * like OpenCL program binaries or pre allocated buffers. A context can be used by an group
+ * of tasks identified by a common context key ({@link #getContextKey()}). This method
+ * won't be called if a context was already created by an previously executed task with the
+ * same context key as this task.
+ */
+ public abstract C createQueueContext(CLCommandQueue queue);
+
+ /**
+ * Returns the context key for this task. Default implementation returns {@link #getClass()}.
+ */
+ public Object getContextKey() {
+ return getClass();
+ }
/**
* Runs the task on a queue and returns a result.
*/
- R execute(C context);
+ public abstract R execute(C context);
}