summaryrefslogtreecommitdiffstats
path: root/test/com
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-08-30 23:29:53 +0200
committerMichael Bien <[email protected]>2011-08-30 23:29:53 +0200
commitc967d61484154911245d213fe0820e2b2d2af549 (patch)
tree6dbf53190e74efe8f11a25dc1326004d7d707ba5 /test/com
parent4c8220faf4e0be3cd33e68e82412d103ab6457e9 (diff)
bugfix: [CLWork codepath] local WS must be null if all elements are 0. Using an empty buffer confuses the driver.
Diffstat (limited to 'test/com')
-rw-r--r--test/com/jogamp/opencl/CLProgramTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/com/jogamp/opencl/CLProgramTest.java b/test/com/jogamp/opencl/CLProgramTest.java
index 47eb42e0..cf7f45ff 100644
--- a/test/com/jogamp/opencl/CLProgramTest.java
+++ b/test/com/jogamp/opencl/CLProgramTest.java
@@ -436,7 +436,11 @@ public class CLProgramTest {
CLWork1D work = CLWork.create1D(program.createCLKernel("add"));
work.getKernel().setArgs(buffer, 5, buffer.getNIOCapacity());
+
+ //optimal values
work.setWorkSize(20, 1).optimizeFor(device);
+ assertEquals(work.workSize.get(0), 20);
+ assertNotSame(work.groupSize.get(0), 0);
queue.putWriteBuffer(buffer, false)
.putWork(work)
@@ -445,6 +449,21 @@ public class CLProgramTest {
while(buffer.getBuffer().hasRemaining()) {
assertEquals(5, buffer.getBuffer().get());
}
+ buffer.getBuffer().rewind();
+
+ // driver choice
+ work.setWorkSize(20);
+ assertEquals(work.workSize.get(0), 20);
+ assertEquals(work.groupSize.get(0), 0);
+
+ queue.putWriteBuffer(buffer, false)
+ .putWork(work)
+ .putReadBuffer(buffer, true);
+
+ while(buffer.getBuffer().hasRemaining()) {
+ assertEquals(10, buffer.getBuffer().get());
+ }
+ buffer.getBuffer().rewind();
}finally{
context.release();