aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-04-04 19:04:29 +0200
committerMichael Bien <[email protected]>2011-04-04 19:04:29 +0200
commit6612391c7ad8309ebd315cdf2a91a71f11793a61 (patch)
tree02374fe2a54bdde53c46de193123d0626d3807a4 /src
parent38a1408b585fd3fe7b274708b531e98d73f1ac0c (diff)
fixed a bug which used a wrong eventlist offset under certain conditions and added a regression test.
Diffstat (limited to 'src')
-rw-r--r--src/com/jogamp/opencl/CLCommandQueue.java63
-rw-r--r--src/com/jogamp/opencl/CLEventList.java12
2 files changed, 43 insertions, 32 deletions
diff --git a/src/com/jogamp/opencl/CLCommandQueue.java b/src/com/jogamp/opencl/CLCommandQueue.java
index d24fb115..2c64b1f7 100644
--- a/src/com/jogamp/opencl/CLCommandQueue.java
+++ b/src/com/jogamp/opencl/CLCommandQueue.java
@@ -118,7 +118,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -162,7 +162,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -211,7 +211,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -281,7 +281,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -359,7 +359,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -440,7 +440,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -508,7 +508,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -570,7 +570,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -631,7 +631,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -693,7 +693,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -757,7 +757,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -826,7 +826,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -890,7 +890,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -957,7 +957,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -1021,7 +1021,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -1088,7 +1088,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -1146,7 +1146,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -1206,7 +1206,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -1272,7 +1272,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -1316,7 +1316,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -1348,11 +1348,11 @@ public class CLCommandQueue extends CLObject implements CLResource {
* Calls {@native clWaitForEvents} if blockingWait equals true otherwise {@native clEnqueueWaitForEvents}.
*/
public CLCommandQueue putWaitForEvent(CLEventList list, int index, boolean blockingWait) {
- int marker = list.IDs.position()-1;
- list.IDs.position(index);
- int ret = blockingWait ? cl.clWaitForEvents(1, list.IDs)
- : cl.clEnqueueWaitForEvents(ID, 1, list.IDs);
- list.IDs.position(marker);
+
+ PointerBuffer ids = PointerBuffer.wrap(list.IDs.getBuffer()).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);
}
@@ -1363,9 +1363,8 @@ public class CLCommandQueue extends CLObject implements CLResource {
* Calls {@native clWaitForEvents} if blockingWait equals true otherwise {@native clEnqueueWaitForEvents}.
*/
public CLCommandQueue putWaitForEvents(CLEventList list, boolean blockingWait) {
- list.IDs.rewind();
- int ret = blockingWait ? cl.clWaitForEvents(list.size, list.IDs)
- : cl.clEnqueueWaitForEvents(ID, list.size, list.IDs);
+ 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);
}
@@ -1410,7 +1409,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -1537,7 +1536,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -1588,7 +1587,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
@@ -1635,7 +1634,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
PointerBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
- conditionIDs = condition.IDs;
+ conditionIDs = condition.IDsView;
conditions = condition.size;
}
diff --git a/src/com/jogamp/opencl/CLEventList.java b/src/com/jogamp/opencl/CLEventList.java
index 03a6f838..f2b98adf 100644
--- a/src/com/jogamp/opencl/CLEventList.java
+++ b/src/com/jogamp/opencl/CLEventList.java
@@ -40,17 +40,29 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL
private final CLEvent[] events;
+ /**
+ * stores event ids for fast access.
+ */
final PointerBuffer IDs;
+
+ /**
+ * Points always to the first element of the id buffer.
+ */
+ final PointerBuffer IDsView;
+
int size;
public CLEventList(int capacity) {
this.events = new CLEvent[capacity];
this.IDs = PointerBuffer.allocateDirect(capacity);
+ this.IDsView = PointerBuffer.wrap(IDs.getBuffer());
}
public CLEventList(CLEvent... events) {
this.events = events;
this.IDs = PointerBuffer.allocateDirect(events.length);
+ this.IDsView = PointerBuffer.wrap(IDs.getBuffer());
+
for (CLEvent event : events) {
IDs.put(event.ID);
}