summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/CLCommandQueue.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/jogamp/opencl/CLCommandQueue.java')
-rw-r--r--src/com/jogamp/opencl/CLCommandQueue.java228
1 files changed, 157 insertions, 71 deletions
diff --git a/src/com/jogamp/opencl/CLCommandQueue.java b/src/com/jogamp/opencl/CLCommandQueue.java
index ae279fa6..cbdd59fa 100644
--- a/src/com/jogamp/opencl/CLCommandQueue.java
+++ b/src/com/jogamp/opencl/CLCommandQueue.java
@@ -30,7 +30,8 @@ package com.jogamp.opencl;
import com.jogamp.common.nio.CachedBufferFactory;
import com.jogamp.opencl.gl.CLGLI;
-import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.common.nio.NativeSizeBuffer;
+import com.jogamp.opencl.gl.CLGLObject;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
@@ -65,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 PointerBuffer ibA;
- private final PointerBuffer ibB;
- private final PointerBuffer ibC;
+ private final NativeSizeBuffer ibA;
+ private final NativeSizeBuffer ibB;
+ private final NativeSizeBuffer ibC;
private CLCommandQueue(CLContext context, long id, CLDevice device, long properties) {
super(context, id);
@@ -78,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 = PointerBuffer.wrap(factory.newDirectByteBuffer(3*pbsize));
- this.ibB = PointerBuffer.wrap(factory.newDirectByteBuffer(3*pbsize));
- this.ibC = PointerBuffer.wrap(factory.newDirectByteBuffer(3*pbsize));
+ 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.pbA = factory.newDirectIntBuffer(1);
@@ -116,7 +117,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
*/
public CLCommandQueue putWriteBuffer(CLBuffer<?> writeBuffer, boolean blockingWrite, CLEventList condition, CLEventList events) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -160,7 +161,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
*/
public CLCommandQueue putReadBuffer(CLBuffer<?> readBuffer, boolean blockingRead, CLEventList condition, CLEventList events) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -209,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) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -279,7 +280,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
long rowPitch, long slicePitch, long hostRowPitch, long hostSlicePitch,
boolean blockingWrite, CLEventList condition, CLEventList events) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -357,7 +358,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
long rowPitch, long slicePitch, long hostRowPitch, long hostSlicePitch,
boolean blockingRead, CLEventList condition, CLEventList events) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -438,7 +439,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
long srcRowPitch, long srcSlicePitch, long destRowPitch, long destSlicePitch,
CLEventList condition, CLEventList events) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -506,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) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -568,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) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -629,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) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -691,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) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -755,7 +756,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
int dstOriginX, int dstOriginY,
int rangeX, int rangeY, CLEventList condition, CLEventList events) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -824,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) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -888,7 +889,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
long srcOffset, int dstOriginX, int dstOriginY,
int rangeX, int rangeY, CLEventList condition, CLEventList events) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -955,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) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -1019,7 +1020,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
int srcOriginX, int srcOriginY,
int rangeX, int rangeY, long dstOffset, CLEventList condition, CLEventList events) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -1086,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) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -1144,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) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -1204,7 +1205,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
int offsetX, int offsetY,
int rangeX, int rangeY, boolean blockingMap, CLEventList condition, CLEventList events) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -1270,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) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -1314,7 +1315,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
*/
public CLCommandQueue putUnmapMemory(CLMemory<?> memory, Buffer mapped, CLEventList condition, CLEventList events) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -1351,7 +1352,6 @@ public class CLCommandQueue extends CLObject implements CLResource {
public CLCommandQueue putWaitForEvent(CLEventList list, int index, boolean blockingWait) {
PointerBuffer ids = list.IDs.duplicate().position(index);
-
int ret = blockingWait ? cl.clWaitForEvents(1, ids)
: cl.clEnqueueWaitForEvents(ID, 1, ids);
if(ret != CL_SUCCESS) {
@@ -1407,7 +1407,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
*/
public CLCommandQueue putTask(CLKernel kernel, CLEventList condition, CLEventList events) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer 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) {
- PointerBuffer globWO = null;
- PointerBuffer globWS = null;
- PointerBuffer locWS = null;
+ NativeSizeBuffer globWO = null;
+ NativeSizeBuffer globWS = null;
+ NativeSizeBuffer locWS = null;
if(globalWorkOffset != 0) {
globWO = copy2NIO(ibA, globalWorkOffset);
@@ -1495,17 +1495,17 @@ 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) {
- PointerBuffer globalWorkOffset = null;
- PointerBuffer globalWorkSize = null;
- PointerBuffer localWorkSize = null;
+ NativeSizeBuffer globalWorkOffset = null;
+ NativeSizeBuffer globalWorkSize = null;
+ NativeSizeBuffer localWorkSize = null;
- if(globalWorkOffsetX != 0 && globalWorkOffsetY != 0) {
+ if(globalWorkOffsetX != 0 || globalWorkOffsetY != 0) {
globalWorkOffset = copy2NIO(ibA, globalWorkOffsetX, globalWorkOffsetY);
}
- if(globalWorkSizeX != 0 && globalWorkSizeY != 0) {
+ if(globalWorkSizeX != 0 || globalWorkSizeY != 0) {
globalWorkSize = copy2NIO(ibB, globalWorkSizeX, globalWorkSizeY);
}
- if(localWorkSizeX != 0 && localWorkSizeY !=0) {
+ if(localWorkSizeX != 0 || localWorkSizeY != 0) {
localWorkSize = copy2NIO(ibC, localWorkSizeX, localWorkSizeY);
}
this.putNDRangeKernel(kernel, 2, globalWorkOffset, globalWorkSize, localWorkSize, condition, events);
@@ -1515,7 +1515,57 @@ public class CLCommandQueue extends CLObject implements CLResource {
/**
* Calls {@native clEnqueueNDRangeKernel}.
*/
- public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, PointerBuffer globalWorkOffset, PointerBuffer globalWorkSize, PointerBuffer localWorkSize) {
+ public CLCommandQueue put3DRangeKernel(CLKernel kernel, long globalWorkOffsetX, long globalWorkOffsetY, long globalWorkOffsetZ,
+ long globalWorkSizeX, long globalWorkSizeY, long globalWorkSizeZ,
+ long localWorkSizeX, long localWorkSizeY, long localWorkSizeZ) {
+ this.put3DRangeKernel(kernel,
+ globalWorkOffsetX, globalWorkOffsetY, globalWorkOffsetZ,
+ globalWorkSizeX, globalWorkSizeY, globalWorkSizeZ,
+ localWorkSizeX, localWorkSizeY, localWorkSizeZ, null, null);
+
+ return this;
+ }
+
+ /**
+ * Calls {@native clEnqueueNDRangeKernel}.
+ */
+ public CLCommandQueue put3DRangeKernel(CLKernel kernel, long globalWorkOffsetX, long globalWorkOffsetY, long globalWorkOffsetZ,
+ long globalWorkSizeX, long globalWorkSizeY, long globalWorkSizeZ,
+ long localWorkSizeX, long localWorkSizeY, long localWorkSizeZ, CLEventList events) {
+ this.put3DRangeKernel(kernel,
+ globalWorkOffsetX, globalWorkOffsetY, globalWorkOffsetZ,
+ globalWorkSizeX, globalWorkSizeY, globalWorkSizeZ,
+ localWorkSizeX, localWorkSizeY, localWorkSizeZ, null, events);
+ return this;
+ }
+
+ /**
+ * Calls {@native clEnqueueNDRangeKernel}.
+ */
+ 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;
+
+ if(globalWorkOffsetX != 0 || globalWorkOffsetY != 0 || globalWorkOffsetZ != 0) {
+ globalWorkOffset = copy2NIO(ibA, globalWorkOffsetX, globalWorkOffsetY, globalWorkOffsetZ);
+ }
+ if(globalWorkSizeX != 0 || globalWorkSizeY != 0 || globalWorkSizeZ != 0) {
+ globalWorkSize = copy2NIO(ibB, globalWorkSizeX, globalWorkSizeY, globalWorkSizeZ);
+ }
+ if(localWorkSizeX != 0 || localWorkSizeY != 0 || localWorkSizeZ != 0) {
+ localWorkSize = copy2NIO(ibC, localWorkSizeX, localWorkSizeY, localWorkSizeZ);
+ }
+ this.putNDRangeKernel(kernel, 3, globalWorkOffset, globalWorkSize, localWorkSize, condition, events);
+ return this;
+ }
+
+ /**
+ * Calls {@native clEnqueueNDRangeKernel}.
+ */
+ public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, NativeSizeBuffer globalWorkOffset, NativeSizeBuffer globalWorkSize, NativeSizeBuffer localWorkSize) {
this.putNDRangeKernel(kernel, workDimension, globalWorkOffset, globalWorkSize, localWorkSize, null, null);
return this;
}
@@ -1523,7 +1573,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
/**
* Calls {@native clEnqueueNDRangeKernel}.
*/
- public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, PointerBuffer globalWorkOffset, PointerBuffer globalWorkSize, PointerBuffer localWorkSize, CLEventList events) {
+ public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, NativeSizeBuffer globalWorkOffset, NativeSizeBuffer globalWorkSize, NativeSizeBuffer localWorkSize, CLEventList events) {
this.putNDRangeKernel(kernel, workDimension, globalWorkOffset, globalWorkSize, localWorkSize, null, events);
return this;
}
@@ -1531,10 +1581,10 @@ public class CLCommandQueue extends CLObject implements CLResource {
/**
* Calls {@native clEnqueueNDRangeKernel}.
*/
- public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, PointerBuffer globalWorkOffset,
- PointerBuffer globalWorkSize, PointerBuffer localWorkSize, CLEventList condition, CLEventList events) {
+ public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, NativeSizeBuffer globalWorkOffset,
+ NativeSizeBuffer globalWorkSize, NativeSizeBuffer localWorkSize, CLEventList condition, CLEventList events) {
- PointerBuffer conditionIDs = null;
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -1567,7 +1617,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
/**
* Calls {@native clEnqueueAcquireGLObjects}.
*/
- public CLCommandQueue putAcquireGLObject(long glObject) {
+ public CLCommandQueue putAcquireGLObject(CLGLObject glObject) {
this.putAcquireGLObject(glObject, null, null);
return this;
}
@@ -1575,7 +1625,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
/**
* Calls {@native clEnqueueAcquireGLObjects}.
*/
- public CLCommandQueue putAcquireGLObject(long glObject, CLEventList events) {
+ public CLCommandQueue putAcquireGLObject(CLGLObject glObject, CLEventList events) {
this.putAcquireGLObject(glObject, null, events);
return this;
}
@@ -1583,9 +1633,33 @@ public class CLCommandQueue extends CLObject implements CLResource {
/**
* Calls {@native clEnqueueAcquireGLObjects}.
*/
- public CLCommandQueue putAcquireGLObject(long glObject, CLEventList condition, CLEventList events) {
+ public CLCommandQueue putAcquireGLObject(CLGLObject glObject, CLEventList condition, CLEventList events) {
+ this.putAcquireGLObjects(copy2NIO(ibA, glObject.getID()), condition, events);
+ return this;
+ }
+
+ /**
+ * Calls {@native clEnqueueAcquireGLObjects}.
+ */
+ public CLCommandQueue putAcquireGLObjects(CLGLObject glObject1, CLGLObject glObject2, CLEventList condition, CLEventList events) {
+ this.putAcquireGLObjects(copy2NIO(ibA, glObject1.getID(), glObject2.getID()), condition, events);
+ return this;
+ }
- PointerBuffer conditionIDs = null;
+ /**
+ * Calls {@native clEnqueueAcquireGLObjects}.
+ */
+ public CLCommandQueue putAcquireGLObjects(CLGLObject glObject1, CLGLObject glObject2, CLGLObject glObject3, CLEventList condition, CLEventList events) {
+ this.putAcquireGLObjects(copy2NIO(ibA, glObject1.getID(), glObject2.getID(), glObject3.getID()), condition, events);
+ return this;
+ }
+
+ /**
+ * Calls {@native clEnqueueAcquireGLObjects}.
+ */
+ public CLCommandQueue putAcquireGLObjects(NativeSizeBuffer glObjectIDs, CLEventList condition, CLEventList events) {
+
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -1594,14 +1668,12 @@ public class CLCommandQueue extends CLObject implements CLResource {
CLGLI xl = (CLGLI) cl;
- PointerBuffer glObj = copy2NIO(ibA, glObject);
-
- int ret = xl.clEnqueueAcquireGLObjects(ID, 1, glObj,
+ int ret = xl.clEnqueueAcquireGLObjects(ID, glObjectIDs.remaining(), glObjectIDs,
conditions, conditionIDs,
events==null ? null : events.IDs);
if(ret != CL_SUCCESS) {
- throw newException(ret, "can not aquire GLObject: " + glObject + " with " + toStr(condition, events));
+ throw newException(ret, "can not aquire " + glObjectIDs + " with " + toStr(condition, events));
}
if(events != null) {
@@ -1614,7 +1686,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
/**
* Calls {@native clEnqueueReleaseGLObjects}.
*/
- public CLCommandQueue putReleaseGLObject(long glObject) {
+ public CLCommandQueue putReleaseGLObject(CLGLObject glObject) {
this.putReleaseGLObject(glObject, null);
return this;
}
@@ -1622,7 +1694,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
/**
* Calls {@native clEnqueueReleaseGLObjects}.
*/
- public CLCommandQueue putReleaseGLObject(long glObject, CLEventList events) {
+ public CLCommandQueue putReleaseGLObject(CLGLObject glObject, CLEventList events) {
this.putReleaseGLObject(glObject, null, events);
return this;
}
@@ -1630,9 +1702,33 @@ public class CLCommandQueue extends CLObject implements CLResource {
/**
* Calls {@native clEnqueueReleaseGLObjects}.
*/
- public CLCommandQueue putReleaseGLObject(long glObject, CLEventList condition, CLEventList events) {
+ public CLCommandQueue putReleaseGLObject(CLGLObject glObject, CLEventList condition, CLEventList events) {
+ this.putReleaseGLObjects(copy2NIO(ibA, glObject.getID()), condition, events);
+ return this;
+ }
- PointerBuffer conditionIDs = null;
+ /**
+ * Calls {@native clEnqueueAcquireGLObjects}.
+ */
+ public CLCommandQueue putReleaseGLObjects(CLGLObject glObject1, CLGLObject glObject2, CLEventList condition, CLEventList events) {
+ this.putReleaseGLObjects(copy2NIO(ibA, glObject1.getID(), glObject2.getID()), condition, events);
+ return this;
+ }
+
+ /**
+ * Calls {@native clEnqueueAcquireGLObjects}.
+ */
+ public CLCommandQueue putReleaseGLObjects(CLGLObject glObject1, CLGLObject glObject2, CLGLObject glObject3, CLEventList condition, CLEventList events) {
+ this.putReleaseGLObjects(copy2NIO(ibA, glObject1.getID(), glObject2.getID(), glObject3.getID()), condition, events);
+ return this;
+ }
+
+ /**
+ * Calls {@native clEnqueueReleaseGLObjects}.
+ */
+ public CLCommandQueue putReleaseGLObjects(NativeSizeBuffer glObjectIDs, CLEventList condition, CLEventList events) {
+
+ NativeSizeBuffer conditionIDs = null;
int conditions = 0;
if(condition != null) {
conditionIDs = condition.IDsView;
@@ -1641,14 +1737,12 @@ public class CLCommandQueue extends CLObject implements CLResource {
CLGLI xl = (CLGLI) cl;
- PointerBuffer glObj = copy2NIO(ibA, glObject);
-
- int ret = xl.clEnqueueReleaseGLObjects(ID, 1, glObj,
+ int ret = xl.clEnqueueReleaseGLObjects(ID, glObjectIDs.remaining(), glObjectIDs,
conditions, conditionIDs,
events==null ? null : events.IDs);
if(ret != CL_SUCCESS) {
- throw newException(ret, "can not release GLObject: " + glObject + "with " + toStr(condition, events));
+ throw newException(ret, "can not release " + glObjectIDs + "with " + toStr(condition, events));
}
if(events != null) {
@@ -1698,27 +1792,19 @@ public class CLCommandQueue extends CLObject implements CLResource {
}
}
- private static PointerBuffer copy2NIO(PointerBuffer buffer, long a) {
+ private static NativeSizeBuffer copy2NIO(NativeSizeBuffer buffer, long a) {
return buffer.put(2, a).position(2);
}
-// private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b) {
-// return buffer.position(1).put(a).put(b).position(1);
-// }
-//
-// private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b, long c) {
-// return buffer.rewind().put(a).put(b).put(c).rewind();
-// }
-
- private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b) {
+ private static NativeSizeBuffer copy2NIO(NativeSizeBuffer buffer, long a, long b) {
return buffer.position(1).put(a).put(b).position(1);
}
- private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b, long c) {
+ private static NativeSizeBuffer copy2NIO(NativeSizeBuffer buffer, long a, long b, long c) {
return buffer.rewind().put(a).put(b).put(c).rewind();
}
- private static String toStr(PointerBuffer buffer) {
+ private static String toStr(NativeSizeBuffer buffer) {
if(buffer == null) {
return null;
}