Cloo 0.9.1

- Main Page
- Packages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

Represents an OpenCL buffer. More...

Inheritance diagram for Cloo.ComputeBuffer< T >:

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:

  T | The type of the elements of the ComputeBuffer{T}. T is restricted to value types and `struct`s 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:

  context | A ComputeContext used to create the ComputeBuffer{T}.
  flags | A bit-field that is used to specify allocation and usage information about the ComputeBuffer{T}.
  count | The 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:

  context | A ComputeContext used to create the ComputeBuffer{T}.
  flags | A bit-field that is used to specify allocation and usage information about the ComputeBuffer{T}.
  count | The number of elements of the ComputeBuffer{T}.
  dataPtr | A 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:

  context | A ComputeContext used to create the ComputeBuffer{T}.
  flags | A bit-field that is used to specify allocation and usage information about the ComputeBuffer{T}.
  data | The 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:

  DataType | The type of the elements of the ComputeBuffer{T}. T should match the type of the elements in the OpenGL buffer.

Parameters:

  context | A ComputeContext with enabled CL/GL sharing.
  flags | A bit-field that is used to specify usage information about the ComputeBuffer{T}. Only ComputeMemoryFlags.ReadOnly, ComputeMemoryFlags.WriteOnly and ComputeMemoryFlags.ReadWrite are allowed.
  bufferId | The 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:

- Cloo/Source/ComputeBuffer.cs