public class JoclBuffer extends Buffer
Buffer.AsyncMapping
OpenCLObject.ObjectReleaser
releaser
Constructor and Description |
---|
JoclBuffer(long id) |
Modifier and Type | Method and Description |
---|---|
Event |
acquireBufferForSharingAsync(CommandQueue queue)
Aquires this buffer object for using.
|
void |
acquireBufferForSharingNoEvent(CommandQueue queue)
Aquires this buffer object for using.
|
void |
copyTo(CommandQueue queue,
Buffer dest,
long size,
long srcOffset,
long destOffset)
Performs a blocking copy operation from this buffer to the specified buffer.
|
Event |
copyToAsync(CommandQueue queue,
Buffer dest,
long size,
long srcOffset,
long destOffset)
Performs an async/non-blocking copy operation from this buffer to the specified buffer.
|
Event |
copyToImageAsync(CommandQueue queue,
Image dest,
long srcOffset,
long[] destOrigin,
long[] destRegion)
Copies this buffer to the specified image.
|
Event |
fillAsync(CommandQueue queue,
java.nio.ByteBuffer pattern,
long size,
long offset)
Enqueues a fill operation.
|
MemoryAccess |
getMemoryAccessFlags() |
long |
getSize() |
java.nio.ByteBuffer |
map(CommandQueue queue,
long size,
long offset,
MappingAccess access)
Maps this buffer directly into host memory.
|
Buffer.AsyncMapping |
mapAsync(CommandQueue queue,
long size,
long offset,
MappingAccess access)
Maps this buffer asynchronously into host memory.
|
void |
read(CommandQueue queue,
java.nio.ByteBuffer dest,
long size,
long offset)
Performs a blocking read of the buffer.
|
Event |
readAsync(CommandQueue queue,
java.nio.ByteBuffer dest,
long size,
long offset)
Performs an async/non-blocking read of the buffer.
|
Event |
releaseBufferForSharingAsync(CommandQueue queue)
Releases a shared buffer object.
|
void |
releaseBufferForSharingNoEvent(CommandQueue queue)
Releases a shared buffer object.
|
void |
unmap(CommandQueue queue,
java.nio.ByteBuffer ptr)
Unmaps a previously mapped memory.
|
void |
write(CommandQueue queue,
java.nio.ByteBuffer src,
long size,
long offset)
Performs a blocking write to the buffer.
|
Event |
writeAsync(CommandQueue queue,
java.nio.ByteBuffer src,
long size,
long offset)
Performs an async/non-blocking write to the buffer.
|
copyTo, copyTo, copyToAsync, copyToAsync, map, map, mapAsync, mapAsync, read, read, readAsync, readAsync, register, toString, write, write, writeAsync, writeAsync
finalize, getReleaser, release
public long getSize()
getSize
in class Buffer
Context.createBuffer(long)
public MemoryAccess getMemoryAccessFlags()
getMemoryAccessFlags
in class Buffer
Context.createBuffer(long, com.jme3.opencl.MemoryAccess)
public void read(CommandQueue queue, java.nio.ByteBuffer dest, long size, long offset)
Buffer
size
bytes remaining.
This method may set the limit to the last byte read.public Event readAsync(CommandQueue queue, java.nio.ByteBuffer dest, long size, long offset)
Buffer
size
bytes remaining.
This method may set the limit to the last byte read.public void write(CommandQueue queue, java.nio.ByteBuffer src, long size, long offset)
Buffer
size
bytes remaining.
This method may set the limit to the last byte that will be written.public Event writeAsync(CommandQueue queue, java.nio.ByteBuffer src, long size, long offset)
Buffer
size
bytes remaining.
This method may set the limit to the last byte that will be written.writeAsync
in class Buffer
queue
- the command queuesrc
- the source buffer, its data is written to this buffersize
- the size in bytes to writeoffset
- the offset into the target bufferpublic void copyTo(CommandQueue queue, Buffer dest, long size, long srcOffset, long destOffset)
Buffer
public Event copyToAsync(CommandQueue queue, Buffer dest, long size, long srcOffset, long destOffset)
Buffer
copyToAsync
in class Buffer
queue
- the command queuedest
- the target buffersize
- the size in bytes to copysrcOffset
- offset in bytes into this bufferdestOffset
- offset in bytes into the target bufferpublic java.nio.ByteBuffer map(CommandQueue queue, long size, long offset, MappingAccess access)
Buffer
Buffer.unmap(com.jme3.opencl.CommandQueue, java.nio.ByteBuffer)
.public void unmap(CommandQueue queue, java.nio.ByteBuffer ptr)
Buffer
public Buffer.AsyncMapping mapAsync(CommandQueue queue, long size, long offset, MappingAccess access)
Buffer
Buffer.unmap(com.jme3.opencl.CommandQueue, java.nio.ByteBuffer)
.mapAsync
in class Buffer
queue
- the command queuesize
- the size in bytes to mapoffset
- the offset into this bufferaccess
- specifies the possible access to the memory: READ_ONLY, WRITE_ONLY, READ_WRITEpublic Event fillAsync(CommandQueue queue, java.nio.ByteBuffer pattern, long size, long offset)
Buffer
fillAsync
in class Buffer
queue
- the command queuepattern
- the buffer containing the filling pattern.
The remaining bytes specify the pattern lengthsize
- the size in bytes to fill, must be a multiple of the pattern lengthoffset
- the offset in bytes into the buffer, must be a multiple of the pattern lengthpublic Event copyToImageAsync(CommandQueue queue, Image dest, long srcOffset, long[] destOrigin, long[] destRegion)
Buffer
Image
class.copyToImageAsync
in class Buffer
queue
- the command queuedest
- the target imagesrcOffset
- the offset in bytes into this bufferdestOrigin
- the origin of the copied areadestRegion
- the size of the copied areapublic Event acquireBufferForSharingAsync(CommandQueue queue)
Buffer
Context.bindVertexBuffer(com.jme3.scene.VertexBuffer, com.jme3.opencl.MemoryAccess)
.
This method must be called before the buffer is used. After the work is
done, the buffer must be released by calling
Buffer.releaseBufferForSharingAsync(com.jme3.opencl.CommandQueue)
so that OpenGL can use the VertexBuffer again.acquireBufferForSharingAsync
in class Buffer
queue
- the command queuepublic void acquireBufferForSharingNoEvent(CommandQueue queue)
Buffer
Context.bindVertexBuffer(com.jme3.scene.VertexBuffer, com.jme3.opencl.MemoryAccess)
.
This method must be called before the buffer is used. After the work is
done, the buffer must be released by calling
Buffer.releaseBufferForSharingAsync(com.jme3.opencl.CommandQueue)
so that OpenGL can use the VertexBuffer again.
The generated event object is directly released.
This brings a performance improvement when the resource is e.g. directly
used by a kernel afterwards on the same queue (this implicitly waits for
this action). If you need the event, use
Buffer.acquireBufferForSharingAsync(com.jme3.opencl.CommandQueue)
instead.acquireBufferForSharingNoEvent
in class Buffer
queue
- the command queuepublic Event releaseBufferForSharingAsync(CommandQueue queue)
Buffer
Buffer.acquireBufferForSharingAsync(com.jme3.opencl.CommandQueue)
to hand the control back to OpenGL.releaseBufferForSharingAsync
in class Buffer
queue
- the command queuepublic void releaseBufferForSharingNoEvent(CommandQueue queue)
Buffer
Buffer.acquireBufferForSharingAsync(com.jme3.opencl.CommandQueue)
to hand the control back to OpenGL.
The generated event object is directly released, resulting in
performance improvements.releaseBufferForSharingNoEvent
in class Buffer
queue
- the command queue