diff options
Diffstat (limited to 'src/com/jogamp/opencl')
-rw-r--r-- | src/com/jogamp/opencl/CLCommandQueue.java | 47 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLContext.java | 3 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLDevice.java | 4 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLEvent.java | 6 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLImage.java | 4 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLInfoAccessor.java | 12 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLKernel.java | 4 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLPlatform.java | 4 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLProgram.java | 23 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLSampler.java | 4 |
10 files changed, 52 insertions, 59 deletions
diff --git a/src/com/jogamp/opencl/CLCommandQueue.java b/src/com/jogamp/opencl/CLCommandQueue.java index 288e5b00..def422e0 100644 --- a/src/com/jogamp/opencl/CLCommandQueue.java +++ b/src/com/jogamp/opencl/CLCommandQueue.java @@ -1,6 +1,5 @@ package com.jogamp.opencl; -import com.jogamp.common.nio.Int64Buffer; import com.jogamp.opencl.gl.CLGLI; import com.jogamp.common.nio.PointerBuffer; import java.nio.ByteBuffer; @@ -33,9 +32,9 @@ public class CLCommandQueue extends CLObject implements CLResource { * Those direct memory buffers are used to move data between the JVM and OpenCL. */ private final PointerBuffer pbA; - private final Int64Buffer ibA; - private final Int64Buffer ibB; - private final Int64Buffer ibC; + private final PointerBuffer ibA; + private final PointerBuffer ibB; + private final PointerBuffer ibC; private CLCommandQueue(CLContext context, long id, CLDevice device, long properties) { super(context, id); @@ -43,9 +42,9 @@ public class CLCommandQueue extends CLObject implements CLResource { this.device = device; this.properties = properties; - this.ibA = Int64Buffer.allocateDirect(3); - this.ibB = Int64Buffer.allocateDirect(3); - this.ibC = Int64Buffer.allocateDirect(3); + this.ibA = PointerBuffer.allocateDirect(3); + this.ibB = PointerBuffer.allocateDirect(3); + this.ibC = PointerBuffer.allocateDirect(3); this.pbA = PointerBuffer.allocateDirect(1); @@ -1171,9 +1170,9 @@ public class CLCommandQueue extends CLObject implements CLResource { * Calls {@native clEnqueueNDRangeKernel}. */ public CLCommandQueue put1DRangeKernel(CLKernel kernel, long globalWorkOffset, long globalWorkSize, long localWorkSize, CLEventList condition, CLEventList events) { - Int64Buffer globWO = null; - Int64Buffer globWS = null; - Int64Buffer locWS = null; + PointerBuffer globWO = null; + PointerBuffer globWS = null; + PointerBuffer locWS = null; if(globalWorkOffset != 0) { globWO = copy2NIO(ibA, globalWorkOffset); @@ -1222,9 +1221,9 @@ public class CLCommandQueue extends CLObject implements CLResource { public CLCommandQueue put2DRangeKernel(CLKernel kernel, long globalWorkOffsetX, long globalWorkOffsetY, long globalWorkSizeX, long globalWorkSizeY, long localWorkSizeX, long localWorkSizeY, CLEventList condition, CLEventList events) { - Int64Buffer globalWorkOffset = null; - Int64Buffer globalWorkSize = null; - Int64Buffer localWorkSize = null; + PointerBuffer globalWorkOffset = null; + PointerBuffer globalWorkSize = null; + PointerBuffer localWorkSize = null; if(globalWorkOffsetX != 0 && globalWorkOffsetY != 0) { globalWorkOffset = copy2NIO(ibA, globalWorkOffsetX, globalWorkOffsetY); @@ -1242,7 +1241,7 @@ public class CLCommandQueue extends CLObject implements CLResource { /** * Calls {@native clEnqueueNDRangeKernel}. */ - public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, Int64Buffer globalWorkOffset, Int64Buffer globalWorkSize, Int64Buffer localWorkSize) { + public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, PointerBuffer globalWorkOffset, PointerBuffer globalWorkSize, PointerBuffer localWorkSize) { this.putNDRangeKernel(kernel, workDimension, globalWorkOffset, globalWorkSize, localWorkSize, null, null); return this; } @@ -1250,7 +1249,7 @@ public class CLCommandQueue extends CLObject implements CLResource { /** * Calls {@native clEnqueueNDRangeKernel}. */ - public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, Int64Buffer globalWorkOffset, Int64Buffer globalWorkSize, Int64Buffer localWorkSize, CLEventList events) { + public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, PointerBuffer globalWorkOffset, PointerBuffer globalWorkSize, PointerBuffer localWorkSize, CLEventList events) { this.putNDRangeKernel(kernel, workDimension, globalWorkOffset, globalWorkSize, localWorkSize, null, events); return this; } @@ -1258,8 +1257,8 @@ public class CLCommandQueue extends CLObject implements CLResource { /** * Calls {@native clEnqueueNDRangeKernel}. */ - public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, Int64Buffer globalWorkOffset, - Int64Buffer globalWorkSize, Int64Buffer localWorkSize, CLEventList condition, CLEventList events) { + public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, PointerBuffer globalWorkOffset, + PointerBuffer globalWorkSize, PointerBuffer localWorkSize, CLEventList condition, CLEventList events) { PointerBuffer conditionIDs = null; int conditions = 0; @@ -1439,19 +1438,15 @@ public class CLCommandQueue extends CLObject implements CLResource { // return buffer.rewind().put(a).put(b).put(c).rewind(); // } - private static Int64Buffer copy2NIO(Int64Buffer buffer, long a) { - return (Int64Buffer) buffer.put(2, a).position(2); + private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b) { + return (PointerBuffer) ((PointerBuffer)buffer.position(1)).put(a).put(b).position(1); } - private static Int64Buffer copy2NIO(Int64Buffer buffer, long a, long b) { - return (Int64Buffer) ((Int64Buffer)buffer.position(1)).put(a).put(b).position(1); + private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b, long c) { + return (PointerBuffer) ((PointerBuffer)buffer.rewind()).put(a).put(b).put(c).rewind(); } - private static Int64Buffer copy2NIO(Int64Buffer buffer, long a, long b, long c) { - return (Int64Buffer) ((Int64Buffer)buffer.rewind()).put(a).put(b).put(c).rewind(); - } - - private static String toStr(Int64Buffer buffer) { + private static String toStr(PointerBuffer buffer) { if(buffer == null) { return null; } diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java index b200e3a5..72694d61 100644 --- a/src/com/jogamp/opencl/CLContext.java +++ b/src/com/jogamp/opencl/CLContext.java @@ -4,7 +4,6 @@ import com.jogamp.opencl.CLDevice.Type; import com.jogamp.opencl.CLMemory.Mem; import com.jogamp.opencl.CLSampler.AddressingMode; import com.jogamp.opencl.CLSampler.FilteringMode; -import com.jogamp.common.nio.Int64Buffer; import com.jogamp.common.nio.PointerBuffer; import java.io.BufferedReader; import java.io.IOException; @@ -72,7 +71,7 @@ public class CLContext extends CLObject implements CLResource { if (devices == null) { - Int64Buffer deviceCount = Int64Buffer.allocateDirect(1); + PointerBuffer deviceCount = PointerBuffer.allocateDirect(1); int ret = cl.clGetContextInfo(ID, CL.CL_CONTEXT_DEVICES, 0, null, deviceCount); checkForError(ret, "can not enumerate devices"); diff --git a/src/com/jogamp/opencl/CLDevice.java b/src/com/jogamp/opencl/CLDevice.java index 3b26e507..99ef3fe9 100644 --- a/src/com/jogamp/opencl/CLDevice.java +++ b/src/com/jogamp/opencl/CLDevice.java @@ -1,7 +1,7 @@ package com.jogamp.opencl; import com.jogamp.opencl.util.CLUtil; -import com.jogamp.common.nio.Int64Buffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.common.os.Platform; import java.nio.Buffer; import java.nio.ByteBuffer; @@ -516,7 +516,7 @@ public final class CLDevice extends CLObject { private final class CLDeviceInfoAccessor extends CLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, Int64Buffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return cl.clGetDeviceInfo(ID, name, valueSize, value, valueSizeRet); } diff --git a/src/com/jogamp/opencl/CLEvent.java b/src/com/jogamp/opencl/CLEvent.java index 46b92a6d..bf4ac690 100644 --- a/src/com/jogamp/opencl/CLEvent.java +++ b/src/com/jogamp/opencl/CLEvent.java @@ -1,6 +1,6 @@ package com.jogamp.opencl; -import com.jogamp.common.nio.Int64Buffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; import static com.jogamp.opencl.CL.*; @@ -93,7 +93,7 @@ public class CLEvent extends CLObject implements CLResource { private class CLEventInfoAccessor extends CLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, Int64Buffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return cl.clGetEventInfo(ID, name, valueSize, value, valueSizeRet); } @@ -102,7 +102,7 @@ public class CLEvent extends CLObject implements CLResource { private class CLEventProfilingInfoAccessor extends CLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, Int64Buffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return cl.clGetEventProfilingInfo(ID, name, valueSize, value, valueSizeRet); } diff --git a/src/com/jogamp/opencl/CLImage.java b/src/com/jogamp/opencl/CLImage.java index f8916fdb..cc1eb59e 100644 --- a/src/com/jogamp/opencl/CLImage.java +++ b/src/com/jogamp/opencl/CLImage.java @@ -1,6 +1,6 @@ package com.jogamp.opencl; -import com.jogamp.common.nio.Int64Buffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; import static com.jogamp.opencl.CL.*; @@ -81,7 +81,7 @@ public abstract class CLImage<B extends Buffer> extends CLMemory<B> { this.id = id; } @Override - public int getInfo(int name, long valueSize, Buffer value, Int64Buffer valueSizeRet) { + public int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return cl.clGetImageInfo(id, name, valueSize, value, valueSizeRet); } } diff --git a/src/com/jogamp/opencl/CLInfoAccessor.java b/src/com/jogamp/opencl/CLInfoAccessor.java index 56f2318d..8db06d38 100644 --- a/src/com/jogamp/opencl/CLInfoAccessor.java +++ b/src/com/jogamp/opencl/CLInfoAccessor.java @@ -1,7 +1,7 @@ package com.jogamp.opencl; import com.jogamp.common.nio.Buffers; -import com.jogamp.common.nio.Int64Buffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.util.CLUtil; import java.nio.Buffer; import java.nio.ByteBuffer; @@ -23,11 +23,11 @@ abstract class CLInfoAccessor { } }; - protected final static ThreadLocal<Int64Buffer> localPB = new ThreadLocal<Int64Buffer>() { + protected final static ThreadLocal<PointerBuffer> localPB = new ThreadLocal<PointerBuffer>() { @Override - protected Int64Buffer initialValue() { - return Int64Buffer.allocateDirect(1); + protected PointerBuffer initialValue() { + return PointerBuffer.allocateDirect(1); } }; @@ -44,7 +44,7 @@ abstract class CLInfoAccessor { public final String getString(int key) { ByteBuffer buffer = localBB.get(); - Int64Buffer sizeBuffer = localPB.get(); + PointerBuffer sizeBuffer = localPB.get(); int ret = getInfo(key, buffer.capacity(), buffer, sizeBuffer); checkForError(ret, "error while asking for info string"); @@ -56,7 +56,7 @@ abstract class CLInfoAccessor { } - protected abstract int getInfo(int name, long valueSize, Buffer value, Int64Buffer valueSizeRet); + protected abstract int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet); } diff --git a/src/com/jogamp/opencl/CLKernel.java b/src/com/jogamp/opencl/CLKernel.java index f3a8684f..8fa000dc 100644 --- a/src/com/jogamp/opencl/CLKernel.java +++ b/src/com/jogamp/opencl/CLKernel.java @@ -2,7 +2,7 @@ package com.jogamp.opencl; import com.jogamp.opencl.util.CLUtil; import com.jogamp.common.nio.Buffers; -import com.jogamp.common.nio.Int64Buffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -39,7 +39,7 @@ public class CLKernel extends CLObject implements CLResource, Cloneable { this.program = program; this.buffer = Buffers.newDirectByteBuffer((is32Bit()?4:8)*3); - Int64Buffer size = Int64Buffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); // get function name int ret = cl.clGetKernelInfo(ID, CL_KERNEL_FUNCTION_NAME, 0, null, size); diff --git a/src/com/jogamp/opencl/CLPlatform.java b/src/com/jogamp/opencl/CLPlatform.java index e2ece1ef..60eb2db0 100644 --- a/src/com/jogamp/opencl/CLPlatform.java +++ b/src/com/jogamp/opencl/CLPlatform.java @@ -45,7 +45,7 @@ public final class CLPlatform { static{ try { -// new UnixDynamicLinkerImpl().openLibraryGlobal("/usr/lib/jvm/java-6-sun/jre/lib/amd64/lbjsig.so", true); +// new UnixDynamicLinkerImpl().openLibraryGlobal("/usr/lib/jvm/java-6-sun/jre/lib/amd64/libjsig.so", true); // run the whole static initialization privileged to speed up, // since this skips checking further access @@ -283,7 +283,7 @@ public final class CLPlatform { * Returns a info string in exchange for a key (CL_PLATFORM_*). */ public String getInfoString(int key) { - Int64Buffer size = Int64Buffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); // TODO use cache/query size ByteBuffer bb = ByteBuffer.allocateDirect(512); diff --git a/src/com/jogamp/opencl/CLProgram.java b/src/com/jogamp/opencl/CLProgram.java index 7ccc3bc8..c56c04c9 100644 --- a/src/com/jogamp/opencl/CLProgram.java +++ b/src/com/jogamp/opencl/CLProgram.java @@ -2,7 +2,6 @@ package com.jogamp.opencl; import com.jogamp.opencl.util.CLProgramConfiguration; import com.jogamp.opencl.util.CLUtil; -import com.jogamp.common.nio.Int64Buffer; import com.jogamp.common.os.Platform; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.impl.BuildProgramCallback; @@ -49,7 +48,7 @@ public class CLProgram extends CLObject implements CLResource { IntBuffer status = newDirectByteBuffer(4).asIntBuffer(); // Create the program long id = context.cl.clCreateProgramWithSource(context.ID, 1, new String[] {src}, - (Int64Buffer)Int64Buffer.allocateDirect(1).put(src.length()), status); + (PointerBuffer)PointerBuffer.allocateDirect(1).put(src.length()), status); int err = status.get(); if(err != CL_SUCCESS) { @@ -63,7 +62,7 @@ public class CLProgram extends CLObject implements CLResource { PointerBuffer devices = PointerBuffer.allocateDirect(binaries.size()); PointerBuffer codeBuffers = PointerBuffer.allocateDirect(binaries.size()); - Int64Buffer lengths = Int64Buffer.allocateDirect(binaries.size()); + PointerBuffer lengths = PointerBuffer.allocateDirect(binaries.size()); int i = 0; Set<CLDevice> keys = binaries.keySet(); @@ -120,7 +119,7 @@ public class CLProgram extends CLObject implements CLResource { return ""; } - Int64Buffer size = Int64Buffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); int ret = cl.clGetProgramBuildInfo(ID, device.ID, flag, 0, null, size); if(ret != CL_SUCCESS) { @@ -143,7 +142,7 @@ public class CLProgram extends CLObject implements CLResource { return ""; } - Int64Buffer size = Int64Buffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); int ret = cl.clGetProgramInfo(ID, flag, 0, null, size); checkForError(ret, "on clGetProgramInfo"); @@ -462,7 +461,7 @@ public class CLProgram extends CLObject implements CLResource { if(released) { return new CLDevice[0]; } - Int64Buffer size = Int64Buffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); int ret = cl.clGetProgramInfo(ID, CL_PROGRAM_DEVICES, 0, null, size); if(ret != CL_SUCCESS) { throw newException(ret, "on clGetProgramInfo of "+this); @@ -567,15 +566,15 @@ public class CLProgram extends CLObject implements CLResource { CLDevice[] devices = getCLDevices(); - ByteBuffer sizes = newDirectByteBuffer(8*devices.length); - int ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARY_SIZES, sizes.capacity(), sizes, null); + PointerBuffer sizes = PointerBuffer.allocateDirect(devices.length); + int ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARY_SIZES, sizes.capacity()*PointerBuffer.elementSize(), sizes.getBuffer(), null); if(ret != CL_SUCCESS) { throw newException(ret, "on clGetProgramInfo(CL_PROGRAM_BINARY_SIZES) of "+this); } int binariesSize = 0; while(sizes.remaining() != 0) { - int size = (int) sizes.getLong(); + int size = (int) sizes.get(); binariesSize += size; } ByteBuffer binaries = newDirectByteBuffer(binariesSize); @@ -586,10 +585,10 @@ public class CLProgram extends CLObject implements CLResource { sizes.rewind(); while(sizes.remaining() != 0) { addresses.put(address); - address += sizes.getLong(); + address += sizes.get(); } - ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARIES, addresses.capacity(), addresses.getBuffer(), null); + ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARIES, addresses.capacity()*PointerBuffer.elementSize(), addresses.getBuffer(), null); if(ret != CL_SUCCESS) { throw newException(ret, "on clGetProgramInfo(CL_PROGRAM_BINARIES) of "+this); } @@ -597,7 +596,7 @@ public class CLProgram extends CLObject implements CLResource { Map<CLDevice, byte[]> map = new LinkedHashMap<CLDevice, byte[]>(); sizes.rewind(); for (int i = 0; i < devices.length; i++) { - byte[] bytes = new byte[(int)sizes.getLong()]; + byte[] bytes = new byte[(int)sizes.get()]; binaries.get(bytes); map.put(devices[i], bytes); } diff --git a/src/com/jogamp/opencl/CLSampler.java b/src/com/jogamp/opencl/CLSampler.java index 5f6a9485..cd5001bf 100644 --- a/src/com/jogamp/opencl/CLSampler.java +++ b/src/com/jogamp/opencl/CLSampler.java @@ -1,6 +1,6 @@ package com.jogamp.opencl; -import com.jogamp.common.nio.Int64Buffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; @@ -60,7 +60,7 @@ public class CLSampler extends CLObject implements CLResource { private class CLSamplerInfoAccessor extends CLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, Int64Buffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return cl.clGetSamplerInfo(ID, name, valueSize, value, valueSizeRet); } |