com.jogamp.opencl
Class CLBuffer<B extends Buffer>

java.lang.Object
  extended by com.jogamp.opencl.CLObject
      extended by com.jogamp.opencl.CLMemory<B>
          extended by com.jogamp.opencl.CLBuffer<B>
All Implemented Interfaces:
AutoCloseable, CLResource
Direct Known Subclasses:
CLGLBuffer, CLSubBuffer

public class CLBuffer<B extends Buffer>
extends CLMemory<B>

OpenCL buffer object wrapping an optional NIO buffer.

Author:
Michael Bien, et al.

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jogamp.opencl.CLMemory
CLMemory.GLObjectType, CLMemory.Map, CLMemory.Mem
 
Field Summary
 
Fields inherited from class com.jogamp.opencl.CLMemory
clCapacity, elementSize, FLAGS, size
 
Fields inherited from class com.jogamp.opencl.CLObject
context, ID
 
Constructor Summary
protected CLBuffer(CLContext context, B directBuffer, long size, long id, int flags)
           
protected CLBuffer(CLContext context, long size, long id, int flags)
           
 
Method Summary
<T extends Buffer>
CLBuffer<T>
cloneWith(T directBuffer)
          Returns a new instance of CLMemory pointing to the same CLResource but using a different Buffer.
 void close()
          Deprecated. This method is not intended to be called from client code.
 CLSubBuffer<B> createSubBuffer(int offset, int size, CLMemory.Mem... flags)
          Creates a sub buffer with the specified region from this buffer.
 List<CLSubBuffer<B>> getSubBuffers()
          Returns the list of subbuffers.
 boolean isReleased()
          Returns true if CLResource.release() has been called.
 boolean isSubBuffer()
          Returns true if this is a sub buffer.
 void release()
          Releases the OpenCL resource.
 
Methods inherited from class com.jogamp.opencl.CLMemory
equals, getBuffer, getCL, getCLCapacity, getCLSize, getConfig, getElementSize, getMapCount, getNIOCapacity, getNIOSize, getSizeImpl, hashCode, initCLCapacity, isHostPointerFlag, isReadOnly, isReadWrite, isWriteOnly, registerDestructorCallback, toString, use
 
Methods inherited from class com.jogamp.opencl.CLObject
getContext, getID, getPlatform
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CLBuffer

protected CLBuffer(CLContext context,
                   long size,
                   long id,
                   int flags)

CLBuffer

protected CLBuffer(CLContext context,
                   B directBuffer,
                   long size,
                   long id,
                   int flags)
Method Detail

createSubBuffer

public CLSubBuffer<B> createSubBuffer(int offset,
                                      int size,
                                      CLMemory.Mem... flags)
Creates a sub buffer with the specified region from this buffer. If this buffer contains a NIO buffer, the sub buffer will also contain a slice matching the specified region of the parent buffer. The region is specified by the offset and size in buffer elements or bytes if this buffer does not contain any NIO buffer.

Parameters:
offset - The offset in buffer elements.
size - The size in buffer elements.

release

public void release()
Description copied from interface: CLResource
Releases the OpenCL resource.

Specified by:
release in interface CLResource
Overrides:
release in class CLMemory<B extends Buffer>

getSubBuffers

public List<CLSubBuffer<B>> getSubBuffers()
Returns the list of subbuffers.


isSubBuffer

public boolean isSubBuffer()
Returns true if this is a sub buffer.


cloneWith

public <T extends Buffer> CLBuffer<T> cloneWith(T directBuffer)
Description copied from class: CLMemory
Returns a new instance of CLMemory pointing to the same CLResource but using a different Buffer.

Specified by:
cloneWith in class CLMemory<B extends Buffer>

close

@Deprecated
public final void close()
Deprecated. This method is not intended to be called from client code.

Implementation detail, satisfying AutoCloseable. Might be remove as soon we have extension methods, but shall validate with Java 1.5 specs.

Specified by:
close in interface AutoCloseable
See Also:
AutoCloseable

isReleased

public boolean isReleased()
Description copied from interface: CLResource
Returns true if CLResource.release() has been called.

Specified by:
isReleased in interface CLResource