Cloo 0.9.1
Public Member Functions | Static Public Member Functions
Cloo.ComputeBuffer< T > Class Template Reference

Represents an OpenCL buffer. More...

Inheritance diagram for Cloo.ComputeBuffer< T >:
Cloo.ComputeBufferBase< T > Cloo.ComputeMemory Cloo.ComputeResource Cloo.ComputeObject

List of all members.

Public Member Functions

 ComputeBuffer (ComputeContext context, ComputeMemoryFlags flags, long count)
 Creates a new ComputeBuffer{T}.
 ComputeBuffer (ComputeContext context, ComputeMemoryFlags flags, long count, IntPtr dataPtr)
 Creates a new ComputeBuffer{T}.
 ComputeBuffer (ComputeContext context, ComputeMemoryFlags flags, T[] data)
 Creates a new ComputeBuffer{T}.

Static Public Member Functions

static ComputeBuffer< DataType > CreateFromGLBuffer< DataType > (ComputeContext context, ComputeMemoryFlags flags, int bufferId)
 Creates a new ComputeBuffer{T} from an existing OpenGL buffer object.

Detailed Description

template<T>
class Cloo::ComputeBuffer< T >

Represents an OpenCL buffer.

Template Parameters:
TThe type of the elements of the ComputeBuffer{T}. T is restricted to value types and structs containing such types.

A memory object that stores a linear collection of bytes. Buffer objects are accessible using a pointer in a kernel executing on a device.

See also:
ComputeDevice, ComputeKernel, ComputeMemory
Type Constraints
T :struct 

Member Function Documentation

template<T >
Cloo.ComputeBuffer< T >.ComputeBuffer ( ComputeContext  context,
ComputeMemoryFlags  flags,
long  count 
)

Creates a new ComputeBuffer{T}.

Parameters:
contextA ComputeContext used to create the ComputeBuffer{T}.
flagsA bit-field that is used to specify allocation and usage information about the ComputeBuffer{T}.
countThe number of elements of the ComputeBuffer{T}.
template<T >
Cloo.ComputeBuffer< T >.ComputeBuffer ( ComputeContext  context,
ComputeMemoryFlags  flags,
long  count,
IntPtr  dataPtr 
)

Creates a new ComputeBuffer{T}.

Parameters:
contextA ComputeContext used to create the ComputeBuffer{T}.
flagsA bit-field that is used to specify allocation and usage information about the ComputeBuffer{T}.
countThe number of elements of the ComputeBuffer{T}.
dataPtrA pointer to the data for the ComputeBuffer{T}.
template<T >
Cloo.ComputeBuffer< T >.ComputeBuffer ( ComputeContext  context,
ComputeMemoryFlags  flags,
T[]  data 
)

Creates a new ComputeBuffer{T}.

Parameters:
contextA ComputeContext used to create the ComputeBuffer{T}.
flagsA bit-field that is used to specify allocation and usage information about the ComputeBuffer{T}.
dataThe data for the ComputeBuffer{T}.

Note, that data cannot be an "immediate" parameter, i.e.: new T[100], because it could be quickly collected by the GC causing Cloo to send and invalid reference to OpenCL.

template<T >
static ComputeBuffer<DataType> Cloo.ComputeBuffer< T >.CreateFromGLBuffer< DataType > ( ComputeContext  context,
ComputeMemoryFlags  flags,
int  bufferId 
) [static]

Creates a new ComputeBuffer{T} from an existing OpenGL buffer object.

Template Parameters:
DataTypeThe type of the elements of the ComputeBuffer{T}. T should match the type of the elements in the OpenGL buffer.
Parameters:
contextA ComputeContext with enabled CL/GL sharing.
flagsA bit-field that is used to specify usage information about the ComputeBuffer{T}. Only ComputeMemoryFlags.ReadOnly, ComputeMemoryFlags.WriteOnly and ComputeMemoryFlags.ReadWrite are allowed.
bufferIdThe OpenGL buffer object id to use for the creation of the ComputeBuffer{T}.
Returns:
The created ComputeBuffer{T}.
Type Constraints
DataType :struct 

The documentation for this class was generated from the following file: