public <T> CLBuffer<T> as(Class<T> newTargetType) { long mem = getEntity(); assert mem != 0; error(CL.clRetainMemObject(mem)); PointerIO<T> newIO = PointerIO.getInstance(newTargetType); return copyGLMark(new CLBuffer<T>(context, getByteCount(), mem, owner, newIO)); }
public <T> CLBuffer<T> as(Class<T> newTargetType) { long mem = getEntity(); assert mem != 0; error(CL.clRetainMemObject(mem)); PointerIO<T> newIO = PointerIO.getInstance(newTargetType); return copyGLMark(new CLBuffer<T>(context, getByteCount(), mem, owner, newIO)); }
/** * Calls <a href="http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clEnqueueCopyBuffer.html">clEnqueueCopyBuffer</a>.<br> * @param queue Execution queue for this operation. * @param destination destination buffer object * @param sourceByteOffset byte offset in the source * @param destinationByteOffset byte offset in the destination * @param byteCount number of bytes to copy * @param eventsToWaitFor Events that need to complete before this particular command can be executed. Special value {@link CLEvent#FIRE_AND_FORGET} can be used to avoid returning a CLEvent. * @return Event object that identifies this command and can be used to query or queue a wait for the command to complete, or null if eventsToWaitFor contains {@link CLEvent#FIRE_AND_FORGET}. */ public CLEvent copyBytesTo(CLQueue queue, CLBuffer destination, long sourceByteOffset, long destinationByteOffset, long byteCount, CLEvent... eventsToWaitFor) { ReusablePointers ptrs = ReusablePointers.get(); int[] eventsInCount = ptrs.int1Array; Pointer<cl_event> eventsIn = CLAbstractEntity.copyNonNullEntities(eventsToWaitFor, eventsInCount, ptrs.events_in); Pointer<cl_event> eventOut = eventsToWaitFor == null || CLEvent.containsFireAndForget(eventsToWaitFor) ? null : ptrs.event_out; error(CL.clEnqueueCopyBuffer( queue.getEntity(), getEntity(), destination.getEntity(), sourceByteOffset, destinationByteOffset, byteCount, eventsInCount[0], getPeer(eventsIn) , getPeer(eventOut) )); return CLEvent.createEventFromPointer(queue, eventOut) ; }
/** * Calls <a href="http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clEnqueueCopyBuffer.html">clEnqueueCopyBuffer</a>.<br> * @param queue Execution queue for this operation. * @param destination destination buffer object * @param sourceByteOffset byte offset in the source * @param destinationByteOffset byte offset in the destination * @param byteCount number of bytes to copy * @param eventsToWaitFor Events that need to complete before this particular command can be executed. Special value {@link CLEvent#FIRE_AND_FORGET} can be used to avoid returning a CLEvent. * @return Event object that identifies this command and can be used to query or queue a wait for the command to complete, or null if eventsToWaitFor contains {@link CLEvent#FIRE_AND_FORGET}. */ public CLEvent copyBytesTo(CLQueue queue, CLBuffer destination, long sourceByteOffset, long destinationByteOffset, long byteCount, CLEvent... eventsToWaitFor) { ReusablePointers ptrs = ReusablePointers.get(); int[] eventsInCount = ptrs.int1Array; Pointer<cl_event> eventsIn = CLAbstractEntity.copyNonNullEntities(eventsToWaitFor, eventsInCount, ptrs.events_in); Pointer<cl_event> eventOut = eventsToWaitFor == null || CLEvent.containsFireAndForget(eventsToWaitFor) ? null : ptrs.event_out; error(CL.clEnqueueCopyBuffer( queue.getEntity(), getEntity(), destination.getEntity(), sourceByteOffset, destinationByteOffset, byteCount, eventsInCount[0], getPeer(eventsIn) , getPeer(eventOut) )); return CLEvent.createEventFromPointer(queue, eventOut) ; }
error(CL.clEnqueueWriteBuffer( queue.getEntity(), getEntity(), blocking ? CL_TRUE : 0, offset,
error(CL.clEnqueueWriteBuffer( queue.getEntity(), getEntity(), blocking ? CL_TRUE : 0, offset,
/** * Calls <a href="http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clEnqueueUnmapMemObject.html">clEnqueueUnmapMemObject</a>.<br> * @param queue Execution queue for this operation. * @param buffer * @param eventsToWaitFor Events that need to complete before this particular command can be executed. Special value {@link CLEvent#FIRE_AND_FORGET} can be used to avoid returning a CLEvent. * @return Event object that identifies this command and can be used to query or queue a wait for the command to complete, or null if eventsToWaitFor contains {@link CLEvent#FIRE_AND_FORGET}. */ public CLEvent unmap(CLQueue queue, Pointer<T> buffer, CLEvent... eventsToWaitFor) { ReusablePointers ptrs = ReusablePointers.get(); int[] eventsInCount = ptrs.int1Array; Pointer<cl_event> eventsIn = CLAbstractEntity.copyNonNullEntities(eventsToWaitFor, eventsInCount, ptrs.events_in); Pointer<cl_event> eventOut = eventsToWaitFor == null || CLEvent.containsFireAndForget(eventsToWaitFor) ? null : ptrs.event_out; ; error(CL.clEnqueueUnmapMemObject(queue.getEntity(), getEntity(), getPeer(buffer), eventsInCount[0], getPeer(eventsIn) , getPeer(eventOut) )); return CLEvent.createEventFromPointer(queue, eventOut) ; }
/** * Calls <a href="http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clEnqueueUnmapMemObject.html">clEnqueueUnmapMemObject</a>.<br> * @param queue Execution queue for this operation. * @param buffer * @param eventsToWaitFor Events that need to complete before this particular command can be executed. Special value {@link CLEvent#FIRE_AND_FORGET} can be used to avoid returning a CLEvent. * @return Event object that identifies this command and can be used to query or queue a wait for the command to complete, or null if eventsToWaitFor contains {@link CLEvent#FIRE_AND_FORGET}. */ public CLEvent unmap(CLQueue queue, Pointer<T> buffer, CLEvent... eventsToWaitFor) { ReusablePointers ptrs = ReusablePointers.get(); int[] eventsInCount = ptrs.int1Array; Pointer<cl_event> eventsIn = CLAbstractEntity.copyNonNullEntities(eventsToWaitFor, eventsInCount, ptrs.events_in); Pointer<cl_event> eventOut = eventsToWaitFor == null || CLEvent.containsFireAndForget(eventsToWaitFor) ? null : ptrs.event_out; ; error(CL.clEnqueueUnmapMemObject(queue.getEntity(), getEntity(), getPeer(buffer), eventsInCount[0], getPeer(eventsIn) , getPeer(eventOut) )); return CLEvent.createEventFromPointer(queue, eventOut) ; }
error(CL.clEnqueueCopyBuffer( queue.getEntity(), getEntity(), destination.getEntity(), actualSrcOffset,
error(CL.clEnqueueCopyBuffer( queue.getEntity(), getEntity(), destination.getEntity(), actualSrcOffset,
error(CL.clEnqueueReadBuffer( queue.getEntity(), getEntity(), blocking ? CL_TRUE : 0, offset * getElementSize(),
error(CL.clEnqueueReadBuffer( queue.getEntity(), getEntity(), blocking ? CL_TRUE : 0, offset * getElementSize(),
error(CL.clEnqueueWriteBuffer( queue.getEntity(), getEntity(), blocking ? CL_TRUE : CL_FALSE, offset * getElementSize(),
error(CL.clEnqueueWriteBuffer( queue.getEntity(), getEntity(), blocking ? CL_TRUE : CL_FALSE, offset * getElementSize(),
/** * Calls <a href="http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clCreateSubBuffer.html">clCreateSubBuffer</a>.<br> * Can be used to create a new buffer object (referred to as a sub-buffer object) from an existing buffer object. * @param usage is used to specify allocation and usage information about the image memory object being created and is described in table 5.3 of the OpenCL spec. * @param offset * @param length length in bytes * @since OpenCL 1.1 * @return sub-buffer that is a "window" of this buffer starting at the provided offset, with the provided length */ public CLBuffer<T> createSubBuffer(Usage usage, long offset, long length) { context.getPlatform().requireMinVersionValue("clCreateSubBuffer", 1.1); int s = getElementSize(); cl_buffer_region region = new cl_buffer_region().origin(s * offset).size(s * length); ReusablePointers ptrs = ReusablePointers.get(); Pointer<Integer> pErr = ptrs.pErr; long mem = CL.clCreateSubBuffer(getEntity(), usage.getIntFlags(), CL_BUFFER_CREATE_TYPE_REGION, getPeer(getPointer(region)), getPeer(pErr)); error(pErr.getInt()); return mem == 0 ? null : new CLBuffer<T>(context, length * s, mem, null, io); }
/** * Calls <a href="http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clCreateSubBuffer.html">clCreateSubBuffer</a>.<br> * Can be used to create a new buffer object (referred to as a sub-buffer object) from an existing buffer object. * @param usage is used to specify allocation and usage information about the image memory object being created and is described in table 5.3 of the OpenCL spec. * @param offset * @param length length in bytes * @since OpenCL 1.1 * @return sub-buffer that is a "window" of this buffer starting at the provided offset, with the provided length */ public CLBuffer<T> createSubBuffer(Usage usage, long offset, long length) { context.getPlatform().requireMinVersionValue("clCreateSubBuffer", 1.1); int s = getElementSize(); cl_buffer_region region = new cl_buffer_region().origin(s * offset).size(s * length); ReusablePointers ptrs = ReusablePointers.get(); Pointer<Integer> pErr = ptrs.pErr; long mem = CL.clCreateSubBuffer(getEntity(), usage.getIntFlags(), CL_BUFFER_CREATE_TYPE_REGION, getPeer(getPointer(region)), getPeer(pErr)); error(pErr.getInt()); return mem == 0 ? null : new CLBuffer<T>(context, length * s, mem, null, io); }
error(CL.clEnqueueFillBuffer( queue.getEntity(), getEntity(), getPeer(pattern), patternLength * getElementSize(),
error(CL.clEnqueueFillBuffer( queue.getEntity(), getEntity(), getPeer(pattern), patternLength * getElementSize(),
long mappedPeer = CL.clEnqueueMapBuffer( queue.getEntity(), getEntity(), blocking ? CL_TRUE : CL_FALSE, flags.value(),
long mappedPeer = CL.clEnqueueMapBuffer( queue.getEntity(), getEntity(), blocking ? CL_TRUE : CL_FALSE, flags.value(),