diff options
Diffstat (limited to 'src/com/jogamp')
-rw-r--r-- | src/com/jogamp/opencl/CLBuffer.java | 4 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLCommandQueue.java | 110 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLContext.java | 23 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLDevice.java | 2 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLEvent.java | 6 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLEventList.java | 24 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLImage.java | 6 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLKernel.java | 4 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLMemory.java | 8 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLPlatform.java | 6 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLProgram.java | 29 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLSampler.java | 6 | ||||
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLContext.java | 18 | ||||
-rw-r--r-- | src/com/jogamp/opencl/impl/CLTLAccessorFactory.java | 8 | ||||
-rw-r--r-- | src/com/jogamp/opencl/impl/CLTLInfoAccessor.java | 16 | ||||
-rw-r--r-- | src/com/jogamp/opencl/llb/impl/CLImpl.java | 40 | ||||
-rw-r--r-- | src/com/jogamp/opencl/util/CLBuildListener.java | 2 |
17 files changed, 153 insertions, 159 deletions
diff --git a/src/com/jogamp/opencl/CLBuffer.java b/src/com/jogamp/opencl/CLBuffer.java index 03e07477..99721413 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 com.jogamp.opencl.llb.CL; import com.jogamp.opencl.llb.CLBufferBinding; @@ -109,7 +109,7 @@ public class CLBuffer<B extends Buffer> extends CLMemory<B> { 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 b1644cf2..eedb0bd4 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.llb.gl.CLGL; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.gl.CLGLObject; import com.jogamp.opencl.llb.CLCommandQueueBinding; import java.nio.Buffer; @@ -68,9 +68,9 @@ public class CLCommandQueue extends CLObjectResource { * 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,13 +79,13 @@ public class CLCommandQueue extends CLObjectResource { this.properties = properties; this.cl = context.getPlatform().getCommandQueueBinding(); - int pbsize = NativeSizeBuffer.elementSize(); + 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); } @@ -121,7 +121,7 @@ public class CLCommandQueue extends CLObjectResource { */ 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; @@ -165,7 +165,7 @@ public class CLCommandQueue extends CLObjectResource { */ 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; @@ -214,7 +214,7 @@ public class CLCommandQueue extends CLObjectResource { */ 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; @@ -284,7 +284,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -362,7 +362,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -443,7 +443,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -511,7 +511,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -573,7 +573,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -634,7 +634,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -696,7 +696,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -760,7 +760,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -829,7 +829,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -893,7 +893,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -960,7 +960,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -1024,7 +1024,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -1091,7 +1091,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -1149,7 +1149,7 @@ public class CLCommandQueue extends CLObjectResource { */ 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; @@ -1209,7 +1209,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -1275,7 +1275,7 @@ public class CLCommandQueue extends CLObjectResource { 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; @@ -1319,7 +1319,7 @@ public class CLCommandQueue extends CLObjectResource { */ 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; @@ -1357,8 +1357,8 @@ public class CLCommandQueue extends CLObjectResource { if(blockingWait) { list.waitForEvent(index); - }else{ - NativeSizeBuffer ids = list.getEventBuffer(index); + } else { + PointerBuffer ids = list.getEventBuffer(index); int ret = cl.clEnqueueWaitForEvents(ID, 1, ids); if(ret != CL_SUCCESS) { throw newException(ret, "can not "+ (blockingWait?"blocking": "") +" wait for event #" + index+ " in "+list); @@ -1418,7 +1418,7 @@ public class CLCommandQueue extends CLObjectResource { */ public CLCommandQueue putTask(CLKernel kernel, CLEventList condition, CLEventList events) { - NativeSizeBuffer conditionIDs = null; + PointerBuffer conditionIDs = null; int conditions = 0; if(condition != null) { conditionIDs = condition.IDsView; @@ -1455,9 +1455,9 @@ public class CLCommandQueue extends CLObjectResource { * 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); @@ -1506,9 +1506,9 @@ public class CLCommandQueue extends CLObjectResource { 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); @@ -1556,9 +1556,9 @@ public class CLCommandQueue extends CLObjectResource { 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); @@ -1576,7 +1576,7 @@ public class CLCommandQueue extends CLObjectResource { /** * 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; } @@ -1584,7 +1584,7 @@ public class CLCommandQueue extends CLObjectResource { /** * 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; } @@ -1592,10 +1592,10 @@ public class CLCommandQueue extends CLObjectResource { /** * 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; @@ -1668,9 +1668,9 @@ public class CLCommandQueue extends CLObjectResource { /** * 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; @@ -1737,9 +1737,9 @@ public class CLCommandQueue extends CLObjectResource { /** * 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; @@ -1805,19 +1805,19 @@ public class CLCommandQueue extends CLObjectResource { } } - 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 a901de4f..7073e5d3 100644 --- a/src/com/jogamp/opencl/CLContext.java +++ b/src/com/jogamp/opencl/CLContext.java @@ -33,7 +33,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.llb.CLContextBinding; import com.jogamp.opencl.llb.impl.CLImageFormatImpl; import java.io.BufferedReader; @@ -121,7 +121,7 @@ public class CLContext extends CLObjectResource { if (devices == null) { - NativeSizeBuffer deviceCount = NativeSizeBuffer.allocateDirect(1); + PointerBuffer deviceCount = PointerBuffer.allocateDirect(1); int ret = cl.clGetContextInfo(ID, CL_CONTEXT_DEVICES, 0, null, deviceCount); checkForError(ret, "can not enumerate devices"); @@ -172,7 +172,7 @@ public class CLContext extends CLObjectResource { long type = toDeviceBitmap(deviceTypes); - NativeSizeBuffer properties = setupContextProperties(platform); + PointerBuffer properties = setupContextProperties(platform); ErrorDispatcher dispatcher = new ErrorDispatcher(); return new CLContext(platform, createContextFromType(platform, dispatcher, properties, type), dispatcher); } @@ -190,7 +190,7 @@ public class CLContext extends CLObjectResource { CLPlatform platform = devices[0].getPlatform(); - NativeSizeBuffer properties = setupContextProperties(platform); + PointerBuffer properties = setupContextProperties(platform); ErrorDispatcher dispatcher = new ErrorDispatcher(); CLContext context = new CLContext(platform, createContext(platform, dispatcher, properties, devices), dispatcher); if(devices != null) { @@ -201,8 +201,7 @@ public class CLContext extends CLObjectResource { return context; } - protected static long createContextFromType(CLPlatform platform, CLErrorHandler handler, NativeSizeBuffer properties, long deviceType) { - + protected static long createContextFromType(CLPlatform platform, CLErrorHandler handler, PointerBuffer properties, long deviceType) { IntBuffer status = newDirectIntBuffer(1); CLContextBinding cl = platform.getContextBinding(); long context = cl.clCreateContextFromType(properties, deviceType, handler, status); @@ -212,12 +211,11 @@ public class CLContext extends CLObjectResource { return context; } - protected static long createContext(CLPlatform platform, CLErrorHandler handler, NativeSizeBuffer properties, CLDevice... devices) { - + protected static long createContext(CLPlatform platform, 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) { @@ -234,13 +232,12 @@ public class CLContext extends CLObjectResource { 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_CONTEXT_PLATFORM) + return PointerBuffer.allocateDirect(3).put(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 4705d482..b47deb2b 100644 --- a/src/com/jogamp/opencl/CLDevice.java +++ b/src/com/jogamp/opencl/CLDevice.java @@ -1,5 +1,5 @@ /* - * Copyright 2009 - 2010 JogAmp Community. All rights reserved. + * Copyright (c) 2009 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: diff --git a/src/com/jogamp/opencl/CLEvent.java b/src/com/jogamp/opencl/CLEvent.java index 78f7d3dc..d1bfeffc 100644 --- a/src/com/jogamp/opencl/CLEvent.java +++ b/src/com/jogamp/opencl/CLEvent.java @@ -31,7 +31,7 @@ package com.jogamp.opencl; import com.jogamp.opencl.impl.CLTLInfoAccessor; import com.jogamp.opencl.llb.CLEventBinding; import com.jogamp.opencl.llb.impl.CLEventCallback; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; import static com.jogamp.opencl.llb.CL.*; @@ -147,7 +147,7 @@ public class CLEvent extends CLObjectResource { private class CLEventInfoAccessor extends CLTLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, NativeSizeBuffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return binding.clGetEventInfo(ID, name, valueSize, value, valueSizeRet); } @@ -156,7 +156,7 @@ public class CLEvent extends CLObjectResource { private class CLEventProfilingInfoAccessor extends CLTLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, NativeSizeBuffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return binding.clGetEventProfilingInfo(ID, name, valueSize, value, valueSizeRet); } diff --git a/src/com/jogamp/opencl/CLEventList.java b/src/com/jogamp/opencl/CLEventList.java index e8d697b1..53136e2a 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<CL /** * stores event ids for fast access. */ - final NativeSizeBuffer IDs; + final PointerBuffer IDs; /** * Points always to the first element of the id buffer. */ - final NativeSizeBuffer IDsView; + final PointerBuffer IDsView; int size; @@ -64,13 +64,13 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL public CLEventList(CachedBufferFactory factory, int capacity) { this.events = new CLEvent[capacity]; this.IDs = initIDBuffer(factory, capacity); - this.IDsView = NativeSizeBuffer.wrap(IDs.getBuffer().duplicate()); + this.IDsView = IDs.duplicate(); } public CLEventList(CachedBufferFactory factory, CLEvent... events) { this.events = events; this.IDs = initIDBuffer(factory, events.length); - this.IDsView = NativeSizeBuffer.wrap(IDs.getBuffer().duplicate()); + this.IDsView = IDs.duplicate(); for (CLEvent event : events) { if(event == null) { @@ -82,11 +82,11 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL size = events.length; } - private NativeSizeBuffer initIDBuffer(CachedBufferFactory factory, int size) { + private PointerBuffer initIDBuffer(CachedBufferFactory factory, int size) { if(factory == null) { - return NativeSizeBuffer.allocateDirect(size); + return PointerBuffer.allocateDirect(size); }else{ - return NativeSizeBuffer.wrap(factory.newDirectByteBuffer(size*NativeSizeBuffer.elementSize())); + return PointerBuffer.wrap(factory.newDirectByteBuffer(size*PointerBuffer.ELEMENT_SIZE)); } } @@ -99,8 +99,8 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL size++; } - NativeSizeBuffer getEventBuffer(int index) { - return NativeSizeBuffer.wrap(IDs.getBuffer().duplicate()).position(index); + PointerBuffer getEventBuffer(int index) { + return IDs.duplicate(); } /** @@ -122,7 +122,7 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL throw new IndexOutOfBoundsException("args: [start: "+start+" range: "+range+"], eventcount: "+size); } - NativeSizeBuffer view = getEventBuffer(start); + final PointerBuffer view = getEventBuffer(start); getEvent(start).getPlatform().getEventBinding().clWaitForEvents(range, view); } @@ -130,7 +130,7 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL * Waits for the event with the given index in this list to occur. */ public void waitForEvent(int index) { - NativeSizeBuffer view = getEventBuffer(index); + final PointerBuffer view = getEventBuffer(index); getEvent(index).getPlatform().getEventBinding().clWaitForEvents(1, view); } diff --git a/src/com/jogamp/opencl/CLImage.java b/src/com/jogamp/opencl/CLImage.java index 09b92b00..e2daff9c 100644 --- a/src/com/jogamp/opencl/CLImage.java +++ b/src/com/jogamp/opencl/CLImage.java @@ -1,5 +1,5 @@ /* - * Copyright 2009 - 2010 JogAmp Community. All rights reserved. + * Copyright (c) 2009 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -28,8 +28,8 @@ package com.jogamp.opencl; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.impl.CLTLInfoAccessor; -import com.jogamp.common.nio.NativeSizeBuffer; import com.jogamp.opencl.llb.CLImageBinding; import java.nio.Buffer; @@ -116,7 +116,7 @@ public abstract class CLImage<B extends Buffer> extends CLMemory<B> { 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/CLKernel.java b/src/com/jogamp/opencl/CLKernel.java index 8a3a44b9..135174c4 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 com.jogamp.opencl.llb.CLKernelBinding; import java.nio.Buffer; import java.nio.ByteBuffer; @@ -77,7 +77,7 @@ public class CLKernel extends CLObjectResource implements Cloneable { if(name == null) { // get function name - NativeSizeBuffer size = NativeSizeBuffer.wrap(buffer); + PointerBuffer size = PointerBuffer.wrap(buffer); int ret = binding.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 0edfb7e2..281d042f 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.llb.CLMemObjBinding; import com.jogamp.common.nio.Buffers; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.llb.CL; import com.jogamp.opencl.llb.impl.CLMemObjectDestructorCallback; import java.nio.Buffer; @@ -90,9 +90,9 @@ public abstract class CLMemory <B extends Buffer> extends CLObjectResource { } protected static long getSizeImpl(CLContext context, long id) { - NativeSizeBuffer pb = NativeSizeBuffer.allocateDirect(1); - CLMemObjBinding binding = context.getPlatform().getMemObjectBinding(); - int ret = binding.clGetMemObjectInfo(id, CL_MEM_SIZE, NativeSizeBuffer.elementSize(), pb.getBuffer(), null); + PointerBuffer pb = PointerBuffer.allocateDirect(1); + CLMemObjBinding binding = context.getPlatform().getMemObjectBinding(); // FIXME: CL separation makes this pretty complicated ! + int ret = binding.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/CLPlatform.java b/src/com/jogamp/opencl/CLPlatform.java index 9e5308f9..bd93caa3 100644 --- a/src/com/jogamp/opencl/CLPlatform.java +++ b/src/com/jogamp/opencl/CLPlatform.java @@ -1,5 +1,5 @@ /* - * Copyright 2009 - 2010 JogAmp Community. All rights reserved. + * Copyright (c) 2009 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -39,7 +39,7 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.common.os.DynamicLookupHelper; 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.llb.CLBufferBinding; import com.jogamp.opencl.llb.CLCommandQueueBinding; @@ -274,7 +274,7 @@ public 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"); diff --git a/src/com/jogamp/opencl/CLProgram.java b/src/com/jogamp/opencl/CLProgram.java index ce844bf8..d373d5d3 100644 --- a/src/com/jogamp/opencl/CLProgram.java +++ b/src/com/jogamp/opencl/CLProgram.java @@ -33,7 +33,6 @@ import com.jogamp.opencl.llb.CLProgramBinding; 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.llb.CLKernelBinding; import com.jogamp.opencl.llb.impl.BuildProgramCallback; @@ -82,7 +81,7 @@ public class CLProgram extends CLObjectResource { 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 @@ -107,13 +106,13 @@ public class CLProgram extends CLObjectResource { binarySize += entry.getValue().length; } - int pbSize = NativeSizeBuffer.elementSize(); + int pbSize = PointerBuffer.ELEMENT_SIZE; 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<CLDevice, byte[]> entry : entries) { @@ -171,7 +170,7 @@ public class CLProgram extends CLObjectResource { return ""; } - NativeSizeBuffer size = NativeSizeBuffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); int ret = binding.clGetProgramBuildInfo(ID, device.ID, flag, 0, null, size); if(ret != CL_SUCCESS) { @@ -194,7 +193,7 @@ public class CLProgram extends CLObjectResource { return ""; } - NativeSizeBuffer size = NativeSizeBuffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); int ret = binding.clGetProgramInfo(ID, flag, 0, null, size); checkForError(ret, "on clGetProgramInfo"); @@ -338,10 +337,10 @@ public class CLProgram extends CLObjectResource { 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); } @@ -441,7 +440,7 @@ public class CLProgram extends CLObjectResource { if(numKernels.get(0) > 0) { - NativeSizeBuffer kernelIDs = NativeSizeBuffer.allocateDirect(numKernels.get(0)); + PointerBuffer kernelIDs = PointerBuffer.allocateDirect(numKernels.get(0)); ret = kernelBinding.clCreateKernelsInProgram(ID, kernelIDs.capacity(), kernelIDs, null); if(ret != CL_SUCCESS) { throw newException(ret, "can not create "+kernelIDs.capacity()+" kernels for "+this); @@ -507,7 +506,7 @@ public class CLProgram extends CLObjectResource { return new CLDevice[0]; } - NativeSizeBuffer size = NativeSizeBuffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); int ret = binding.clGetProgramInfo(ID, CL_PROGRAM_DEVICES, 0, null, size); if(ret != CL_SUCCESS) { throw newException(ret, "on clGetProgramInfo of "+this); @@ -617,8 +616,8 @@ public class CLProgram extends CLObjectResource { CLDevice[] devices = getCLDevices(); - NativeSizeBuffer sizes = NativeSizeBuffer.allocateDirect(devices.length); - int ret = binding.clGetProgramInfo(ID, CL_PROGRAM_BINARY_SIZES, sizes.capacity()*NativeSizeBuffer.elementSize(), sizes.getBuffer(), null); + PointerBuffer sizes = PointerBuffer.allocateDirect(devices.length); + int ret = binding.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); } @@ -632,7 +631,7 @@ public class CLProgram extends CLObjectResource { 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); @@ -640,7 +639,7 @@ public class CLProgram extends CLObjectResource { } addresses.rewind(); - ret = binding.clGetProgramInfo(ID, CL_PROGRAM_BINARIES, addresses.capacity()*NativeSizeBuffer.elementSize(), addresses.getBuffer(), null); + ret = binding.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); } diff --git a/src/com/jogamp/opencl/CLSampler.java b/src/com/jogamp/opencl/CLSampler.java index 3f145b3b..f19f58de 100644 --- a/src/com/jogamp/opencl/CLSampler.java +++ b/src/com/jogamp/opencl/CLSampler.java @@ -1,5 +1,5 @@ /* - * Copyright 2009 - 2010 JogAmp Community. All rights reserved. + * Copyright (c) 2009 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -28,8 +28,8 @@ package com.jogamp.opencl; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.impl.CLTLInfoAccessor; -import com.jogamp.common.nio.NativeSizeBuffer; import com.jogamp.opencl.llb.CLSamplerBinding; import java.nio.Buffer; @@ -91,7 +91,7 @@ public class CLSampler extends CLObjectResource { private class CLSamplerInfoAccessor extends CLTLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, NativeSizeBuffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return binding.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 f7214b6e..dcddd3df 100644 --- a/src/com/jogamp/opencl/gl/CLGLContext.java +++ b/src/com/jogamp/opencl/gl/CLGLContext.java @@ -34,7 +34,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; @@ -97,7 +97,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(platform, dispatcher, properties, toDeviceBitmap(deviceTypes)); @@ -121,7 +121,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(platform, dispatcher, properties, devices); @@ -135,7 +135,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"); @@ -153,14 +153,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) @@ -170,7 +170,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) @@ -181,7 +181,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) { @@ -191,7 +191,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/CLTLAccessorFactory.java b/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java index ab4fcca6..36718f1a 100644 --- a/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java +++ b/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java @@ -4,7 +4,7 @@ package com.jogamp.opencl.impl; import java.nio.IntBuffer; -import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.llb.CL; import com.jogamp.opencl.llb.CLDeviceBinding; import com.jogamp.opencl.spi.CLAccessorFactory; @@ -41,7 +41,7 @@ public class CLTLAccessorFactory implements CLAccessorFactory { } @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.clGetDeviceInfo(ID, name, valueSize, value, valueSizeRet); } @@ -58,7 +58,7 @@ public class CLTLAccessorFactory implements CLAccessorFactory { } @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.clGetPlatformInfo(ID, name, valueSize, value, valueSizeRet); } @@ -75,7 +75,7 @@ public class CLTLAccessorFactory implements CLAccessorFactory { }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/impl/CLTLInfoAccessor.java b/src/com/jogamp/opencl/impl/CLTLInfoAccessor.java index ee5d0e47..c31b22a6 100644 --- a/src/com/jogamp/opencl/impl/CLTLInfoAccessor.java +++ b/src/com/jogamp/opencl/impl/CLTLInfoAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2009 - 2010 JogAmp Community. All rights reserved. + * Copyright (c) 2009 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -29,7 +29,7 @@ package com.jogamp.opencl.impl; import com.jogamp.opencl.spi.CLInfoAccessor; -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; @@ -55,11 +55,11 @@ public abstract class CLTLInfoAccessor implements CLInfoAccessor { } }; - protected final static ThreadLocal<NativeSizeBuffer> localNSB = new ThreadLocal<NativeSizeBuffer>() { + protected final static ThreadLocal<PointerBuffer> localNSB = new ThreadLocal<PointerBuffer>() { @Override - protected NativeSizeBuffer initialValue() { - return NativeSizeBuffer.allocateDirect(1); + protected PointerBuffer initialValue() { + return PointerBuffer.allocateDirect(1); } }; @@ -77,7 +77,7 @@ public abstract class CLTLInfoAccessor implements CLInfoAccessor { @Override 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"); @@ -122,11 +122,11 @@ public abstract class CLTLInfoAccessor implements 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/llb/impl/CLImpl.java b/src/com/jogamp/opencl/llb/impl/CLImpl.java index d4a1672b..0713ac4d 100644 --- a/src/com/jogamp/opencl/llb/impl/CLImpl.java +++ b/src/com/jogamp/opencl/llb/impl/CLImpl.java @@ -31,7 +31,7 @@ */ package com.jogamp.opencl.llb.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; @@ -57,7 +57,7 @@ public class CLImpl extends CLAbstractImpl { } @Override - 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"); @@ -89,8 +89,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); @Override - 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"); } @@ -138,8 +137,7 @@ public class CLImpl extends CLAbstractImpl { /** Interface to C language function: <br> <code> int32_t clBuildProgram(cl_program, uint32_t, cl_device_id * , const char * , void * ); </code> */ @Override - 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"); } @@ -181,19 +179,19 @@ public class CLImpl extends CLAbstractImpl { /** Interface to C language function: <br> <code> 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); </code> - @param origin a direct {@link com.jogamp.common.nio.NativeSizeBuffer} - @param range a direct {@link com.jogamp.common.nio.NativeSizeBuffer} - @param image_row_pitch a direct {@link com.jogamp.common.nio.NativeSizeBuffer} - @param image_slice_pitch a direct {@link com.jogamp.common.nio.NativeSizeBuffer} - @param event_wait_list a direct {@link com.jogamp.common.nio.NativeSizeBuffer} - @param event a direct {@link com.jogamp.common.nio.NativeSizeBuffer} + @param origin a direct {@link com.jogamp.common.nio.PointerBuffer} + @param range a direct {@link com.jogamp.common.nio.PointerBuffer} + @param image_row_pitch a direct {@link com.jogamp.common.nio.PointerBuffer} + @param image_slice_pitch a direct {@link com.jogamp.common.nio.PointerBuffer} + @param event_wait_list a direct {@link com.jogamp.common.nio.PointerBuffer} + @param event a direct {@link com.jogamp.common.nio.PointerBuffer} @param errcode_ret a direct {@link java.nio.IntBuffer} */ @Override 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"); @@ -242,12 +240,12 @@ public class CLImpl extends CLAbstractImpl { } /** Entry point to C language function: <code> 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); </code> - @param origin a direct {@link com.jogamp.common.nio.NativeSizeBuffer} - @param range a direct {@link com.jogamp.common.nio.NativeSizeBuffer} - @param image_row_pitch a direct {@link com.jogamp.common.nio.NativeSizeBuffer} - @param image_slice_pitch a direct {@link com.jogamp.common.nio.NativeSizeBuffer} - @param event_wait_list a direct {@link com.jogamp.common.nio.NativeSizeBuffer} - @param event a direct {@link com.jogamp.common.nio.NativeSizeBuffer} + @param origin a direct {@link com.jogamp.common.nio.PointerBuffer} + @param range a direct {@link com.jogamp.common.nio.PointerBuffer} + @param image_row_pitch a direct {@link com.jogamp.common.nio.PointerBuffer} + @param image_slice_pitch a direct {@link com.jogamp.common.nio.PointerBuffer} + @param event_wait_list a direct {@link com.jogamp.common.nio.PointerBuffer} + @param event a direct {@link com.jogamp.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 05517850..acd53a52 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.llb.CL#clBuildProgram} non blocking (OpenCL implementation dependent).<br/> * Note2: the thread which calls this method is unspecified. The Application should ensure propper synchronization. * @author Michael Bien - * @see com.jogamp.opencl.llb.CL#clBuildProgram(long, int, com.jogamp.common.nio.NativeSizeBuffer, java.lang.String, com.jogamp.opencl.llb.impl.BuildProgramCallback) + * @see com.jogamp.opencl.llb.CL#clBuildProgram(long, int, com.jogamp.common.nio.PointerBuffer, java.lang.String, com.jogamp.opencl.llb.impl.BuildProgramCallback) */ public interface CLBuildListener { |