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

java.lang.Object
  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

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jogamp.opencl.CLMemory
CLMemory.GLObjectType, CLMemory.Map, CLMemory.Mem
 
Field Summary
protected  CL cl
           
protected  CLContext context
           
 long ID
          The OpenCL object handle.
 
Fields inherited from class com.jogamp.opencl.CLMemory
clCapacity, elementSize, FLAGS, size
 
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.
 CLContext getContext()
          Returns the context for this OpenCL object.
 long getID()
          Returns the OpenCL object handle
 CLPlatform getPlatform()
          Returns the platform for this OpenCL object.
 List<CLSubBuffer<B>> getSubBuffers()
          Returns the list of subbuffers.
 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, isHostPointerFlag, isReadOnly, isReadWrite, isWriteOnly, registerDestructorCallback, toString, use
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

public final long ID
The OpenCL object handle.


context

protected CLContext context

cl

protected final CL cl
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. TODO remove as soon we have extension methods.

Specified by:
close in interface AutoCloseable
See Also:
AutoCloseable

getContext

public CLContext getContext()
Returns the context for this OpenCL object.


getPlatform

public CLPlatform getPlatform()
Returns the platform for this OpenCL object.


getID

public long getID()
Returns the OpenCL object handle