aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java7
-rw-r--r--src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java15
-rw-r--r--src/com/jogamp/opencl/demos/radixsort/RadixSort.java1
-rw-r--r--src/com/jogamp/opencl/demos/radixsort/Scan.java4
4 files changed, 13 insertions, 14 deletions
diff --git a/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java b/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java
index e38b7b8..67c4957 100644
--- a/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java
+++ b/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java
@@ -281,13 +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;
+ final int size = width*height * SIZEOF_INT / slices ;
gl.glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo[i]);
- gl.glBufferData(GL_PIXEL_UNPACK_BUFFER, length, null, GL_STREAM_DRAW);
+ gl.glBufferData(GL_PIXEL_UNPACK_BUFFER, size, null, GL_STREAM_DRAW);
gl.glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
- pboBuffers[i] = clContext.createFromGLBuffer(pbo[i], length, WRITE_ONLY);
-
+ pboBuffers[i] = clContext.createFromGLBuffer(pbo[i], size, WRITE_ONLY);
}
buffersInitialized = true;
diff --git a/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java b/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java
index 5bed5ae..8fb4c9f 100644
--- a/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java
+++ b/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java
@@ -31,7 +31,6 @@ 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;
@@ -149,17 +148,18 @@ public class GLCLInteroperabilityDemo implements GLEventListener {
// gl.glBufferData(GL2.GL_ELEMENT_ARRAY_BUFFER, ib.capacity() * SIZEOF_INT, ib, GL2.GL_STATIC_DRAW);
// gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, 0);
+ final int bsz = MESH_SIZE * MESH_SIZE * 4 * SIZEOF_FLOAT;
gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, glObjects[VERTICES]);
- gl.glBufferData(GL2.GL_ARRAY_BUFFER, BUFFER_SIZE, null, GL2.GL_DYNAMIC_DRAW);
+ gl.glBufferData(GL2.GL_ARRAY_BUFFER, bsz, null, GL2.GL_DYNAMIC_DRAW);
gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
- gl.glDisableClientState(GL2.GL_VERTEX_ARRAY);
+ gl.glDisableClientState(GL2.GL_VERTEX_ARRAY);
pushPerspectiveView(gl);
gl.glFinish();
// init OpenCL
- initCL();
+ initCL(gl, bsz);
// start rendering thread
Animator animator = new Animator(drawable);
@@ -168,7 +168,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener {
}
}
- private void initCL() {
+ private void initCL(GL2 gl, int bufferSize) {
CLProgram program;
try {
@@ -183,8 +183,9 @@ public class GLCLInteroperabilityDemo implements GLEventListener {
commandQueue = clContext.getMaxFlopsDevice().createCommandQueue();
- clBuffer = clContext.createFromGLBuffer(glObjects[VERTICES], BUFFER_SIZE, CLGLBuffer.Mem.WRITE_ONLY);
- System.out.println("clsize: "+clBuffer.getCLSize());
+ clBuffer = clContext.createFromGLBuffer(glObjects[VERTICES],
+ bufferSize /* gl.glGetBufferSize(glObjects[VERTICES]*/,
+ CLGLBuffer.Mem.WRITE_ONLY);
System.out.println("cl buffer type: " + clBuffer.getGLObjectType());
System.out.println("shared with gl buffer: " + clBuffer.getGLObjectID());
diff --git a/src/com/jogamp/opencl/demos/radixsort/RadixSort.java b/src/com/jogamp/opencl/demos/radixsort/RadixSort.java
index 92e61a2..9a89760 100644
--- a/src/com/jogamp/opencl/demos/radixsort/RadixSort.java
+++ b/src/com/jogamp/opencl/demos/radixsort/RadixSort.java
@@ -173,7 +173,6 @@ public class RadixSort implements CLResource {
mBlockOffsets.release();
}
- @Override
public boolean isReleased() {
return scan.isReleased();
}
diff --git a/src/com/jogamp/opencl/demos/radixsort/Scan.java b/src/com/jogamp/opencl/demos/radixsort/Scan.java
index b096437..b25d06d 100644
--- a/src/com/jogamp/opencl/demos/radixsort/Scan.java
+++ b/src/com/jogamp/opencl/demos/radixsort/Scan.java
@@ -125,9 +125,9 @@ public class Scan implements CLResource {
}
}
- @Override
public boolean isReleased() {
- return program.isReleased();
+ throw new UnsupportedOperationException();
+ // FIXME: return program.isReleased();
}
public void close() {