From c967d61484154911245d213fe0820e2b2d2af549 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Tue, 30 Aug 2011 23:29:53 +0200 Subject: bugfix: [CLWork codepath] local WS must be null if all elements are 0. Using an empty buffer confuses the driver. --- test/com/jogamp/opencl/CLProgramTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/com') 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(); -- cgit v1.2.3