summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/CLProgram.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-04-23 16:10:47 +0200
committerMichael Bien <[email protected]>2011-04-23 16:10:47 +0200
commit557a0a94f42cb2d3d1fa77933af19a422d2f681c (patch)
tree677adaf96b96acfcd95401a25ea42918ba1a8895 /src/com/jogamp/opencl/CLProgram.java
parent3eb0c9892253220a44e43dc1619f548007e6a17f (diff)
switched from PointerBuffer to NativeSizeBuffer.
Diffstat (limited to 'src/com/jogamp/opencl/CLProgram.java')
-rw-r--r--src/com/jogamp/opencl/CLProgram.java29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/com/jogamp/opencl/CLProgram.java b/src/com/jogamp/opencl/CLProgram.java
index bc3727f8..3293fe57 100644
--- a/src/com/jogamp/opencl/CLProgram.java
+++ b/src/com/jogamp/opencl/CLProgram.java
@@ -32,6 +32,7 @@ import com.jogamp.common.nio.CachedBufferFactory;
import com.jogamp.opencl.util.CLProgramConfiguration;
import com.jogamp.opencl.util.CLUtil;
import com.jogamp.common.os.Platform;
+import com.jogamp.common.nio.NativeSizeBuffer;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.opencl.impl.BuildProgramCallback;
import com.jogamp.opencl.util.CLBuildListener;
@@ -77,7 +78,7 @@ public class CLProgram extends CLObject implements CLResource {
IntBuffer status = newDirectIntBuffer(1);
- PointerBuffer length = PointerBuffer.allocateDirect(1).put(0, src.length());
+ NativeSizeBuffer length = NativeSizeBuffer.allocateDirect(1).put(0, src.length());
String[] srcArray = new String[] {src};
// Create the program
@@ -101,13 +102,13 @@ public class CLProgram extends CLObject implements CLResource {
binarySize += entry.getValue().length;
}
- int pbSize = PointerBuffer.elementSize();
+ int pbSize = NativeSizeBuffer.elementSize();
int deviceCount = binaries.size();
CachedBufferFactory bf = CachedBufferFactory.create(binarySize + pbSize*deviceCount*3 + 4, true);
- PointerBuffer devices = PointerBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize));
+ NativeSizeBuffer devices = NativeSizeBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize));
PointerBuffer codeBuffers = PointerBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize));
- PointerBuffer lengths = PointerBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize));
+ NativeSizeBuffer lengths = NativeSizeBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize));
int i = 0;
for (Map.Entry<CLDevice, byte[]> entry : entries) {
@@ -164,7 +165,7 @@ public class CLProgram extends CLObject implements CLResource {
return "";
}
- PointerBuffer size = PointerBuffer.allocateDirect(1);
+ NativeSizeBuffer size = NativeSizeBuffer.allocateDirect(1);
int ret = cl.clGetProgramBuildInfo(ID, device.ID, flag, 0, null, size);
if(ret != CL_SUCCESS) {
@@ -187,7 +188,7 @@ public class CLProgram extends CLObject implements CLResource {
return "";
}
- PointerBuffer size = PointerBuffer.allocateDirect(1);
+ NativeSizeBuffer size = NativeSizeBuffer.allocateDirect(1);
int ret = cl.clGetProgramInfo(ID, flag, 0, null, size);
checkForError(ret, "on clGetProgramInfo");
@@ -328,10 +329,10 @@ public class CLProgram extends CLObject implements CLResource {
releaseKernels();
}
- PointerBuffer deviceIDs = null;
+ NativeSizeBuffer deviceIDs = null;
int count = 0;
if(devices != null && devices.length != 0) {
- deviceIDs = PointerBuffer.allocateDirect(devices.length);
+ deviceIDs = NativeSizeBuffer.allocateDirect(devices.length);
for (int i = 0; i < devices.length; i++) {
deviceIDs.put(i, devices[i].ID);
}
@@ -430,7 +431,7 @@ public class CLProgram extends CLObject implements CLResource {
if(numKernels.get(0) > 0) {
- PointerBuffer kernelIDs = PointerBuffer.allocateDirect(numKernels.get(0));
+ NativeSizeBuffer kernelIDs = NativeSizeBuffer.allocateDirect(numKernels.get(0));
ret = cl.clCreateKernelsInProgram(ID, kernelIDs.capacity(), kernelIDs, null);
if(ret != CL_SUCCESS) {
throw newException(ret, "can not create "+kernelIDs.capacity()+" kernels for "+this);
@@ -494,7 +495,7 @@ public class CLProgram extends CLObject implements CLResource {
if(released) {
return new CLDevice[0];
}
- PointerBuffer size = PointerBuffer.allocateDirect(1);
+ NativeSizeBuffer size = NativeSizeBuffer.allocateDirect(1);
int ret = cl.clGetProgramInfo(ID, CL_PROGRAM_DEVICES, 0, null, size);
if(ret != CL_SUCCESS) {
throw newException(ret, "on clGetProgramInfo of "+this);
@@ -604,8 +605,8 @@ public class CLProgram extends CLObject implements CLResource {
CLDevice[] devices = getCLDevices();
- PointerBuffer sizes = PointerBuffer.allocateDirect(devices.length);
- int ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARY_SIZES, sizes.capacity()*PointerBuffer.elementSize(), sizes.getBuffer(), null);
+ NativeSizeBuffer sizes = NativeSizeBuffer.allocateDirect(devices.length);
+ int ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARY_SIZES, sizes.capacity()*NativeSizeBuffer.elementSize(), sizes.getBuffer(), null);
if(ret != CL_SUCCESS) {
throw newException(ret, "on clGetProgramInfo(CL_PROGRAM_BINARY_SIZES) of "+this);
}
@@ -619,14 +620,14 @@ public class CLProgram extends CLObject implements CLResource {
long address = InternalBufferUtil.getDirectBufferAddress(binaries);
- PointerBuffer addresses = PointerBuffer.allocateDirect(sizes.capacity());
+ NativeSizeBuffer addresses = NativeSizeBuffer.allocateDirect(sizes.capacity());
sizes.rewind();
while(sizes.remaining() != 0) {
addresses.put(address);
address += sizes.get();
}
- ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARIES, addresses.capacity()*PointerBuffer.elementSize(), addresses.getBuffer(), null);
+ ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARIES, addresses.capacity()*NativeSizeBuffer.elementSize(), addresses.getBuffer(), null);
if(ret != CL_SUCCESS) {
throw newException(ret, "on clGetProgramInfo(CL_PROGRAM_BINARIES) of "+this);
}