|
|
@ -115,8 +115,7 @@ public class TestVertexBufferSharing extends SimpleApplication { |
|
|
|
private void initOpenCL1() { |
|
|
|
private void initOpenCL1() { |
|
|
|
clContext = context.getOpenCLContext(); |
|
|
|
clContext = context.getOpenCLContext(); |
|
|
|
Device device = clContext.getDevices().get(0); |
|
|
|
Device device = clContext.getDevices().get(0); |
|
|
|
clQueue = clContext.createQueue(device); |
|
|
|
clQueue = clContext.createQueue(device).register(); |
|
|
|
clQueue.register(); |
|
|
|
|
|
|
|
//create kernel
|
|
|
|
//create kernel
|
|
|
|
Program program = null; |
|
|
|
Program program = null; |
|
|
|
File tmpFolder = JmeSystem.getStorageFolder(); |
|
|
|
File tmpFolder = JmeSystem.getStorageFolder(); |
|
|
@ -156,15 +155,13 @@ public class TestVertexBufferSharing extends SimpleApplication { |
|
|
|
} |
|
|
|
} |
|
|
|
LOG.info("create new program from sources"); |
|
|
|
LOG.info("create new program from sources"); |
|
|
|
} |
|
|
|
} |
|
|
|
program.register(); |
|
|
|
program.register(); |
|
|
|
kernel = program.createKernel("ScaleKernel"); |
|
|
|
kernel = program.createKernel("ScaleKernel").register(); |
|
|
|
kernel.register(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
private void initOpenCL2() { |
|
|
|
private void initOpenCL2() { |
|
|
|
//bind vertex buffer to OpenCL
|
|
|
|
//bind vertex buffer to OpenCL
|
|
|
|
VertexBuffer vb = geom.getMesh().getBuffer(VertexBuffer.Type.Position); |
|
|
|
VertexBuffer vb = geom.getMesh().getBuffer(VertexBuffer.Type.Position); |
|
|
|
buffer = clContext.bindVertexBuffer(vb, MemoryAccess.READ_WRITE); |
|
|
|
buffer = clContext.bindVertexBuffer(vb, MemoryAccess.READ_WRITE).register(); |
|
|
|
buffer.register(); |
|
|
|
|
|
|
|
ws = new com.jme3.opencl.Kernel.WorkSize(geom.getMesh().getVertexCount()); |
|
|
|
ws = new com.jme3.opencl.Kernel.WorkSize(geom.getMesh().getVertexCount()); |
|
|
|
} |
|
|
|
} |
|
|
|
private void updateOpenCL(float tpf) { |
|
|
|
private void updateOpenCL(float tpf) { |
|
|
|