summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/CLCommandQueue.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-06-13 18:55:41 +0200
committerMichael Bien <[email protected]>2011-06-13 18:55:41 +0200
commit062973e4de89c876f3673d523bb8010822f47564 (patch)
tree6fcde6f4d1c047416c699ead8bc28c3e16d43890 /src/com/jogamp/opencl/CLCommandQueue.java
parentc06bdd44da347a55d69cc764ecbe698e80db99be (diff)
added blocking waitForEvents() methods to CLEventList.
Diffstat (limited to 'src/com/jogamp/opencl/CLCommandQueue.java')
-rw-r--r--src/com/jogamp/opencl/CLCommandQueue.java26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/com/jogamp/opencl/CLCommandQueue.java b/src/com/jogamp/opencl/CLCommandQueue.java
index 2f83464f..b97466d4 100644
--- a/src/com/jogamp/opencl/CLCommandQueue.java
+++ b/src/com/jogamp/opencl/CLCommandQueue.java
@@ -1351,13 +1351,16 @@ public class CLCommandQueue extends CLObject implements CLResource {
*/
public CLCommandQueue putWaitForEvent(CLEventList list, int index, boolean blockingWait) {
- NativeSizeBuffer ids = NativeSizeBuffer.wrap(list.IDs.getBuffer().duplicate()).position(index);
-
- int ret = blockingWait ? cl.clWaitForEvents(1, ids)
- : cl.clEnqueueWaitForEvents(ID, 1, ids);
- if(ret != CL_SUCCESS) {
- throw newException(ret, "can not "+ (blockingWait?"blocking": "") +" wait for event #" + index+ " in "+list);
+ if(blockingWait) {
+ list.waitForEvent(index);
+ }else{
+ NativeSizeBuffer ids = list.getEventBuffer(index);
+ int ret = cl.clEnqueueWaitForEvents(ID, 1, ids);
+ if(ret != CL_SUCCESS) {
+ throw newException(ret, "can not "+ (blockingWait?"blocking": "") +" wait for event #" + index+ " in "+list);
+ }
}
+
return this;
}
@@ -1365,10 +1368,13 @@ public class CLCommandQueue extends CLObject implements CLResource {
* Calls {@native clWaitForEvents} if blockingWait equals true otherwise {@native clEnqueueWaitForEvents}.
*/
public CLCommandQueue putWaitForEvents(CLEventList list, boolean blockingWait) {
- int ret = blockingWait ? cl.clWaitForEvents(list.size, list.IDsView)
- : cl.clEnqueueWaitForEvents(ID, list.size, list.IDsView);
- if(ret != CL_SUCCESS) {
- throw newException(ret, "can not "+ (blockingWait?"blocking": "") +" wait for events " + list);
+ if(blockingWait) {
+ list.waitForEvents();
+ }else{
+ int ret = cl.clEnqueueWaitForEvents(ID, list.size, list.IDsView);
+ if(ret != CL_SUCCESS) {
+ throw newException(ret, "can not "+ (blockingWait?"blocking": "") +" wait for events " + list);
+ }
}
return this;
}