Support LWJGL 3.1.2

fix-456
Kirill Vainer 8 years ago committed by Rémy Bouquet
parent 7f8fa4d74c
commit 381d69ccb7
  1. 5
      jme3-lwjgl3/build.gradle
  2. 12
      jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglBuffer.java
  3. 12
      jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglImage.java
  4. 2
      jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/info/CLUtil.java

@ -2,7 +2,7 @@ if (!hasProperty('mainClass')) {
ext.mainClass = '' ext.mainClass = ''
} }
def lwjglVersion = '3.1.0' def lwjglVersion = '3.1.2'
sourceCompatibility = '1.8' sourceCompatibility = '1.8'
@ -25,6 +25,9 @@ dependencies {
runtime "org.lwjgl:lwjgl-jemalloc:${lwjglVersion}:natives-windows" runtime "org.lwjgl:lwjgl-jemalloc:${lwjglVersion}:natives-windows"
runtime "org.lwjgl:lwjgl-jemalloc:${lwjglVersion}:natives-linux" runtime "org.lwjgl:lwjgl-jemalloc:${lwjglVersion}:natives-linux"
runtime "org.lwjgl:lwjgl-jemalloc:${lwjglVersion}:natives-macos" runtime "org.lwjgl:lwjgl-jemalloc:${lwjglVersion}:natives-macos"
runtime "org.lwjgl:lwjgl-opengl:${lwjglVersion}:natives-windows"
runtime "org.lwjgl:lwjgl-opengl:${lwjglVersion}:natives-linux"
runtime "org.lwjgl:lwjgl-opengl:${lwjglVersion}:natives-macos"
runtime "org.lwjgl:lwjgl-openal:${lwjglVersion}:natives-windows" runtime "org.lwjgl:lwjgl-openal:${lwjglVersion}:natives-windows"
runtime "org.lwjgl:lwjgl-openal:${lwjglVersion}:natives-linux" runtime "org.lwjgl:lwjgl-openal:${lwjglVersion}:natives-linux"
runtime "org.lwjgl:lwjgl-openal:${lwjglVersion}:natives-macos" runtime "org.lwjgl:lwjgl-openal:${lwjglVersion}:natives-macos"

@ -67,7 +67,7 @@ public class LwjglBuffer extends Buffer {
//Note: LWJGL does not support the size parameter, I have to set the buffer limit //Note: LWJGL does not support the size parameter, I have to set the buffer limit
dest.limit((int) (dest.position() + size)); dest.limit((int) (dest.position() + size));
int ret = CL10.clEnqueueReadBuffer(((LwjglCommandQueue)queue).getQueue(), int ret = CL10.clEnqueueReadBuffer(((LwjglCommandQueue)queue).getQueue(),
buffer, CL10.CL_TRUE, offset, dest, null, null); buffer, true, offset, dest, null, null);
Utils.checkError(ret, "clEnqueueReadBuffer"); Utils.checkError(ret, "clEnqueueReadBuffer");
} }
@ -77,7 +77,7 @@ public class LwjglBuffer extends Buffer {
dest.limit((int) (dest.position() + size)); dest.limit((int) (dest.position() + size));
Utils.pointerBuffers[0].rewind(); Utils.pointerBuffers[0].rewind();
long q = ((LwjglCommandQueue)queue).getQueue(); long q = ((LwjglCommandQueue)queue).getQueue();
int ret = CL10.clEnqueueReadBuffer(q, buffer, CL10.CL_FALSE, offset, dest, null, Utils.pointerBuffers[0]); int ret = CL10.clEnqueueReadBuffer(q, buffer, false, offset, dest, null, Utils.pointerBuffers[0]);
Utils.checkError(ret, "clEnqueueReadBuffer"); Utils.checkError(ret, "clEnqueueReadBuffer");
long event = Utils.pointerBuffers[0].get(0); long event = Utils.pointerBuffers[0].get(0);
return new LwjglEvent(event); return new LwjglEvent(event);
@ -88,7 +88,7 @@ public class LwjglBuffer extends Buffer {
//Note: LWJGL does not support the size parameter, I have to set the buffer limit //Note: LWJGL does not support the size parameter, I have to set the buffer limit
src.limit((int) (src.position() + size)); src.limit((int) (src.position() + size));
long q = ((LwjglCommandQueue)queue).getQueue(); long q = ((LwjglCommandQueue)queue).getQueue();
int ret = CL10.clEnqueueWriteBuffer(q, buffer, CL10.CL_TRUE, offset, src, null, null); int ret = CL10.clEnqueueWriteBuffer(q, buffer, true, offset, src, null, null);
Utils.checkError(ret, "clEnqueueWriteBuffer"); Utils.checkError(ret, "clEnqueueWriteBuffer");
} }
@ -98,7 +98,7 @@ public class LwjglBuffer extends Buffer {
src.limit((int) (src.position() + size)); src.limit((int) (src.position() + size));
Utils.pointerBuffers[0].rewind(); Utils.pointerBuffers[0].rewind();
long q = ((LwjglCommandQueue)queue).getQueue(); long q = ((LwjglCommandQueue)queue).getQueue();
int ret = CL10.clEnqueueWriteBuffer(q, buffer, CL10.CL_FALSE, offset, src, null, Utils.pointerBuffers[0]); int ret = CL10.clEnqueueWriteBuffer(q, buffer, false, offset, src, null, Utils.pointerBuffers[0]);
Utils.checkError(ret, "clEnqueueWriteBuffer"); Utils.checkError(ret, "clEnqueueWriteBuffer");
long event = Utils.pointerBuffers[0].get(0); long event = Utils.pointerBuffers[0].get(0);
return new LwjglEvent(event); return new LwjglEvent(event);
@ -130,7 +130,7 @@ public class LwjglBuffer extends Buffer {
long q = ((LwjglCommandQueue) queue).getQueue(); long q = ((LwjglCommandQueue) queue).getQueue();
long flags = Utils.getMappingAccessFlags(access); long flags = Utils.getMappingAccessFlags(access);
Utils.errorBuffer.rewind(); Utils.errorBuffer.rewind();
ByteBuffer b = CL10.clEnqueueMapBuffer(q, buffer, CL10.CL_TRUE, flags, offset, size, null, null, Utils.errorBuffer, null); ByteBuffer b = CL10.clEnqueueMapBuffer(q, buffer, true, flags, offset, size, null, null, Utils.errorBuffer, null);
Utils.checkError(Utils.errorBuffer, "clEnqueueMapBuffer"); Utils.checkError(Utils.errorBuffer, "clEnqueueMapBuffer");
return b; return b;
} }
@ -153,7 +153,7 @@ public class LwjglBuffer extends Buffer {
Utils.errorBuffer.rewind(); Utils.errorBuffer.rewind();
long q = ((LwjglCommandQueue) queue).getQueue(); long q = ((LwjglCommandQueue) queue).getQueue();
long flags = Utils.getMappingAccessFlags(access); long flags = Utils.getMappingAccessFlags(access);
ByteBuffer buf = CL10.clEnqueueMapBuffer(q, buffer, CL10.CL_FALSE, flags, offset, size, null, Utils.pointerBuffers[0], Utils.errorBuffer, null); ByteBuffer buf = CL10.clEnqueueMapBuffer(q, buffer, false, flags, offset, size, null, Utils.pointerBuffers[0], Utils.errorBuffer, null);
Utils.checkError(Utils.errorBuffer, "clEnqueueMapBuffer"); Utils.checkError(Utils.errorBuffer, "clEnqueueMapBuffer");
long event = Utils.pointerBuffers[0].get(0); long event = Utils.pointerBuffers[0].get(0);
return new com.jme3.opencl.Buffer.AsyncMapping(new LwjglEvent(event), buf); return new com.jme3.opencl.Buffer.AsyncMapping(new LwjglEvent(event), buf);

@ -302,7 +302,7 @@ public class LwjglImage extends Image {
Utils.pointerBuffers[1].put(origin).position(0); Utils.pointerBuffers[1].put(origin).position(0);
Utils.pointerBuffers[2].put(region).position(0); Utils.pointerBuffers[2].put(region).position(0);
long q = ((LwjglCommandQueue) queue).getQueue(); long q = ((LwjglCommandQueue) queue).getQueue();
int ret = CL10.clEnqueueReadImage(q, image, CL10.CL_TRUE, int ret = CL10.clEnqueueReadImage(q, image, true,
Utils.pointerBuffers[1], Utils.pointerBuffers[2], Utils.pointerBuffers[1], Utils.pointerBuffers[2],
rowPitch, slicePitch, dest, null, null); rowPitch, slicePitch, dest, null, null);
Utils.checkError(ret, "clEnqueueReadImage"); Utils.checkError(ret, "clEnqueueReadImage");
@ -319,7 +319,7 @@ public class LwjglImage extends Image {
Utils.pointerBuffers[1].put(origin).position(0); Utils.pointerBuffers[1].put(origin).position(0);
Utils.pointerBuffers[2].put(region).position(0); Utils.pointerBuffers[2].put(region).position(0);
long q = ((LwjglCommandQueue) queue).getQueue(); long q = ((LwjglCommandQueue) queue).getQueue();
int ret = CL10.clEnqueueReadImage(q, image, CL10.CL_FALSE, int ret = CL10.clEnqueueReadImage(q, image, false,
Utils.pointerBuffers[1], Utils.pointerBuffers[2], Utils.pointerBuffers[1], Utils.pointerBuffers[2],
rowPitch, slicePitch, dest, null, Utils.pointerBuffers[0]); rowPitch, slicePitch, dest, null, Utils.pointerBuffers[0]);
Utils.checkError(ret, "clEnqueueReadImage"); Utils.checkError(ret, "clEnqueueReadImage");
@ -337,7 +337,7 @@ public class LwjglImage extends Image {
Utils.pointerBuffers[1].put(origin).position(0); Utils.pointerBuffers[1].put(origin).position(0);
Utils.pointerBuffers[2].put(region).position(0); Utils.pointerBuffers[2].put(region).position(0);
long q = ((LwjglCommandQueue) queue).getQueue(); long q = ((LwjglCommandQueue) queue).getQueue();
int ret = CL10.clEnqueueWriteImage(q, image, CL10.CL_TRUE, int ret = CL10.clEnqueueWriteImage(q, image, true,
Utils.pointerBuffers[1], Utils.pointerBuffers[2], Utils.pointerBuffers[1], Utils.pointerBuffers[2],
rowPitch, slicePitch, dest, null, null); rowPitch, slicePitch, dest, null, null);
Utils.checkError(ret, "clEnqueueWriteImage"); Utils.checkError(ret, "clEnqueueWriteImage");
@ -354,7 +354,7 @@ public class LwjglImage extends Image {
Utils.pointerBuffers[1].put(origin).position(0); Utils.pointerBuffers[1].put(origin).position(0);
Utils.pointerBuffers[2].put(region).position(0); Utils.pointerBuffers[2].put(region).position(0);
long q = ((LwjglCommandQueue) queue).getQueue(); long q = ((LwjglCommandQueue) queue).getQueue();
int ret = CL10.clEnqueueWriteImage(q, image, CL10.CL_FALSE, int ret = CL10.clEnqueueWriteImage(q, image, false,
Utils.pointerBuffers[1], Utils.pointerBuffers[2], Utils.pointerBuffers[1], Utils.pointerBuffers[2],
rowPitch, slicePitch, dest, null, Utils.pointerBuffers[0]); rowPitch, slicePitch, dest, null, Utils.pointerBuffers[0]);
Utils.checkError(ret, "clEnqueueWriteImage"); Utils.checkError(ret, "clEnqueueWriteImage");
@ -419,7 +419,7 @@ public class LwjglImage extends Image {
long q = ((LwjglCommandQueue) queue).getQueue(); long q = ((LwjglCommandQueue) queue).getQueue();
long flags = Utils.getMappingAccessFlags(access); long flags = Utils.getMappingAccessFlags(access);
Utils.errorBuffer.rewind(); Utils.errorBuffer.rewind();
ByteBuffer buf = CL10.clEnqueueMapImage(q, image, CL10.CL_TRUE, flags, ByteBuffer buf = CL10.clEnqueueMapImage(q, image, true, flags,
Utils.pointerBuffers[1], Utils.pointerBuffers[2], Utils.pointerBuffers[1], Utils.pointerBuffers[2],
Utils.pointerBuffers[3], Utils.pointerBuffers[4], null, null, Utils.pointerBuffers[3], Utils.pointerBuffers[4], null, null,
Utils.errorBuffer, null); Utils.errorBuffer, null);
@ -442,7 +442,7 @@ public class LwjglImage extends Image {
long q = ((LwjglCommandQueue) queue).getQueue(); long q = ((LwjglCommandQueue) queue).getQueue();
long flags = Utils.getMappingAccessFlags(access); long flags = Utils.getMappingAccessFlags(access);
Utils.errorBuffer.rewind(); Utils.errorBuffer.rewind();
ByteBuffer buf = CL10.clEnqueueMapImage(q, image, CL10.CL_FALSE, flags, ByteBuffer buf = CL10.clEnqueueMapImage(q, image, false, flags,
Utils.pointerBuffers[1], Utils.pointerBuffers[2], Utils.pointerBuffers[1], Utils.pointerBuffers[2],
Utils.pointerBuffers[3], Utils.pointerBuffers[4], null, Utils.pointerBuffers[0], Utils.pointerBuffers[3], Utils.pointerBuffers[4], null, Utils.pointerBuffers[0],
Utils.errorBuffer, null); Utils.errorBuffer, null);

@ -4,7 +4,7 @@
*/ */
package com.jme3.opencl.lwjgl.info; package com.jme3.opencl.lwjgl.info;
import com.jme3.lwjgl3.utils.APIUtil.TokenFilter; import static com.jme3.lwjgl3.utils.APIUtil.apiOptionalClass;
import com.jme3.opencl.OpenCLException; import com.jme3.opencl.OpenCLException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;

Loading…
Cancel
Save