diff --git a/jme3-core/src/main/resources/Common/OpenCL/Random.clh b/jme3-core/src/main/resources/Common/OpenCL/Random.clh index 18127e153..9891441c8 100644 --- a/jme3-core/src/main/resources/Common/OpenCL/Random.clh +++ b/jme3-core/src/main/resources/Common/OpenCL/Random.clh @@ -5,13 +5,13 @@ //#define RANDOM_DOUBLES #ifdef RANDOM_DOUBLES -#ifdef cl_khr_fp64 +//#ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable -#elif defined(cl_amd_fp64) -#pragma OPENCL EXTENSION cl_amd_fp64 : enable -#else -#error "Double precision floating point not supported by OpenCL implementation." -#endif +//#elif defined(cl_amd_fp64) +//#pragma OPENCL EXTENSION cl_amd_fp64 : enable +//#else +//#error "Double precision floating point not supported by OpenCL implementation." +//#endif #endif inline int randNext(int bits, __global ulong* seed) diff --git a/jme3-examples/src/main/java/jme3test/opencl/TestOpenCLLibraries.java b/jme3-examples/src/main/java/jme3test/opencl/TestOpenCLLibraries.java index 766437c65..396411397 100644 --- a/jme3-examples/src/main/java/jme3test/opencl/TestOpenCLLibraries.java +++ b/jme3-examples/src/main/java/jme3test/opencl/TestOpenCLLibraries.java @@ -250,10 +250,10 @@ public class TestOpenCLLibraries extends SimpleApplication { program.release(); } catch (AssertionError ex) { - LOG.log(Level.SEVERE, "kernel test failed with an assertion error"); + LOG.log(Level.SEVERE, "random test failed with an assertion error"); return false; } catch (Exception ex) { - LOG.log(Level.SEVERE, "kernel test failed with:", ex); + LOG.log(Level.SEVERE, "random test failed with:", ex); return false; } return true; @@ -310,10 +310,10 @@ public class TestOpenCLLibraries extends SimpleApplication { buffer.release(); } catch (AssertionError ex) { - LOG.log(Level.SEVERE, "kernel test failed with an assertion error"); + LOG.log(Level.SEVERE, "matrix3f test failed with an assertion error"); return false; } catch (Exception ex) { - LOG.log(Level.SEVERE, "kernel test failed with:", ex); + LOG.log(Level.SEVERE, "matrix3f test failed with:", ex); return false; } return true; @@ -392,10 +392,10 @@ public class TestOpenCLLibraries extends SimpleApplication { buffer.release(); } catch (AssertionError ex) { - LOG.log(Level.SEVERE, "kernel test failed with an assertion error"); + LOG.log(Level.SEVERE, "matrix4f test failed with an assertion error"); return false; } catch (Exception ex) { - LOG.log(Level.SEVERE, "kernel test failed with:", ex); + LOG.log(Level.SEVERE, "matrix4f test failed with:", ex); return false; } return true; diff --git a/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclBuffer.java b/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclBuffer.java index 23cc4dda9..1085ad7d2 100644 --- a/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclBuffer.java +++ b/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclBuffer.java @@ -140,6 +140,7 @@ public class JoclBuffer extends Buffer { public void unmap(CommandQueue queue, ByteBuffer ptr) { long q = ((JoclCommandQueue)queue).id; Utils.pointers[0].rewind(); + ptr.position(0); int ret = cl.clEnqueueUnmapMemObject(q, id, ptr, 0, null, Utils.pointers[0]); Utils.checkError(ret, "clEnqueueUnmapMemObject"); ret = cl.clWaitForEvents(1, Utils.pointers[0]); diff --git a/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclImage.java b/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclImage.java index 252debdf3..ce6155928 100644 --- a/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclImage.java +++ b/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclImage.java @@ -448,6 +448,7 @@ public class JoclImage extends Image { public void unmap(CommandQueue queue, ImageMapping mapping) { long q = ((JoclCommandQueue)queue).id; Utils.pointers[0].rewind(); + mapping.buffer.position(0); int ret = cl.clEnqueueUnmapMemObject(q, id, mapping.buffer, 0, null, Utils.pointers[0]); Utils.checkError(ret, "clEnqueueUnmapMemObject"); ret = cl.clWaitForEvents(1, Utils.pointers[0]); diff --git a/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglBuffer.java b/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglBuffer.java index 298a13059..ea0eb9543 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglBuffer.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglBuffer.java @@ -136,6 +136,7 @@ public class LwjglBuffer extends Buffer { @Override public void unmap(CommandQueue queue, ByteBuffer ptr) { + ptr.position(0); long q = ((LwjglCommandQueue) queue).getQueue(); Utils.pointerBuffers[0].rewind(); int ret = CL10.clEnqueueUnmapMemObject(q, buffer, ptr, null, Utils.pointerBuffers[0]); diff --git a/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglImage.java b/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglImage.java index 5b9c06e66..ed9239677 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglImage.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglImage.java @@ -449,6 +449,7 @@ public class LwjglImage extends Image { @Override public void unmap(CommandQueue queue, ImageMapping mapping) { + mapping.buffer.position(0); long q = ((LwjglCommandQueue) queue).getQueue(); Utils.pointerBuffers[0].rewind(); int ret = CL10.clEnqueueUnmapMemObject(q, image, mapping.buffer, null, Utils.pointerBuffers[0]); diff --git a/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglKernel.java b/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglKernel.java index ce7bd8d0b..b3a668611 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglKernel.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglKernel.java @@ -162,8 +162,8 @@ public class LwjglKernel extends Kernel { buf.put(m.m00).put(m.m01).put(m.m02).put(m.m03); buf.put(m.m10).put(m.m11).put(m.m12).put(m.m13); buf.put(m.m20).put(m.m21).put(m.m22).put(m.m23); - buf.position(0); buf.put(m.m30).put(m.m31).put(m.m32).put(m.m33); + buf.position(0); int ret = CL10.clSetKernelArg(kernel, index, buf); Utils.checkError(ret, "clSetKernelArg"); }