Package com.jme3.opencl.lwjgl
Class LwjglBuffer
java.lang.Object
com.jme3.opencl.AbstractOpenCLObject
com.jme3.opencl.Buffer
com.jme3.opencl.lwjgl.LwjglBuffer
- All Implemented Interfaces:
- OpenCLObject
- 
Nested Class SummaryNested classes/interfaces inherited from class com.jme3.opencl.BufferBuffer.AsyncMappingNested classes/interfaces inherited from interface com.jme3.opencl.OpenCLObjectOpenCLObject.ObjectReleaser
- 
Field SummaryFields inherited from class com.jme3.opencl.AbstractOpenCLObjectreleaser
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionAcquires this buffer object for using.voidAcquires this buffer object for using.voidcopyTo(CommandQueue queue, Buffer dest, long size, long srcOffset, long destOffset) Performs a blocking copy operation from this buffer to the specified buffer.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.copyToImageAsync(CommandQueue queue, Image dest, long srcOffset, long[] destOrigin, long[] destRegion) Copies this buffer to the specified image.fillAsync(CommandQueue queue, ByteBuffer pattern, long size, long offset) Enqueues a fill operation.org.lwjgl.opencl.CLMemlonggetSize()map(CommandQueue queue, long size, long offset, MappingAccess access) Maps this buffer directly into host memory.mapAsync(CommandQueue queue, long size, long offset, MappingAccess access) Maps this buffer asynchronously into host memory.voidread(CommandQueue queue, ByteBuffer dest, long size, long offset) Performs a blocking read of the buffer.readAsync(CommandQueue queue, ByteBuffer dest, long size, long offset) Performs an async/non-blocking read of the buffer.Releases a shared buffer object.voidReleases a shared buffer object.voidunmap(CommandQueue queue, ByteBuffer ptr) Unmaps a previously mapped memory.voidwrite(CommandQueue queue, ByteBuffer src, long size, long offset) Performs a blocking write to the buffer.writeAsync(CommandQueue queue, ByteBuffer src, long size, long offset) Performs an async/non-blocking write to the buffer.Methods inherited from class com.jme3.opencl.BuffercopyTo, copyTo, copyToAsync, copyToAsync, map, map, mapAsync, mapAsync, read, read, readAsync, readAsync, register, toString, write, write, writeAsync, writeAsyncMethods inherited from class com.jme3.opencl.AbstractOpenCLObjectfinalize, getReleaser, release
- 
Constructor Details- 
LwjglBufferpublic LwjglBuffer(org.lwjgl.opencl.CLMem buffer) 
 
- 
- 
Method Details- 
getBufferpublic org.lwjgl.opencl.CLMem getBuffer()
- 
getSizepublic long getSize()
- 
getMemoryAccessFlags- Specified by:
- getMemoryAccessFlagsin class- Buffer
- Returns:
- the memory access flags set on creation.
- See Also:
 
- 
readDescription copied from class:BufferPerforms a blocking read of the buffer. The target buffer must have at leastsizebytes remaining. This method may set the limit to the last byte read.
- 
readAsyncDescription copied from class:BufferPerforms an async/non-blocking read of the buffer. The target buffer must have at leastsizebytes remaining. This method may set the limit to the last byte read.
- 
writeDescription copied from class:BufferPerforms a blocking write to the buffer. The target buffer must have at leastsizebytes remaining. This method may set the limit to the last byte that will be written.
- 
writeAsyncDescription copied from class:BufferPerforms an async/non-blocking write to the buffer. The target buffer must have at leastsizebytes remaining. This method may set the limit to the last byte that will be written.- Specified by:
- writeAsyncin class- Buffer
- Parameters:
- queue- the command queue
- src- the source buffer, its data is written to this buffer
- size- the size in bytes to write
- offset- the offset into the target buffer
- Returns:
- an Event to indicate completion
 
- 
copyToDescription copied from class:BufferPerforms a blocking copy operation from this buffer to the specified buffer.
- 
copyToAsyncpublic Event copyToAsync(CommandQueue queue, Buffer dest, long size, long srcOffset, long destOffset) Description copied from class:BufferPerforms an async/non-blocking copy operation from this buffer to the specified buffer.- Specified by:
- copyToAsyncin class- Buffer
- Parameters:
- queue- the command queue
- dest- the target buffer
- size- the size in bytes to copy
- srcOffset- offset in bytes into this buffer
- destOffset- offset in bytes into the target buffer
- Returns:
- the event object indicating when the copy operation is finished
 
- 
mapDescription copied from class:BufferMaps this buffer directly into host memory. This might be the fastest method to access the contents of the buffer since the OpenCL implementation directly provides the memory.
 Important: The mapped memory MUST be released by callingBuffer.unmap(com.jme3.opencl.CommandQueue, java.nio.ByteBuffer).
- 
unmapDescription copied from class:BufferUnmaps a previously mapped memory. This releases the native resources and for WRITE_ONLY or READ_WRITE access, the memory content is sent back to the GPU.
- 
mapAsyncpublic Buffer.AsyncMapping mapAsync(CommandQueue queue, long size, long offset, MappingAccess access) Description copied from class:BufferMaps this buffer asynchronously into host memory. This might be the fastest method to access the contents of the buffer since the OpenCL implementation directly provides the memory.
 Important: The mapped memory MUST be released by callingBuffer.unmap(com.jme3.opencl.CommandQueue, java.nio.ByteBuffer).- Specified by:
- mapAsyncin class- Buffer
- Parameters:
- queue- the command queue
- size- the size in bytes to map
- offset- the offset into this buffer
- access- specifies the possible access to the memory: READ_ONLY, WRITE_ONLY, READ_WRITE
- Returns:
- the byte buffer directly reflecting the buffer contents and the event indicating when the buffer contents are available
 
- 
fillAsyncDescription copied from class:BufferEnqueues a fill operation. This method can be used to initialize or clear a buffer with a certain value.- Specified by:
- fillAsyncin class- Buffer
- Parameters:
- queue- the command queue
- pattern- the buffer containing the filling pattern. The remaining bytes specify the pattern length
- size- the size in bytes to fill, must be a multiple of the pattern length
- offset- the offset in bytes into the buffer, must be a multiple of the pattern length
- Returns:
- an event indicating when this operation is finished
 
- 
copyToImageAsyncpublic Event copyToImageAsync(CommandQueue queue, Image dest, long srcOffset, long[] destOrigin, long[] destRegion) Description copied from class:BufferCopies this buffer to the specified image. Note that no format conversion is done.
 For detailed description of the origin and region parameter, see the documentation of theImageclass.- Specified by:
- copyToImageAsyncin class- Buffer
- Parameters:
- queue- the command queue
- dest- the target image
- srcOffset- the offset in bytes into this buffer
- destOrigin- the origin of the copied area
- destRegion- the size of the copied area
- Returns:
- the event object
 
- 
acquireBufferForSharingAsyncDescription copied from class:BufferAcquires this buffer object for using. Only call this method if this buffer represents a shared object from OpenGL, created with e.g.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 callingBuffer.releaseBufferForSharingAsync(com.jme3.opencl.CommandQueue)so that OpenGL can use the VertexBuffer again.- Specified by:
- acquireBufferForSharingAsyncin class- Buffer
- Parameters:
- queue- the command queue
- Returns:
- the event object
 
- 
acquireBufferForSharingNoEventDescription copied from class:BufferAcquires this buffer object for using. Only call this method if this buffer represents a shared object from OpenGL, created with e.g.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 callingBuffer.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, useBuffer.acquireBufferForSharingAsync(com.jme3.opencl.CommandQueue)instead.- Overrides:
- acquireBufferForSharingNoEventin class- Buffer
- Parameters:
- queue- the command queue
 
- 
releaseBufferForSharingAsyncDescription copied from class:BufferReleases a shared buffer object. Call this method after the buffer object was acquired byBuffer.acquireBufferForSharingAsync(com.jme3.opencl.CommandQueue)to hand the control back to OpenGL.- Specified by:
- releaseBufferForSharingAsyncin class- Buffer
- Parameters:
- queue- the command queue
- Returns:
- the event object
 
- 
releaseBufferForSharingNoEventDescription copied from class:BufferReleases a shared buffer object. Call this method after the buffer object was acquired byBuffer.acquireBufferForSharingAsync(com.jme3.opencl.CommandQueue)to hand the control back to OpenGL. The generated event object is directly released, resulting in performance improvements.- Overrides:
- releaseBufferForSharingNoEventin class- Buffer
- Parameters:
- queue- the command queue
 
 
-