aboutsummaryrefslogtreecommitdiffstats
path: root/test/com
diff options
context:
space:
mode:
Diffstat (limited to 'test/com')
-rw-r--r--test/com/jogamp/opencl/CLProgramTest.java40
-rw-r--r--test/com/jogamp/opencl/HighLevelBindingTest.java10
2 files changed, 34 insertions, 16 deletions
diff --git a/test/com/jogamp/opencl/CLProgramTest.java b/test/com/jogamp/opencl/CLProgramTest.java
index fd98e78e..392bf33f 100644
--- a/test/com/jogamp/opencl/CLProgramTest.java
+++ b/test/com/jogamp/opencl/CLProgramTest.java
@@ -61,9 +61,8 @@ public class CLProgramTest {
assertTrue(program.isExecutable());
- Map<String, CLKernel> kernels = program.createCLKernels();
- assertNotNull(kernels);
- assertTrue("kernel map is empty", kernels.size() > 0);
+ CLKernel kernel = program.createCLKernel("VectorAddGM");
+ assertNotNull(kernel);
// rebuild
// 1. release kernels (internally)
@@ -73,10 +72,8 @@ public class CLProgramTest {
out.println(program.getBuildStatus());
// try again with rebuilt program
- kernels = program.createCLKernels();
- assertNotNull(kernels);
- assertTrue("kernel map is empty", kernels.size() > 0);
- assertTrue(kernels.size() > 0);
+ kernel = program.createCLKernel("VectorAddGM");
+ assertNotNull(kernel);
context.release();
}
@@ -277,6 +274,35 @@ public class CLProgramTest {
}
+ @Test
+ public void createAllKernelsTest() {
+
+ String source = "kernel void foo(int a) { }\n"+
+ "kernel void bar(float b) { }\n";
+
+ CLContext context = CLContext.create();
+ try{
+ CLProgram program = context.createProgram(source).build();
+ assertTrue(program.isExecutable());
+
+ Map<String, CLKernel> kernels = program.createCLKernels();
+ for (CLKernel kernel : kernels.values()) {
+ out.println("kernel: "+kernel.toString());
+ }
+
+ assertNotNull(kernels.get("foo"));
+ assertNotNull(kernels.get("bar"));
+
+ kernels.get("foo").setArg(0, 42);
+ kernels.get("bar").setArg(0, 3.14f);
+
+
+ }finally{
+ context.release();
+ }
+
+ }
+
// @Test
public void loadTest() throws IOException, ClassNotFoundException, InterruptedException {
for(int i = 0; i < 100; i++) {
diff --git a/test/com/jogamp/opencl/HighLevelBindingTest.java b/test/com/jogamp/opencl/HighLevelBindingTest.java
index 35c13261..e08fadc7 100644
--- a/test/com/jogamp/opencl/HighLevelBindingTest.java
+++ b/test/com/jogamp/opencl/HighLevelBindingTest.java
@@ -279,15 +279,7 @@ public class HighLevelBindingTest {
CLBuffer<ByteBuffer> clBufferB = context.createBuffer(srcB, Mem.READ_ONLY);
CLBuffer<ByteBuffer> clBufferC = context.createBuffer(dest, Mem.WRITE_ONLY);
- Map<String, CLKernel> kernels = program.createCLKernels();
- for (CLKernel kernel : kernels.values()) {
- out.println("kernel: "+kernel.toString());
- }
-
- assertNotNull(kernels.get("VectorAddGM"));
- assertNotNull(kernels.get("Test"));
-
- CLKernel vectorAddKernel = kernels.get("VectorAddGM");
+ CLKernel vectorAddKernel = program.createCLKernel("VectorAddGM");
vectorAddKernel.setArg(0, clBufferA)
.setArg(1, clBufferB)