HDK
|
#include <CE_BufferDevice.h>
Public Types | |
typedef T | value_type |
Public Member Functions | |
CE_BufferDevice () | |
Empty buffer constructor. More... | |
CE_BufferDevice (exint size) | |
Allocated an uninitialized buffer of specified size (if > 0). More... | |
CE_BufferDevice (cl::Buffer &&buf, exint size=-1) | |
CE_BufferDevice (const CE_BufferDevice< T > &b)=delete | |
No copy constructor. More... | |
CE_BufferDevice (CE_BufferDevice< T > &&b) noexcept | |
~CE_BufferDevice () | |
cl::Buffer | release () |
void | reset (cl::Buffer &&buf, exint size=-1) |
void | init (exint size) |
void | initFromArray (const UT_Array< T > &src, exint len=-1, bool block=true) |
Initialize from a UT_Array. If len >= 0, only len elements are copied. More... | |
void | matchAndCopyToArray (UT_Array< T > &dst, exint len=-1, bool block=true) const |
void | initFromData (const T *data, exint nelem, bool block=true) |
Initialize from raw data block of T elements of length nelem. More... | |
exint | size () const |
Returns the buffer length. More... | |
bool | isEmpty () const |
Returns true iff there are no occupied elements in the buffer. More... | |
const cl::Buffer & | buffer () const |
void | copyFrom (const CE_BufferDevice< T > &b, exint len=-1) |
Protected Member Functions | |
void | initInternal (exint size, bool doalloc=true) |
const cl::Buffer & | allocBuffer () const |
void | releaseBuffer () |
Protected Attributes | |
cl::Buffer | myBuffer |
exint | mySize |
Friends | |
void | swap (CE_BufferDevice< T > &a, CE_BufferDevice< T > &b) |
Definition at line 18 of file CE_BufferDevice.h.
typedef T CE_BufferDevice< T >::value_type |
Definition at line 22 of file CE_BufferDevice.h.
|
inline |
Empty buffer constructor.
Definition at line 25 of file CE_BufferDevice.h.
|
inline |
Allocated an uninitialized buffer of specified size (if > 0).
Definition at line 28 of file CE_BufferDevice.h.
|
inline |
Initialize from a raw cl::Buffer, which this object now owns. If size is not provided, calc from the buffer size and type. The input cl::Buffer is empty after this call.
Definition at line 39 of file CE_BufferDevice.h.
|
delete |
No copy constructor.
|
inlinenoexcept |
Definition at line 52 of file CE_BufferDevice.h.
|
inline |
Definition at line 61 of file CE_BufferDevice.h.
|
protected |
Definition at line 206 of file CE_BufferDevice.h.
|
inline |
Returns the underlying OpenCL buffer. Note: This is meant for directly passing to OpenCL functions. holding ownership over long times.
Definition at line 112 of file CE_BufferDevice.h.
void CE_BufferDevice< T >::copyFrom | ( | const CE_BufferDevice< T > & | b, |
exint | len = -1 |
||
) |
Copy from the input buffer. If len >= 0, only len elements are copied. NOTE: This object must already be initialized to a buffer of sufficient size.
Definition at line 225 of file CE_BufferDevice.h.
void CE_BufferDevice< T >::init | ( | exint | size | ) |
Initialize to given size. NOTE- values are undefined.
Definition at line 149 of file CE_BufferDevice.h.
void CE_BufferDevice< T >::initFromArray | ( | const UT_Array< T > & | src, |
exint | len = -1 , |
||
bool | block = true |
||
) |
Initialize from a UT_Array. If len >= 0, only len elements are copied.
Definition at line 156 of file CE_BufferDevice.h.
void CE_BufferDevice< T >::initFromData | ( | const T * | data, |
exint | nelem, | ||
bool | block = true |
||
) |
Initialize from raw data block of T elements of length nelem.
Definition at line 193 of file CE_BufferDevice.h.
|
protected |
Definition at line 139 of file CE_BufferDevice.h.
|
inline |
Returns true iff there are no occupied elements in the buffer.
Definition at line 107 of file CE_BufferDevice.h.
void CE_BufferDevice< T >::matchAndCopyToArray | ( | UT_Array< T > & | dst, |
exint | len = -1 , |
||
bool | block = true |
||
) | const |
Resize the provided UT_Array to fit and copy this vector's data there. If len >= 0 then only len elements are copied.
Definition at line 174 of file CE_BufferDevice.h.
|
inline |
Release and return the underlying buffer without deleting, after which this object is empty (similar to unique_ptr).
Definition at line 65 of file CE_BufferDevice.h.
|
protected |
Definition at line 216 of file CE_BufferDevice.h.
|
inline |
Reset to own the provided raw cl::Buffer. If size is not provided, calc from the buffer size and type. The input cl::Buffer is empty after this call.
Definition at line 76 of file CE_BufferDevice.h.
|
inline |
Returns the buffer length.
Definition at line 104 of file CE_BufferDevice.h.
|
friend |
Definition at line 119 of file CE_BufferDevice.h.
|
mutableprotected |
Definition at line 133 of file CE_BufferDevice.h.
|
protected |
Definition at line 134 of file CE_BufferDevice.h.