From 5356c2e6effcdec3c3a6e4f492ea8742bed668eb Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Tue, 26 Apr 2011 03:59:23 +0200 Subject: compatibility update to latest jocl. --- src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java | 5 +++-- .../jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/com/jogamp/opencl') diff --git a/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java b/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java index 9fcd172..f03c0b8 100644 --- a/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java +++ b/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java @@ -12,6 +12,7 @@ import com.jogamp.opencl.CLKernel; import com.jogamp.opencl.CLPlatform; import com.jogamp.opencl.CLProgram; import com.jogamp.opencl.CLProgram.CompilerOptions; +import com.jogamp.opencl.util.CLPlatformFilters; import com.jogamp.opencl.util.CLProgramConfiguration; import com.jogamp.opengl.util.awt.TextRenderer; import java.awt.Color; @@ -386,9 +387,9 @@ public class MultiDeviceFractal implements GLEventListener { .rewind(); // aquire GL objects, and enqueue a kernel with a probe from the list - queues[i].putAcquireGLObject(pboBuffers[i].ID) + queues[i].putAcquireGLObject(pboBuffers[i]) .put2DRangeKernel(kernels[i], 0, 0, sliceWidth, height, 0, 0, probes) - .putReleaseGLObject(pboBuffers[i].ID); + .putReleaseGLObject(pboBuffers[i]); } diff --git a/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java b/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java index fbd3775..2e630c6 100644 --- a/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java +++ b/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java @@ -182,6 +182,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { commandQueue = clContext.getMaxFlopsDevice().createCommandQueue(); clBuffer = clContext.createFromGLBuffer(glObjects[VERTICES], CLGLBuffer.Mem.WRITE_ONLY); + System.out.println("clsize: "+clBuffer.getCLSize()); System.out.println("cl buffer type: " + clBuffer.getGLObjectType()); System.out.println("shared with gl buffer: " + clBuffer.getGLObjectID()); @@ -230,9 +231,9 @@ public class GLCLInteroperabilityDemo implements GLEventListener { kernel.setArg(2, step += 0.05f); - commandQueue.putAcquireGLObject(clBuffer.ID) + commandQueue.putAcquireGLObject(clBuffer) .put2DRangeKernel(kernel, 0, 0, MESH_SIZE, MESH_SIZE, 0, 0) - .putReleaseGLObject(clBuffer.ID) + .putReleaseGLObject(clBuffer) .finish(); } -- cgit v1.2.3 From 1a5a20615afc6f247bfd7f50b099247d8fd45342 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Tue, 26 Apr 2011 15:54:54 +0200 Subject: updated demos to latest jocl version --- src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java | 12 ++++++++---- .../opencl/demos/joglinterop/GLCLInteroperabilityDemo.java | 11 ++++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'src/com/jogamp/opencl') diff --git a/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java b/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java index f03c0b8..e38b7b8 100644 --- a/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java +++ b/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java @@ -12,7 +12,6 @@ import com.jogamp.opencl.CLKernel; import com.jogamp.opencl.CLPlatform; import com.jogamp.opencl.CLProgram; import com.jogamp.opencl.CLProgram.CompilerOptions; -import com.jogamp.opencl.util.CLPlatformFilters; import com.jogamp.opencl.util.CLProgramConfiguration; import com.jogamp.opengl.util.awt.TextRenderer; import java.awt.Color; @@ -124,6 +123,7 @@ public class MultiDeviceFractal implements GLEventListener { textRenderer = new TextRenderer(frame.getFont().deriveFont(Font.BOLD, 14), true, true, null, false); } + @Override public void init(GLAutoDrawable drawable) { if(clContext == null) { @@ -281,11 +281,12 @@ public class MultiDeviceFractal implements GLEventListener { // setup one empty PBO per slice for (int i = 0; i < slices; i++) { + int length = width*height * SIZEOF_INT / slices; gl.glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo[i]); - gl.glBufferData(GL_PIXEL_UNPACK_BUFFER, width*height * SIZEOF_INT / slices, null, GL_STREAM_DRAW); + gl.glBufferData(GL_PIXEL_UNPACK_BUFFER, length, null, GL_STREAM_DRAW); gl.glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); - pboBuffers[i] = clContext.createFromGLBuffer(pbo[i], WRITE_ONLY); + pboBuffers[i] = clContext.createFromGLBuffer(pbo[i], length, WRITE_ONLY); } @@ -350,6 +351,7 @@ public class MultiDeviceFractal implements GLEventListener { } // rendering cycle + @Override public void display(GLAutoDrawable drawable) { GL gl = drawable.getGL(); @@ -439,6 +441,7 @@ public class MultiDeviceFractal implements GLEventListener { textRenderer.endRendering(); } + @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { if(this.width == width && this.height == height) @@ -541,6 +544,7 @@ public class MultiDeviceFractal implements GLEventListener { win.dispose(); } + @Override public void dispose(GLAutoDrawable drawable) { } @@ -550,7 +554,7 @@ public class MultiDeviceFractal implements GLEventListener { GLProfile.initSingleton(false); SwingUtilities.invokeLater(new Runnable() { - public void run() { + @Override public void run() { new MultiDeviceFractal(512, 512); } }); diff --git a/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java b/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java index 2e630c6..5bed5ae 100644 --- a/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java +++ b/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java @@ -31,6 +31,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { private final GLUgl2 glu = new GLUgl2(); private final int MESH_SIZE = 256; + private final int BUFFER_SIZE = MESH_SIZE * MESH_SIZE * 4 * SIZEOF_FLOAT; private int width; private int height; @@ -81,7 +82,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { // ib.rewind(); SwingUtilities.invokeLater(new Runnable() { - public void run() { + @Override public void run() { initUI(); } }); @@ -111,6 +112,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { } + @Override public void init(GLAutoDrawable drawable) { if(clContext == null) { @@ -149,7 +151,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, glObjects[VERTICES]); - gl.glBufferData(GL2.GL_ARRAY_BUFFER, MESH_SIZE * MESH_SIZE * 4 * SIZEOF_FLOAT, null, GL2.GL_DYNAMIC_DRAW); + gl.glBufferData(GL2.GL_ARRAY_BUFFER, BUFFER_SIZE, null, GL2.GL_DYNAMIC_DRAW); gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0); gl.glDisableClientState(GL2.GL_VERTEX_ARRAY); @@ -181,7 +183,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { commandQueue = clContext.getMaxFlopsDevice().createCommandQueue(); - clBuffer = clContext.createFromGLBuffer(glObjects[VERTICES], CLGLBuffer.Mem.WRITE_ONLY); + clBuffer = clContext.createFromGLBuffer(glObjects[VERTICES], BUFFER_SIZE, CLGLBuffer.Mem.WRITE_ONLY); System.out.println("clsize: "+clBuffer.getCLSize()); System.out.println("cl buffer type: " + clBuffer.getGLObjectType()); @@ -196,6 +198,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { } + @Override public void display(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); @@ -264,6 +267,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { } + @Override public void reshape(GLAutoDrawable drawable, int arg1, int arg2, int width, int height) { this.width = width; this.height = height; @@ -272,6 +276,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { pushPerspectiveView(gl); } + @Override public void dispose(GLAutoDrawable drawable) { } public static void main(String[] args) { -- cgit v1.2.3 From 3e75f3f7c0b7339547ee3cf3da2e68599dd68b53 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sun, 19 Jun 2011 23:26:00 +0200 Subject: implemented isReleased() --- src/com/jogamp/opencl/demos/radixsort/RadixSort.java | 5 +++++ src/com/jogamp/opencl/demos/radixsort/Scan.java | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'src/com/jogamp/opencl') diff --git a/src/com/jogamp/opencl/demos/radixsort/RadixSort.java b/src/com/jogamp/opencl/demos/radixsort/RadixSort.java index e2a7b46..92e61a2 100644 --- a/src/com/jogamp/opencl/demos/radixsort/RadixSort.java +++ b/src/com/jogamp/opencl/demos/radixsort/RadixSort.java @@ -173,6 +173,11 @@ public class RadixSort implements CLResource { mBlockOffsets.release(); } + @Override + public boolean isReleased() { + return scan.isReleased(); + } + public void close() { release(); } diff --git a/src/com/jogamp/opencl/demos/radixsort/Scan.java b/src/com/jogamp/opencl/demos/radixsort/Scan.java index 3d364ed..b096437 100644 --- a/src/com/jogamp/opencl/demos/radixsort/Scan.java +++ b/src/com/jogamp/opencl/demos/radixsort/Scan.java @@ -125,6 +125,11 @@ public class Scan implements CLResource { } } + @Override + public boolean isReleased() { + return program.isReleased(); + } + public void close() { release(); } -- cgit v1.2.3