diff options
-rw-r--r-- | .classpath | 12 | ||||
-rw-r--r-- | .externalToolBuilders/jocl-demos-ant.launch | 14 | ||||
-rw-r--r-- | .project | 22 | ||||
-rw-r--r-- | src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java | 7 | ||||
-rw-r--r-- | src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java | 15 | ||||
-rw-r--r-- | src/com/jogamp/opencl/demos/radixsort/RadixSort.java | 1 | ||||
-rw-r--r-- | src/com/jogamp/opencl/demos/radixsort/Scan.java | 4 |
7 files changed, 61 insertions, 14 deletions
diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..170dc93 --- /dev/null +++ b/.classpath @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/jogamp"/> + <classpathentry kind="lib" path="/jocl/dist/jocl.jar" sourcepath="/jocl/src"> + <attributes> + <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="jocl/build/obj"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="build"/> +</classpath> diff --git a/.externalToolBuilders/jocl-demos-ant.launch b/.externalToolBuilders/jocl-demos-ant.launch new file mode 100644 index 0000000..21aebe9 --- /dev/null +++ b/.externalToolBuilders/jocl-demos-ant.launch @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> +<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="clean,"/> +<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> +<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> +<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="jocl-demos"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/jocl-demos/build.xml}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/> +<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/jocl-demos}"/> +</launchConfiguration> diff --git a/.project b/.project new file mode 100644 index 0000000..6c956a0 --- /dev/null +++ b/.project @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>jocl-demos</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> + <triggers>full,incremental,</triggers> + <arguments> + <dictionary> + <key>LaunchConfigHandle</key> + <value><project>/.externalToolBuilders/jocl-demos-ant.launch</value> + </dictionary> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> 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() { |