From 454f81a14da543faebae4c8e6adebb3256a2e646 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 1 May 2011 06:56:02 +0200 Subject: Sync w/ gluegen change 8f8aa3f73e3c9804c4a86f5d4fdac257d50d831a / PointerBuffer's elementSize() is no more static --- src/com/jogamp/opencl/CLCommandQueue.java | 2 +- src/com/jogamp/opencl/CLMemory.java | 2 +- src/com/jogamp/opencl/CLProgram.java | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/com/jogamp/opencl/CLCommandQueue.java b/src/com/jogamp/opencl/CLCommandQueue.java index d24fb115..30757bad 100644 --- a/src/com/jogamp/opencl/CLCommandQueue.java +++ b/src/com/jogamp/opencl/CLCommandQueue.java @@ -74,7 +74,7 @@ public class CLCommandQueue extends CLObject implements CLResource { this.device = device; this.properties = properties; - int pbsize = PointerBuffer.elementSize(); + int pbsize = PointerBuffer.ELEMENT_SIZE; CachedBufferFactory factory = CachedBufferFactory.create(9*pbsize + 4, true); this.ibA = PointerBuffer.wrap(factory.newDirectByteBuffer(3*pbsize)); diff --git a/src/com/jogamp/opencl/CLMemory.java b/src/com/jogamp/opencl/CLMemory.java index 25253803..5b0422ca 100644 --- a/src/com/jogamp/opencl/CLMemory.java +++ b/src/com/jogamp/opencl/CLMemory.java @@ -102,7 +102,7 @@ public abstract class CLMemory extends CLObject implements CL protected static long getSizeImpl(CL cl, long id) { PointerBuffer pb = PointerBuffer.allocateDirect(1); - int ret = cl.clGetMemObjectInfo(id, CL_MEM_SIZE, PointerBuffer.elementSize(), pb.getBuffer(), null); + int ret = cl.clGetMemObjectInfo(id, CL_MEM_SIZE, pb.elementSize(), pb.getBuffer(), null); checkForError(ret, "can not obtain buffer info"); return pb.get(); } diff --git a/src/com/jogamp/opencl/CLProgram.java b/src/com/jogamp/opencl/CLProgram.java index bbae75d9..fd19cd8f 100644 --- a/src/com/jogamp/opencl/CLProgram.java +++ b/src/com/jogamp/opencl/CLProgram.java @@ -101,7 +101,7 @@ public class CLProgram extends CLObject implements CLResource { binarySize += entry.getValue().length; } - int pbSize = PointerBuffer.elementSize(); + int pbSize = PointerBuffer.ELEMENT_SIZE; int deviceCount = binaries.size(); CachedBufferFactory bf = CachedBufferFactory.create(binarySize + pbSize*deviceCount*3 + 4, true); @@ -600,7 +600,7 @@ 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); + int ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARY_SIZES, sizes.capacity()*sizes.elementSize(), sizes.getBuffer(), null); if(ret != CL_SUCCESS) { throw newException(ret, "on clGetProgramInfo(CL_PROGRAM_BINARY_SIZES) of "+this); } @@ -621,7 +621,7 @@ public class CLProgram extends CLObject implements CLResource { 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()*addresses.elementSize(), addresses.getBuffer(), null); if(ret != CL_SUCCESS) { throw newException(ret, "on clGetProgramInfo(CL_PROGRAM_BINARIES) of "+this); } -- cgit v1.2.3 From eceed6e10c7d6cb19e8ad3c1bf5ea20450d6fae1 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 1 May 2011 07:38:16 +0200 Subject: Sync w/ gluegen change 8f8aa3f73e3c9804c4a86f5d4fdac257d50d831a and c5a56e10677e9dc0a048c2be3de16701aac9ad17 --- src/com/jogamp/opencl/CLCommandQueue.java | 2 +- src/com/jogamp/opencl/CLEventList.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/jogamp/opencl/CLCommandQueue.java b/src/com/jogamp/opencl/CLCommandQueue.java index 6ceed82d..ae279fa6 100644 --- a/src/com/jogamp/opencl/CLCommandQueue.java +++ b/src/com/jogamp/opencl/CLCommandQueue.java @@ -1350,7 +1350,7 @@ public class CLCommandQueue extends CLObject implements CLResource { */ public CLCommandQueue putWaitForEvent(CLEventList list, int index, boolean blockingWait) { - PointerBuffer ids = PointerBuffer.wrap(list.IDs.getBuffer().duplicate()).position(index); + PointerBuffer ids = list.IDs.duplicate().position(index); int ret = blockingWait ? cl.clWaitForEvents(1, ids) : cl.clEnqueueWaitForEvents(ID, 1, ids); diff --git a/src/com/jogamp/opencl/CLEventList.java b/src/com/jogamp/opencl/CLEventList.java index e2294b45..1e882221 100644 --- a/src/com/jogamp/opencl/CLEventList.java +++ b/src/com/jogamp/opencl/CLEventList.java @@ -64,13 +64,13 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable Date: Wed, 18 May 2011 04:00:45 +0200 Subject: Synced w/ mbien's JOCL branch - Making it compatible w/ GlueGen again --- resources/cl-if.cfg | 6 +- resources/clImplCustomCode.c | 2 +- src/com/jogamp/opencl/CLBuffer.java | 4 +- src/com/jogamp/opencl/CLCommandQueue.java | 100 ++++++++++++------------ src/com/jogamp/opencl/CLContext.java | 20 ++--- src/com/jogamp/opencl/CLDevice.java | 4 +- src/com/jogamp/opencl/CLEvent.java | 6 +- src/com/jogamp/opencl/CLEventList.java | 10 +-- src/com/jogamp/opencl/CLImage.java | 4 +- src/com/jogamp/opencl/CLInfoAccessor.java | 14 ++-- src/com/jogamp/opencl/CLKernel.java | 4 +- src/com/jogamp/opencl/CLMemory.java | 2 +- src/com/jogamp/opencl/CLPlatform.java | 8 +- src/com/jogamp/opencl/CLProgram.java | 22 +++--- src/com/jogamp/opencl/CLSampler.java | 4 +- src/com/jogamp/opencl/gl/CLGLContext.java | 18 ++--- src/com/jogamp/opencl/impl/CLImpl.java | 38 ++++----- src/com/jogamp/opencl/util/CLBuildListener.java | 2 +- test/com/jogamp/opencl/LowLevelBindingTest.java | 28 +++---- 19 files changed, 148 insertions(+), 148 deletions(-) diff --git a/resources/cl-if.cfg b/resources/cl-if.cfg index aa7de799..f65a417b 100644 --- a/resources/cl-if.cfg +++ b/resources/cl-if.cfg @@ -23,17 +23,17 @@ Ignore CL_GL_.*|cl.*GL.* Ignore clCreateContext CustomJavaCode CL CustomJavaCode CL /** Interface to C language function:
cl_context {@native clCreateContext}(intptr_t * , uint32_t, cl_device_id * , void (*pfn_notify)(const char *, const void *, size_t, void *), void *, int32_t * ); */ -CustomJavaCode CL public long clCreateContext(NativeSizeBuffer properties, NativeSizeBuffer devices, CLErrorHandler pfn_notify, IntBuffer errcode_ret); +CustomJavaCode CL public long clCreateContext(PointerBuffer properties, PointerBuffer devices, CLErrorHandler pfn_notify, IntBuffer errcode_ret); Ignore clCreateContextFromType CustomJavaCode CL CustomJavaCode CL /** Interface to C language function:
cl_context {@native clCreateContextFromType}(cl_context_properties *properties, cl_device_type device_type, void (*pfn_notify)(const char *errinfo, const void *private_info, size_t cb, void *user_data), void *user_data, cl_int *errcode_ret) ; */ -CustomJavaCode CL public long clCreateContextFromType(NativeSizeBuffer properties, long device_type, CLErrorHandler pfn_notify, IntBuffer errcode_ret); +CustomJavaCode CL public long clCreateContextFromType(PointerBuffer properties, long device_type, CLErrorHandler pfn_notify, IntBuffer errcode_ret); Ignore clBuildProgram CustomJavaCode CL CustomJavaCode CL /** Interface to C language function:
int32_t {@native clBuildProgram}(cl_program, uint32_t, cl_device_id * , const char * , void (*pfn_notify)(cl_program, void *user_data), void * ); */ -CustomJavaCode CL public int clBuildProgram(long program, int deviceCount, NativeSizeBuffer devices, String options, BuildProgramCallback cb); +CustomJavaCode CL public int clBuildProgram(long program, int deviceCount, PointerBuffer devices, String options, BuildProgramCallback cb); Ignore clSetEventCallback CustomJavaCode CL diff --git a/resources/clImplCustomCode.c b/resources/clImplCustomCode.c index 789491c6..bdce55a5 100644 --- a/resources/clImplCustomCode.c +++ b/resources/clImplCustomCode.c @@ -299,7 +299,7 @@ Java_com_jogamp_opencl_impl_CLImpl_clBuildProgram0(JNIEnv *env, jobject _unused, /* Java->C glue code: * Java package: com.jogamp.opencl.impl.CLImpl - * Java method: java.nio.ByteBuffer clEnqueueMapImage(long command_queue, long image, int blocking_map, long map_flags, com.jogamp.gluegen.common.nio.NativeSizeBuffer origin, com.jogamp.gluegen.common.nio.NativeSizeBuffer range, com.jogamp.gluegen.common.nio.NativeSizeBuffer image_row_pitch, com.jogamp.gluegen.common.nio.NativeSizeBuffer image_slice_pitch, int num_events_in_wait_list, com.jogamp.gluegen.common.nio.NativeSizeBuffer event_wait_list, com.jogamp.gluegen.common.nio.NativeSizeBuffer event, java.nio.IntBuffer errcode_ret) + * Java method: java.nio.ByteBuffer clEnqueueMapImage(long command_queue, long image, int blocking_map, long map_flags, com.jogamp.gluegen.common.nio.PointerBuffer origin, com.jogamp.gluegen.common.nio.PointerBuffer range, com.jogamp.gluegen.common.nio.PointerBuffer image_row_pitch, com.jogamp.gluegen.common.nio.PointerBuffer image_slice_pitch, int num_events_in_wait_list, com.jogamp.gluegen.common.nio.PointerBuffer event_wait_list, com.jogamp.gluegen.common.nio.PointerBuffer event, java.nio.IntBuffer errcode_ret) * C function: void * clEnqueueMapImage(cl_command_queue command_queue, cl_mem image, uint32_t blocking_map, uint64_t map_flags, const size_t * , const size_t * , size_t * image_row_pitch, size_t * image_slice_pitch, uint32_t num_events_in_wait_list, cl_event * event_wait_list, cl_event * event, int32_t * errcode_ret); */ JNIEXPORT jobject JNICALL diff --git a/src/com/jogamp/opencl/CLBuffer.java b/src/com/jogamp/opencl/CLBuffer.java index 6f00247c..57fba461 100644 --- a/src/com/jogamp/opencl/CLBuffer.java +++ b/src/com/jogamp/opencl/CLBuffer.java @@ -30,7 +30,7 @@ package com.jogamp.opencl; import com.jogamp.common.nio.Buffers; import java.util.List; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.CLMemory.Mem; import java.nio.Buffer; import java.util.ArrayList; @@ -108,7 +108,7 @@ public class CLBuffer extends CLMemory { size *= elemSize; } - NativeSizeBuffer info = NativeSizeBuffer.allocateDirect(2); + PointerBuffer info = PointerBuffer.allocateDirect(2); info.put(offset).put(size).rewind(); int bitset = Mem.flagsToInt(flags); diff --git a/src/com/jogamp/opencl/CLCommandQueue.java b/src/com/jogamp/opencl/CLCommandQueue.java index cbdd59fa..7f3a4292 100644 --- a/src/com/jogamp/opencl/CLCommandQueue.java +++ b/src/com/jogamp/opencl/CLCommandQueue.java @@ -30,7 +30,7 @@ package com.jogamp.opencl; import com.jogamp.common.nio.CachedBufferFactory; import com.jogamp.opencl.gl.CLGLI; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.gl.CLGLObject; import java.nio.Buffer; import java.nio.ByteBuffer; @@ -66,9 +66,9 @@ public class CLCommandQueue extends CLObject implements CLResource { * Those direct memory buffers are used to move data between the JVM and OpenCL. */ private final IntBuffer pbA; - private final NativeSizeBuffer ibA; - private final NativeSizeBuffer ibB; - private final NativeSizeBuffer 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); @@ -79,9 +79,9 @@ public class CLCommandQueue extends CLObject implements CLResource { int pbsize = PointerBuffer.ELEMENT_SIZE; CachedBufferFactory factory = CachedBufferFactory.create(9*pbsize + 4, true); - this.ibA = NativeSizeBuffer.wrap(factory.newDirectByteBuffer(3*pbsize)); - this.ibB = NativeSizeBuffer.wrap(factory.newDirectByteBuffer(3*pbsize)); - this.ibC = NativeSizeBuffer.wrap(factory.newDirectByteBuffer(3*pbsize)); + this.ibA = PointerBuffer.wrap(factory.newDirectByteBuffer(3*pbsize)); + this.ibB = PointerBuffer.wrap(factory.newDirectByteBuffer(3*pbsize)); + this.ibC = PointerBuffer.wrap(factory.newDirectByteBuffer(3*pbsize)); this.pbA = factory.newDirectIntBuffer(1); @@ -117,7 +117,7 @@ public class CLCommandQueue extends CLObject implements CLResource { */ public CLCommandQueue putWriteBuffer(CLBuffer writeBuffer, boolean blockingWrite, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -161,7 +161,7 @@ public class CLCommandQueue extends CLObject implements CLResource { */ public CLCommandQueue putReadBuffer(CLBuffer readBuffer, boolean blockingRead, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -210,7 +210,7 @@ public class CLCommandQueue extends CLObject implements CLResource { */ public CLCommandQueue putCopyBuffer(CLBuffer src, CLBuffer dest, int srcOffset, int destOffset, long bytesToCopy, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -280,7 +280,7 @@ public class CLCommandQueue extends CLObject implements CLResource { long rowPitch, long slicePitch, long hostRowPitch, long hostSlicePitch, boolean blockingWrite, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -358,7 +358,7 @@ public class CLCommandQueue extends CLObject implements CLResource { long rowPitch, long slicePitch, long hostRowPitch, long hostSlicePitch, boolean blockingRead, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -439,7 +439,7 @@ public class CLCommandQueue extends CLObject implements CLResource { long srcRowPitch, long srcSlicePitch, long destRowPitch, long destSlicePitch, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -507,7 +507,7 @@ public class CLCommandQueue extends CLObject implements CLResource { public CLCommandQueue putWriteImage(CLImage2d writeImage, int inputRowPitch, int originX, int originY, int rangeX, int rangeY, boolean blockingWrite, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -569,7 +569,7 @@ public class CLCommandQueue extends CLObject implements CLResource { public CLCommandQueue putWriteImage(CLImage3d writeImage, int inputRowPitch, int inputSlicePitch, int originX, int originY, int originZ, int rangeX, int rangeY, int rangeZ, boolean blockingWrite, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -630,7 +630,7 @@ public class CLCommandQueue extends CLObject implements CLResource { public CLCommandQueue putReadImage(CLImage2d readImage, int inputRowPitch, int originX, int originY, int rangeX, int rangeY, boolean blockingRead, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -692,7 +692,7 @@ public class CLCommandQueue extends CLObject implements CLResource { public CLCommandQueue putReadImage(CLImage3d readImage, int inputRowPitch, int inputSlicePitch, int originX, int originY, int originZ, int rangeX, int rangeY, int rangeZ, boolean blockingRead, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -756,7 +756,7 @@ public class CLCommandQueue extends CLObject implements CLResource { int dstOriginX, int dstOriginY, int rangeX, int rangeY, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -825,7 +825,7 @@ public class CLCommandQueue extends CLObject implements CLResource { int dstOriginX, int dstOriginY, int dstOriginZ, int rangeX, int rangeY, int rangeZ, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -889,7 +889,7 @@ public class CLCommandQueue extends CLObject implements CLResource { long srcOffset, int dstOriginX, int dstOriginY, int rangeX, int rangeY, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -956,7 +956,7 @@ public class CLCommandQueue extends CLObject implements CLResource { long srcOffset, int dstOriginX, int dstOriginY, int dstOriginZ, int rangeX, int rangeY, int rangeZ, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -1020,7 +1020,7 @@ public class CLCommandQueue extends CLObject implements CLResource { int srcOriginX, int srcOriginY, int rangeX, int rangeY, long dstOffset, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -1087,7 +1087,7 @@ public class CLCommandQueue extends CLObject implements CLResource { int srcOriginX, int srcOriginY, int srcOriginZ, int rangeX, int rangeY, int rangeZ, long dstOffset, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -1145,7 +1145,7 @@ public class CLCommandQueue extends CLObject implements CLResource { */ public ByteBuffer putMapBuffer(CLBuffer buffer, CLMemory.Map flag, long offset, long length, boolean blockingMap, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -1205,7 +1205,7 @@ public class CLCommandQueue extends CLObject implements CLResource { int offsetX, int offsetY, int rangeX, int rangeY, boolean blockingMap, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -1271,7 +1271,7 @@ public class CLCommandQueue extends CLObject implements CLResource { int offsetX, int offsetY, int offsetZ, int rangeX, int rangeY, int rangeZ, boolean blockingMap, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -1315,7 +1315,7 @@ public class CLCommandQueue extends CLObject implements CLResource { */ public CLCommandQueue putUnmapMemory(CLMemory memory, Buffer mapped, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -1407,7 +1407,7 @@ public class CLCommandQueue extends CLObject implements CLResource { */ public CLCommandQueue putTask(CLKernel kernel, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -1444,9 +1444,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) { - NativeSizeBuffer globWO = null; - NativeSizeBuffer globWS = null; - NativeSizeBuffer locWS = null; + PointerBuffer globWO = null; + PointerBuffer globWS = null; + PointerBuffer locWS = null; if(globalWorkOffset != 0) { globWO = copy2NIO(ibA, globalWorkOffset); @@ -1495,9 +1495,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) { - NativeSizeBuffer globalWorkOffset = null; - NativeSizeBuffer globalWorkSize = null; - NativeSizeBuffer localWorkSize = null; + PointerBuffer globalWorkOffset = null; + PointerBuffer globalWorkSize = null; + PointerBuffer localWorkSize = null; if(globalWorkOffsetX != 0 || globalWorkOffsetY != 0) { globalWorkOffset = copy2NIO(ibA, globalWorkOffsetX, globalWorkOffsetY); @@ -1545,9 +1545,9 @@ public class CLCommandQueue extends CLObject implements CLResource { public CLCommandQueue put3DRangeKernel(CLKernel kernel, long globalWorkOffsetX, long globalWorkOffsetY, long globalWorkOffsetZ, long globalWorkSizeX, long globalWorkSizeY, long globalWorkSizeZ, long localWorkSizeX, long localWorkSizeY, long localWorkSizeZ, CLEventList condition, CLEventList events) { - NativeSizeBuffer globalWorkOffset = null; - NativeSizeBuffer globalWorkSize = null; - NativeSizeBuffer localWorkSize = null; + PointerBuffer globalWorkOffset = null; + PointerBuffer globalWorkSize = null; + PointerBuffer localWorkSize = null; if(globalWorkOffsetX != 0 || globalWorkOffsetY != 0 || globalWorkOffsetZ != 0) { globalWorkOffset = copy2NIO(ibA, globalWorkOffsetX, globalWorkOffsetY, globalWorkOffsetZ); @@ -1565,7 +1565,7 @@ public class CLCommandQueue extends CLObject implements CLResource { /** * Calls {@native clEnqueueNDRangeKernel}. */ - public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, NativeSizeBuffer globalWorkOffset, NativeSizeBuffer globalWorkSize, NativeSizeBuffer 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; } @@ -1573,7 +1573,7 @@ public class CLCommandQueue extends CLObject implements CLResource { /** * Calls {@native clEnqueueNDRangeKernel}. */ - public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, NativeSizeBuffer globalWorkOffset, NativeSizeBuffer globalWorkSize, NativeSizeBuffer 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; } @@ -1581,10 +1581,10 @@ public class CLCommandQueue extends CLObject implements CLResource { /** * Calls {@native clEnqueueNDRangeKernel}. */ - public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, NativeSizeBuffer globalWorkOffset, - NativeSizeBuffer globalWorkSize, NativeSizeBuffer localWorkSize, CLEventList condition, CLEventList events) { + public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, PointerBuffer globalWorkOffset, + PointerBuffer globalWorkSize, PointerBuffer localWorkSize, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -1657,9 +1657,9 @@ public class CLCommandQueue extends CLObject implements CLResource { /** * Calls {@native clEnqueueAcquireGLObjects}. */ - public CLCommandQueue putAcquireGLObjects(NativeSizeBuffer glObjectIDs, CLEventList condition, CLEventList events) { + public CLCommandQueue putAcquireGLObjects(PointerBuffer glObjectIDs, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -1726,9 +1726,9 @@ public class CLCommandQueue extends CLObject implements CLResource { /** * Calls {@native clEnqueueReleaseGLObjects}. */ - public CLCommandQueue putReleaseGLObjects(NativeSizeBuffer glObjectIDs, CLEventList condition, CLEventList events) { + public CLCommandQueue putReleaseGLObjects(PointerBuffer glObjectIDs, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -1792,19 +1792,19 @@ public class CLCommandQueue extends CLObject implements CLResource { } } - private static NativeSizeBuffer copy2NIO(NativeSizeBuffer buffer, long a) { + private static PointerBuffer copy2NIO(PointerBuffer buffer, long a) { return buffer.put(2, a).position(2); } - private static NativeSizeBuffer copy2NIO(NativeSizeBuffer buffer, long a, long b) { + private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b) { return buffer.position(1).put(a).put(b).position(1); } - private static NativeSizeBuffer copy2NIO(NativeSizeBuffer buffer, long a, long b, long c) { + private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b, long c) { return buffer.rewind().put(a).put(b).put(c).rewind(); } - private static String toStr(NativeSizeBuffer 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 850f6c0e..c8a847a2 100644 --- a/src/com/jogamp/opencl/CLContext.java +++ b/src/com/jogamp/opencl/CLContext.java @@ -32,7 +32,7 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.opencl.CLDevice.Type; import com.jogamp.opencl.CLSampler.AddressingMode; import com.jogamp.opencl.CLSampler.FilteringMode; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.impl.CLImageFormatImpl; import java.io.BufferedReader; import java.io.IOException; @@ -119,7 +119,7 @@ public class CLContext extends CLObject implements CLResource { if (devices == null) { - NativeSizeBuffer deviceCount = NativeSizeBuffer.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"); @@ -170,7 +170,7 @@ public class CLContext extends CLObject implements CLResource { long type = toDeviceBitmap(deviceTypes); - NativeSizeBuffer properties = setupContextProperties(platform); + PointerBuffer properties = setupContextProperties(platform); ErrorDispatcher dispatcher = new ErrorDispatcher(); return new CLContext(platform, createContextFromType(dispatcher, properties, type), dispatcher); } @@ -188,7 +188,7 @@ public class CLContext extends CLObject implements CLResource { CLPlatform platform = devices[0].getPlatform(); - NativeSizeBuffer properties = setupContextProperties(platform); + PointerBuffer properties = setupContextProperties(platform); ErrorDispatcher dispatcher = new ErrorDispatcher(); CLContext context = new CLContext(platform, createContext(dispatcher, properties, devices), dispatcher); if(devices != null) { @@ -199,7 +199,7 @@ public class CLContext extends CLObject implements CLResource { return context; } - protected static long createContextFromType(CLErrorHandler handler, NativeSizeBuffer properties, long deviceType) { + protected static long createContextFromType(CLErrorHandler handler, PointerBuffer properties, long deviceType) { IntBuffer status = newDirectIntBuffer(1); long context = CLPlatform.getLowLevelCLInterface().clCreateContextFromType(properties, deviceType, handler, status); @@ -209,12 +209,12 @@ public class CLContext extends CLObject implements CLResource { return context; } - protected static long createContext(CLErrorHandler handler, NativeSizeBuffer properties, CLDevice... devices) { + protected static long createContext(CLErrorHandler handler, PointerBuffer properties, CLDevice... devices) { IntBuffer status = newDirectIntBuffer(1); - NativeSizeBuffer pb = null; + PointerBuffer pb = null; if(devices != null && devices.length != 0) { - pb = NativeSizeBuffer.allocateDirect(devices.length); + pb = PointerBuffer.allocateDirect(devices.length); for (int i = 0; i < devices.length; i++) { CLDevice device = devices[i]; if(device == null) { @@ -230,13 +230,13 @@ public class CLContext extends CLObject implements CLResource { return context; } - private static NativeSizeBuffer setupContextProperties(CLPlatform platform) { + private static PointerBuffer setupContextProperties(CLPlatform platform) { if(platform == null) { throw new RuntimeException("no OpenCL installation found"); } - return NativeSizeBuffer.allocateDirect(3).put(CL.CL_CONTEXT_PLATFORM) + return PointerBuffer.allocateDirect(3).put(CL.CL_CONTEXT_PLATFORM) .put(platform.ID).put(0) // 0 terminated array .rewind(); } diff --git a/src/com/jogamp/opencl/CLDevice.java b/src/com/jogamp/opencl/CLDevice.java index 0381038e..95f9d1a6 100644 --- a/src/com/jogamp/opencl/CLDevice.java +++ b/src/com/jogamp/opencl/CLDevice.java @@ -29,7 +29,7 @@ package com.jogamp.opencl; import com.jogamp.opencl.util.CLUtil; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; import java.nio.ByteOrder; import java.util.ArrayList; @@ -702,7 +702,7 @@ public final class CLDevice extends CLObject { } @Override - protected int getInfo(int name, long valueSize, Buffer value, NativeSizeBuffer 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 876be3da..4365fd6a 100644 --- a/src/com/jogamp/opencl/CLEvent.java +++ b/src/com/jogamp/opencl/CLEvent.java @@ -29,7 +29,7 @@ package com.jogamp.opencl; import com.jogamp.opencl.impl.CLEventCallback; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; import static com.jogamp.opencl.CL.*; @@ -141,7 +141,7 @@ public class CLEvent extends CLObject implements CLResource { private class CLEventInfoAccessor extends CLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, NativeSizeBuffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return cl.clGetEventInfo(ID, name, valueSize, value, valueSizeRet); } @@ -150,7 +150,7 @@ public class CLEvent extends CLObject implements CLResource { private class CLEventProfilingInfoAccessor extends CLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, NativeSizeBuffer 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/CLEventList.java b/src/com/jogamp/opencl/CLEventList.java index fe6378b7..1e882221 100644 --- a/src/com/jogamp/opencl/CLEventList.java +++ b/src/com/jogamp/opencl/CLEventList.java @@ -30,7 +30,7 @@ package com.jogamp.opencl; import com.jogamp.common.AutoCloseable; import com.jogamp.common.nio.CachedBufferFactory; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import java.util.Iterator; /** @@ -44,12 +44,12 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable extends CLMemory { this.id = id; } @Override - public int getInfo(int name, long valueSize, Buffer value, NativeSizeBuffer 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 08d7305e..b005ec04 100644 --- a/src/com/jogamp/opencl/CLInfoAccessor.java +++ b/src/com/jogamp/opencl/CLInfoAccessor.java @@ -28,7 +28,7 @@ package com.jogamp.opencl; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.common.os.Platform; import com.jogamp.opencl.util.CLUtil; import java.nio.Buffer; @@ -54,11 +54,11 @@ abstract class CLInfoAccessor { } }; - protected final static ThreadLocal localNSB = new ThreadLocal() { + protected final static ThreadLocal localNSB = new ThreadLocal() { @Override - protected NativeSizeBuffer initialValue() { - return NativeSizeBuffer.allocateDirect(1); + protected PointerBuffer initialValue() { + return PointerBuffer.allocateDirect(1); } }; @@ -74,7 +74,7 @@ abstract class CLInfoAccessor { public final String getString(int key) { - NativeSizeBuffer sizeBuffer = getNSB(); + PointerBuffer sizeBuffer = getNSB(); int ret = getInfo(key, 0, null, sizeBuffer); checkForError(ret, "error while asking for info string"); @@ -118,11 +118,11 @@ abstract class CLInfoAccessor { } } - protected NativeSizeBuffer getNSB() { + protected PointerBuffer getNSB() { return localNSB.get(); } - protected abstract int getInfo(int name, long valueSize, Buffer value, NativeSizeBuffer 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 4c898b4b..b2d783ee 100644 --- a/src/com/jogamp/opencl/CLKernel.java +++ b/src/com/jogamp/opencl/CLKernel.java @@ -30,7 +30,7 @@ package com.jogamp.opencl; import com.jogamp.opencl.util.CLUtil; import com.jogamp.common.nio.Buffers; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; import java.nio.ByteBuffer; @@ -73,7 +73,7 @@ public class CLKernel extends CLObject implements CLResource, Cloneable { if(name == null) { // get function name - NativeSizeBuffer size = NativeSizeBuffer.wrap(buffer); + PointerBuffer size = PointerBuffer.wrap(buffer); int ret = cl.clGetKernelInfo(ID, CL_KERNEL_FUNCTION_NAME, 0, null, size); checkForError(ret, "error while asking for kernel function name"); diff --git a/src/com/jogamp/opencl/CLMemory.java b/src/com/jogamp/opencl/CLMemory.java index db64f8a5..a1ca4848 100644 --- a/src/com/jogamp/opencl/CLMemory.java +++ b/src/com/jogamp/opencl/CLMemory.java @@ -30,7 +30,7 @@ package com.jogamp.opencl; import com.jogamp.opencl.gl.CLGLI; import com.jogamp.common.nio.Buffers; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.impl.CLMemObjectDestructorCallback; import java.nio.Buffer; import java.nio.IntBuffer; diff --git a/src/com/jogamp/opencl/CLPlatform.java b/src/com/jogamp/opencl/CLPlatform.java index ee6a6bdf..d9a258c0 100644 --- a/src/com/jogamp/opencl/CLPlatform.java +++ b/src/com/jogamp/opencl/CLPlatform.java @@ -34,7 +34,7 @@ import java.nio.Buffer; import java.security.PrivilegedAction; import com.jogamp.common.JogampRuntimeException; import com.jogamp.common.os.NativeLibrary; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.gluegen.runtime.FunctionAddressResolver; import com.jogamp.opencl.util.CLUtil; import com.jogamp.opencl.impl.CLImpl; @@ -229,7 +229,7 @@ public final class CLPlatform { checkForError(ret, "can not enumerate platforms"); // receive platform ids - NativeSizeBuffer platformId = NativeSizeBuffer.allocateDirect(ib.get(0)); + PointerBuffer platformId = PointerBuffer.allocateDirect(ib.get(0)); ret = cl.clGetPlatformIDs(platformId.capacity(), platformId, null); checkForError(ret, "can not enumerate platforms"); @@ -504,7 +504,7 @@ public final class CLPlatform { } @Override - protected int getInfo(int name, long valueSize, Buffer value, NativeSizeBuffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return cl.clGetPlatformInfo(ID, name, valueSize, value, valueSizeRet); } @@ -520,7 +520,7 @@ public final class CLPlatform { }else{ checkForError(ret, "error while enumerating devices"); - NativeSizeBuffer deviceIDs = NativeSizeBuffer.wrap(getBB(count*NativeSizeBuffer.elementSize())); + PointerBuffer deviceIDs = PointerBuffer.wrap(getBB(count*PointerBuffer.ELEMENT_SIZE)); ret = cl.clGetDeviceIDs(ID, type, count, deviceIDs, null); checkForError(ret, "error while enumerating devices"); diff --git a/src/com/jogamp/opencl/CLProgram.java b/src/com/jogamp/opencl/CLProgram.java index 54d8cc12..53c2e1d9 100644 --- a/src/com/jogamp/opencl/CLProgram.java +++ b/src/com/jogamp/opencl/CLProgram.java @@ -32,7 +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.common.nio.PointerBuffer; import com.jogamp.opencl.impl.BuildProgramCallback; import com.jogamp.opencl.util.CLBuildListener; @@ -78,7 +78,7 @@ public class CLProgram extends CLObject implements CLResource { IntBuffer status = newDirectIntBuffer(1); - NativeSizeBuffer length = NativeSizeBuffer.allocateDirect(1).put(0, src.length()); + PointerBuffer length = PointerBuffer.allocateDirect(1).put(0, src.length()); String[] srcArray = new String[] {src}; // Create the program @@ -106,9 +106,9 @@ public class CLProgram extends CLObject implements CLResource { int deviceCount = binaries.size(); CachedBufferFactory bf = CachedBufferFactory.create(binarySize + pbSize*deviceCount*3 + 4, true); - NativeSizeBuffer devices = NativeSizeBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize)); + PointerBuffer devices = PointerBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize)); PointerBuffer codeBuffers = PointerBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize)); - NativeSizeBuffer lengths = NativeSizeBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize)); + PointerBuffer lengths = PointerBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize)); int i = 0; for (Map.Entry entry : entries) { @@ -165,7 +165,7 @@ public class CLProgram extends CLObject implements CLResource { return ""; } - NativeSizeBuffer size = NativeSizeBuffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); int ret = cl.clGetProgramBuildInfo(ID, device.ID, flag, 0, null, size); if(ret != CL_SUCCESS) { @@ -188,7 +188,7 @@ public class CLProgram extends CLObject implements CLResource { return ""; } - NativeSizeBuffer size = NativeSizeBuffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); int ret = cl.clGetProgramInfo(ID, flag, 0, null, size); checkForError(ret, "on clGetProgramInfo"); @@ -329,10 +329,10 @@ public class CLProgram extends CLObject implements CLResource { releaseKernels(); } - NativeSizeBuffer deviceIDs = null; + PointerBuffer deviceIDs = null; int count = 0; if(devices != null && devices.length != 0) { - deviceIDs = NativeSizeBuffer.allocateDirect(devices.length); + deviceIDs = PointerBuffer.allocateDirect(devices.length); for (int i = 0; i < devices.length; i++) { deviceIDs.put(i, devices[i].ID); } @@ -431,7 +431,7 @@ public class CLProgram extends CLObject implements CLResource { if(numKernels.get(0) > 0) { - NativeSizeBuffer kernelIDs = NativeSizeBuffer.allocateDirect(numKernels.get(0)); + PointerBuffer kernelIDs = PointerBuffer.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); @@ -495,7 +495,7 @@ public class CLProgram extends CLObject implements CLResource { if(released) { return new CLDevice[0]; } - NativeSizeBuffer size = NativeSizeBuffer.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); @@ -620,7 +620,7 @@ public class CLProgram extends CLObject implements CLResource { long address = InternalBufferUtil.getDirectBufferAddress(binaries); - NativeSizeBuffer addresses = NativeSizeBuffer.allocateDirect(sizes.capacity()); + PointerBuffer addresses = PointerBuffer.allocateDirect(sizes.capacity()); sizes.rewind(); while(sizes.remaining() != 0) { addresses.put(address); diff --git a/src/com/jogamp/opencl/CLSampler.java b/src/com/jogamp/opencl/CLSampler.java index f215cab1..73e153d9 100644 --- a/src/com/jogamp/opencl/CLSampler.java +++ b/src/com/jogamp/opencl/CLSampler.java @@ -28,7 +28,7 @@ package com.jogamp.opencl; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; @@ -84,7 +84,7 @@ public class CLSampler extends CLObject implements CLResource { private class CLSamplerInfoAccessor extends CLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, NativeSizeBuffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return cl.clGetSamplerInfo(ID, name, valueSize, value, valueSizeRet); } diff --git a/src/com/jogamp/opencl/gl/CLGLContext.java b/src/com/jogamp/opencl/gl/CLGLContext.java index ee6c2108..5f12d033 100644 --- a/src/com/jogamp/opencl/gl/CLGLContext.java +++ b/src/com/jogamp/opencl/gl/CLGLContext.java @@ -33,7 +33,7 @@ import com.jogamp.opencl.CLDevice; import java.nio.Buffer; import com.jogamp.opencl.CLMemory.Mem; import com.jogamp.opencl.CLPlatform; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import jogamp.opengl.GLContextImpl; import jogamp.opengl.egl.EGLContext; import jogamp.opengl.macosx.cgl.MacOSXCGLContext; @@ -96,7 +96,7 @@ public final class CLGLContext extends CLContext { } long[] glID = new long[1]; - NativeSizeBuffer properties = setupContextProperties(platform, glContext, glID); + PointerBuffer properties = setupContextProperties(platform, glContext, glID); ErrorDispatcher dispatcher = createErrorHandler(); long clID = createContextFromType(dispatcher, properties, toDeviceBitmap(deviceTypes)); @@ -120,7 +120,7 @@ public final class CLGLContext extends CLContext { CLPlatform platform = devices[0].getPlatform(); long[] glID = new long[1]; - NativeSizeBuffer properties = setupContextProperties(platform, glContext, glID); + PointerBuffer properties = setupContextProperties(platform, glContext, glID); ErrorDispatcher dispatcher = createErrorHandler(); long clID = createContext(dispatcher, properties, devices); @@ -134,7 +134,7 @@ public final class CLGLContext extends CLContext { } - private static NativeSizeBuffer setupContextProperties(CLPlatform platform, GLContext glContext, long[] glID) { + private static PointerBuffer setupContextProperties(CLPlatform platform, GLContext glContext, long[] glID) { if(platform == null) { throw new RuntimeException("no OpenCL installation found"); @@ -152,14 +152,14 @@ public final class CLGLContext extends CLContext { GLContextImpl ctxImpl = (GLContextImpl)glContext; glID[0] = glContext.getHandle(); - NativeSizeBuffer properties; + PointerBuffer properties; if(glContext instanceof X11GLXContext) { // spec: "When the GLX binding API is supported, the attribute // CL_GL_CONTEXT_KHR should be set to a GLXContext handle to an // OpenGL context, and the attribute CL_GLX_DISPLAY_KHR should be // set to the Display handle of the X Window System display used to // create the OpenGL context." - properties = NativeSizeBuffer.allocateDirect(7); + properties = PointerBuffer.allocateDirect(7); long displayHandle = ctxImpl.getDrawableImpl().getNativeSurface().getDisplayHandle(); properties.put(CL_GL_CONTEXT_KHR).put(glID[0]) .put(CL_GLX_DISPLAY_KHR).put(displayHandle) @@ -169,7 +169,7 @@ public final class CLGLContext extends CLContext { // CL_GL_CONTEXT_KHR should be set to an HGLRC handle to an OpenGL // context, and the attribute CL_WGL_HDC_KHR should be set to the // HDC handle of the display used to create the OpenGL context." - properties = NativeSizeBuffer.allocateDirect(7); + properties = PointerBuffer.allocateDirect(7); long surfaceHandle = ctxImpl.getDrawableImpl().getNativeSurface().getSurfaceHandle(); properties.put(CL_GL_CONTEXT_KHR).put(glID[0]) .put(CL_WGL_HDC_KHR).put(surfaceHandle) @@ -180,7 +180,7 @@ public final class CLGLContext extends CLContext { // a CGL share group object." long cgl = CGL.getCGLContext(glID[0]); long group = CGL.CGLGetShareGroup(cgl); - properties = NativeSizeBuffer.allocateDirect(5); + properties = PointerBuffer.allocateDirect(5); properties.put(CL_CGL_SHAREGROUP_KHR).put(group) .put(CL_CONTEXT_PLATFORM).put(platform.ID); }else if(glContext instanceof EGLContext) { @@ -190,7 +190,7 @@ public final class CLGLContext extends CLContext { // OpenGL ES or OpenGL context, and the attribute // CL_EGL_DISPLAY_KHR should be set to the EGLDisplay handle of the // display used to create the OpenGL ES or OpenGL context." - properties = NativeSizeBuffer.allocateDirect(7); + properties = PointerBuffer.allocateDirect(7); long displayHandle = ctxImpl.getDrawableImpl().getNativeSurface().getDisplayHandle(); properties.put(CL_GL_CONTEXT_KHR).put(glID[0]) .put(CL_EGL_DISPLAY_KHR).put(displayHandle) diff --git a/src/com/jogamp/opencl/impl/CLImpl.java b/src/com/jogamp/opencl/impl/CLImpl.java index 8ea44201..e7f034af 100644 --- a/src/com/jogamp/opencl/impl/CLImpl.java +++ b/src/com/jogamp/opencl/impl/CLImpl.java @@ -31,7 +31,7 @@ */ package com.jogamp.opencl.impl; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.common.os.Platform; import com.jogamp.common.util.LongLongHashMap; import com.jogamp.opencl.CLErrorHandler; @@ -56,7 +56,7 @@ public class CLImpl extends CLAbstractImpl { this.contextCallbackMap.setKeyNotFoundValue(0); } - public long clCreateContext(NativeSizeBuffer properties, NativeSizeBuffer devices, CLErrorHandler pfn_notify, IntBuffer errcode_ret) { + public long clCreateContext(PointerBuffer properties, PointerBuffer devices, CLErrorHandler pfn_notify, IntBuffer errcode_ret) { if (properties != null && !properties.isDirect()) { throw new RuntimeException("Argument \"properties\" was not a direct buffer"); @@ -87,7 +87,7 @@ public class CLImpl extends CLAbstractImpl { private native long clCreateContext0(Object cl_context_properties, int props_offset, int numDevices, Object devices, int devices_offset, Object pfn_notify, long[] global, Object errcode_ret, int err_offset, long address); - public long clCreateContextFromType(NativeSizeBuffer properties, long device_type, CLErrorHandler pfn_notify, IntBuffer errcode_ret) { + public long clCreateContextFromType(PointerBuffer properties, long device_type, CLErrorHandler pfn_notify, IntBuffer errcode_ret) { if (properties != null && !properties.isDirect()) { throw new RuntimeException("Argument \"properties\" was not a direct buffer"); @@ -134,7 +134,7 @@ public class CLImpl extends CLAbstractImpl { public native int clReleaseContextImpl(long context, long global, long address); /** Interface to C language function:
int32_t clBuildProgram(cl_program, uint32_t, cl_device_id * , const char * , void * ); */ - public int clBuildProgram(long program, int deviceCount, NativeSizeBuffer deviceList, String options, BuildProgramCallback cb) { + public int clBuildProgram(long program, int deviceCount, PointerBuffer deviceList, String options, BuildProgramCallback cb) { if (deviceList != null && !deviceList.isDirect()) { throw new RuntimeException("Argument \"properties\" was not a direct buffer"); @@ -175,18 +175,18 @@ public class CLImpl extends CLAbstractImpl { /** Interface to C language function:
void * {@native clEnqueueMapImage}(cl_command_queue command_queue, cl_mem image, uint32_t blocking_map, uint64_t map_flags, const size_t * , const size_t * , size_t * image_row_pitch, size_t * image_slice_pitch, uint32_t num_events_in_wait_list, cl_event * event_wait_list, cl_event * event, int32_t * errcode_ret); - @param origin a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param range a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param image_row_pitch a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param image_slice_pitch a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param event_wait_list a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param event a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @param origin a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer} + @param range a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer} + @param image_row_pitch a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer} + @param image_slice_pitch a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer} + @param event_wait_list a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer} + @param event a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer} @param errcode_ret a direct {@link java.nio.IntBuffer} */ public ByteBuffer clEnqueueMapImage(long command_queue, long image, int blocking_map, long map_flags, - NativeSizeBuffer origin, NativeSizeBuffer range, - NativeSizeBuffer image_row_pitch, NativeSizeBuffer image_slice_pitch, + PointerBuffer origin, PointerBuffer range, + PointerBuffer image_row_pitch, PointerBuffer image_slice_pitch, int num_events_in_wait_list, - NativeSizeBuffer event_wait_list, NativeSizeBuffer event, IntBuffer errcode_ret) { + PointerBuffer event_wait_list, PointerBuffer event, IntBuffer errcode_ret) { if (origin != null && !origin.isDirect()) { throw new CLException("Argument \"origin\" was not a direct buffer"); @@ -235,12 +235,12 @@ public class CLImpl extends CLAbstractImpl { } /** Entry point to C language function: void * {@native clEnqueueMapImage}(cl_command_queue command_queue, cl_mem image, uint32_t blocking_map, uint64_t map_flags, const size_t * , const size_t * , size_t * image_row_pitch, size_t * image_slice_pitch, uint32_t num_events_in_wait_list, cl_event * event_wait_list, cl_event * event, int32_t * errcode_ret); - @param origin a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param range a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param image_row_pitch a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param image_slice_pitch a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param event_wait_list a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param event a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @param origin a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer} + @param range a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer} + @param image_row_pitch a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer} + @param image_slice_pitch a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer} + @param event_wait_list a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer} + @param event a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer} @param errcode_ret a direct {@link java.nio.IntBuffer} */ private native ByteBuffer clEnqueueMapImage0(long command_queue, long image, int blocking_map, long map_flags, Object origin, int origin_byte_offset, Object range, int range_byte_offset, Object image_row_pitch, diff --git a/src/com/jogamp/opencl/util/CLBuildListener.java b/src/com/jogamp/opencl/util/CLBuildListener.java index 9a520582..cec4d391 100644 --- a/src/com/jogamp/opencl/util/CLBuildListener.java +++ b/src/com/jogamp/opencl/util/CLBuildListener.java @@ -40,7 +40,7 @@ import com.jogamp.opencl.CLProgram; * Note1: registering a build callback can make {@link com.jogamp.opencl.CL#clBuildProgram} non blocking (OpenCL implementation dependent).
* Note2: the thread which calls this method is unspecified. The Application should ensure propper synchronization. * @author Michael Bien - * @see com.jogamp.opencl.CL#clBuildProgram(long, int, com.jogamp.common.nio.NativeSizeBuffer, java.lang.String, com.jogamp.opencl.impl.BuildProgramCallback) + * @see com.jogamp.opencl.CL#clBuildProgram(long, int, com.jogamp.common.nio.PointerBuffer, java.lang.String, com.jogamp.opencl.impl.BuildProgramCallback) */ public interface CLBuildListener { diff --git a/test/com/jogamp/opencl/LowLevelBindingTest.java b/test/com/jogamp/opencl/LowLevelBindingTest.java index 9e603879..43e3b931 100644 --- a/test/com/jogamp/opencl/LowLevelBindingTest.java +++ b/test/com/jogamp/opencl/LowLevelBindingTest.java @@ -30,7 +30,7 @@ package com.jogamp.opencl; import java.util.Random; import com.jogamp.opencl.impl.BuildProgramCallback; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; @@ -109,12 +109,12 @@ public class LowLevelBindingTest { checkForError(ret); out.println("#platforms: "+intBuffer.get(0)); - NativeSizeBuffer platformId = NativeSizeBuffer.allocateDirect(intBuffer.get(0)); + PointerBuffer platformId = PointerBuffer.allocateDirect(intBuffer.get(0)); ret = cl.clGetPlatformIDs(platformId.capacity(), platformId, null); checkForError(ret); // print platform info - NativeSizeBuffer longBuffer = NativeSizeBuffer.allocateDirect(1); + PointerBuffer longBuffer = PointerBuffer.allocateDirect(1); ByteBuffer bb = newDirectByteBuffer(128); for (int i = 0; i < platformId.capacity(); i++) { @@ -143,7 +143,7 @@ public class LowLevelBindingTest { checkForError(ret); out.println("#devices: "+intBuffer.get(0)); - NativeSizeBuffer devices = NativeSizeBuffer.allocateDirect(intBuffer.get(0)); + PointerBuffer devices = PointerBuffer.allocateDirect(intBuffer.get(0)); ret = cl.clGetDeviceIDs(platform, CL.CL_DEVICE_TYPE_ALL, devices.capacity(), devices, null); //print device info @@ -176,7 +176,7 @@ public class LowLevelBindingTest { checkForError(ret); out.println("#platforms: "+intBuffer.get(0)); - NativeSizeBuffer pb = NativeSizeBuffer.allocateDirect(intBuffer.get(0)); + PointerBuffer pb = PointerBuffer.allocateDirect(intBuffer.get(0)); ret = cl.clGetPlatformIDs(pb.capacity(), pb, null); checkForError(ret); @@ -187,14 +187,14 @@ public class LowLevelBindingTest { checkForError(ret); out.println("#devices: "+intBuffer.get(0)); - NativeSizeBuffer devices = NativeSizeBuffer.allocateDirect(intBuffer.get(0)); + PointerBuffer devices = PointerBuffer.allocateDirect(intBuffer.get(0)); ret = cl.clGetDeviceIDs(platform, CL.CL_DEVICE_TYPE_ALL, devices.capacity(), devices, null); long context = cl.clCreateContext(null, devices, null, intBuffer); checkError("on clCreateContext", intBuffer.get()); //get number of devices - NativeSizeBuffer longBuffer = NativeSizeBuffer.allocateDirect(1); + PointerBuffer longBuffer = PointerBuffer.allocateDirect(1); ret = cl.clGetContextInfo(context, CL.CL_CONTEXT_DEVICES, 0, null, longBuffer); checkError("on clGetContextInfo", ret); @@ -223,19 +223,19 @@ public class LowLevelBindingTest { checkForError(ret); assertTrue(intBuffer.get(0) > 0); - NativeSizeBuffer pb = NativeSizeBuffer.allocateDirect(intBuffer.get(0)); + PointerBuffer pb = PointerBuffer.allocateDirect(intBuffer.get(0)); ret = cl.clGetPlatformIDs(pb.capacity(), pb, null); checkForError(ret); long platform = pb.get(0); - NativeSizeBuffer properties = NativeSizeBuffer.allocateDirect(3).put(CL.CL_CONTEXT_PLATFORM) + PointerBuffer properties = PointerBuffer.allocateDirect(3).put(CL.CL_CONTEXT_PLATFORM) .put(platform).put(0) // 0 terminated array .rewind(); long context = cl.clCreateContextFromType(properties, CL.CL_DEVICE_TYPE_ALL, null, null); out.println("context handle: "+context); checkError("on clCreateContextFromType", ret); - NativeSizeBuffer longBuffer = NativeSizeBuffer.allocateDirect(1); + PointerBuffer longBuffer = PointerBuffer.allocateDirect(1); ret = cl.clGetContextInfo(context, CL.CL_CONTEXT_DEVICES, 0, null, longBuffer); checkError("on clGetContextInfo", ret); @@ -284,7 +284,7 @@ public class LowLevelBindingTest { // Create the program - NativeSizeBuffer lengths = NativeSizeBuffer.allocateDirect(1).put(programSource.length()).rewind(); + PointerBuffer lengths = PointerBuffer.allocateDirect(1).put(programSource.length()).rewind(); final long program = cl.clCreateProgramWithSource(context, 1, new String[] {programSource}, lengths, intBuffer); out.println("program id: "+program); checkError("on clCreateProgramWithSource", intBuffer.get(0)); @@ -370,8 +370,8 @@ public class LowLevelBindingTest { checkError("on clEnqueueWriteBuffer", ret); // Launch kernel - NativeSizeBuffer gWS = NativeSizeBuffer.allocateDirect(1).put(globalWorkSize).rewind(); - NativeSizeBuffer lWS = NativeSizeBuffer.allocateDirect(1).put(localWorkSize).rewind(); + PointerBuffer gWS = PointerBuffer.allocateDirect(1).put(globalWorkSize).rewind(); + PointerBuffer lWS = PointerBuffer.allocateDirect(1).put(localWorkSize).rewind(); ret = cl.clEnqueueNDRangeKernel(commandQueue, kernel, 1, null, gWS, lWS, 0, null, null); checkError("on clEnqueueNDRangeKernel", ret); @@ -463,4 +463,4 @@ public class LowLevelBindingTest { } -} \ No newline at end of file +} -- cgit v1.2.3 From 368f062ec9d6bbb89129739adb59cf042dd0bf78 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 18 May 2011 06:02:02 +0200 Subject: Add eclipse project files --- .classpath | 8 ++++++++ .externalToolBuilders/jocl-ant.launch | 15 +++++++++++++++ .project | 22 ++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 .classpath create mode 100644 .externalToolBuilders/jocl-ant.launch create mode 100644 .project diff --git a/.classpath b/.classpath new file mode 100644 index 00000000..49ad63bd --- /dev/null +++ b/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.externalToolBuilders/jocl-ant.launch b/.externalToolBuilders/jocl-ant.launch new file mode 100644 index 00000000..f6b6cd6f --- /dev/null +++ b/.externalToolBuilders/jocl-ant.launch @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 00000000..7059a171 --- /dev/null +++ b/.project @@ -0,0 +1,22 @@ + + + jocl + + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/jocl-ant.launch + + + + + + org.eclipse.jdt.core.javanature + + -- cgit v1.2.3 From 560d4b4958c2838a934fb2008357a7a85e61b546 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 28 Jun 2011 14:13:49 +0200 Subject: main git source location if jogamp --- doc/HowToBuild.html | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/doc/HowToBuild.html b/doc/HowToBuild.html index 04e3e4d6..95c2bfac 100644 --- a/doc/HowToBuild.html +++ b/doc/HowToBuild.html @@ -34,8 +34,8 @@
  • Download JOCL
  • JOCL JavaDoc
  • JOCL Hello World
  • -
  • Code Repository
  • -
  • Demos Repository
  • +
  • Code Repository
  • +
  • Demos Code Repository
  • External References

      @@ -96,19 +96,19 @@
      1. Optain the source code using git: It is important that you checkout the source project side by side to its dependencies:
        -    /home/dude/projects/jogamp> git clone git://github.com/mbien/jocl.git jocl
        +    /home/dude/projects/jogamp> git clone git://jogamp.com/srv/scm/jocl.git jocl
                                     
        Now you should have following directory structure:
             /home/dude/projects/jogamp
             /home/dude/projects/jogamp/gluegen
        -    /home/dude/projects/jogamp/jocl
             /home/dude/projects/jogamp/jogl
        +    /home/dude/projects/jogamp/jocl
                                     
        you can now open the projects with NetBeans or proceed with:
      2. @@ -116,12 +116,9 @@
      3. Build the source tree:
        Open a command shell in the "jocl" directory of the source tree and type "ant jar".
      4. -
      5. Test your build:
        - "ant test" -
      6. - -
      7. Build Javadoc:
        - "ant javadoc" +
      8. Test your build:
        Stay in your command shell in the "jocl" directory of the source tree and type "ant test".
      9. +
      10. Build Javadoc:
        Stay in your command shell in the "jocl" directory of the source tree and type "ant javadoc". + This will produce the end-user documentation for JOCL.
      -- cgit v1.2.3