C++ API Reference
|
Store GPU Representation of a data buffer. More...
#include <MPxGPUDeformer.h>
Public Member Functions | |
MGPUDeformerBuffer (const MPlug &plug, const MUniqueString &name, bool readOnly, unsigned int elementSizeInBytes, unsigned int elementCount, unsigned int capacityInBytes, const MAutoCLMem &buffer, const MAutoCLEvent &event) | |
Constructs an MGPUDeformerBuffer for an existing MAutoCLMem. More... | |
MGPUDeformerBuffer () | |
Constructs an empty MGPUDeformerBuffer which cannot be used. | |
~MGPUDeformerBuffer () | |
Destructor. | |
MGPUDeformerBuffer (const MGPUDeformerBuffer &other) | |
Copy constructor. More... | |
MGPUDeformerBuffer (MGPUDeformerBuffer &&other) | |
Move Constructor. More... | |
MGPUDeformerBuffer & | operator= (const MGPUDeformerBuffer &other) |
Copy Assignment Operator. More... | |
MGPUDeformerBuffer & | operator= (MGPUDeformerBuffer &&other) |
Move assignment operator. More... | |
MOpenCLBuffer | createMOpenCLBuffer () |
Create and return an MOpenCLBuffer backed by the same GPU buffer that this MGPUDeformerBuffer is backed by. More... | |
bool | isValid () const |
const MUniqueString | name () const |
It is only safe to call name() when MGPUDeformerBuffer is valid. More... | |
const MPlug | plug () const |
It is only safe to call name() when MGPUDeformerBuffer is valid. More... | |
bool | isReadOnly () const |
It is only safe to call isReadOnly() when MGPUDeformerBuffer is valid. More... | |
unsigned int | elementSizeInBytes () const |
It is only safe to call elementSizeInBytes() when MGPUDeformerBuffer is valid. More... | |
unsigned int | elementCount () const |
It is only safe to call elementCount() when MGPUDeformerBuffer is valid. More... | |
const MAutoCLMem | buffer () const |
It is only safe to call buffer() when MGPUDeformerBuffer is valid. More... | |
const MAutoCLEvent | bufferReadyEvent () const |
It is only safe to call bufferReadyEvent() when MGPUDeformerBuffer is valid. More... | |
void | setBufferReadyEvent (const MAutoCLEvent &) |
It is only safe to call setBufferReadyEvent() when MGPUDeformerBuffer is valid. More... | |
void | destroy () |
Release all resources and references held by this MGPUDeformerBuffer. More... | |
Store GPU Representation of a data buffer.
MGPUDeformerBuffer is a simple buffer structure to group data related to a single GPU buffer which is associated with a plug in the DG.
MGPUDeformerBuffer | ( | const MPlug & | plug, |
const MUniqueString & | name, | ||
bool | readOnly, | ||
unsigned int | elementSizeInBytes, | ||
unsigned int | elementCount, | ||
unsigned int | capacityInBytes, | ||
const MAutoCLMem & | buffer, | ||
const MAutoCLEvent & | event | ||
) |
Constructs an MGPUDeformerBuffer for an existing MAutoCLMem.
capacityInBytes must be less than or equal to the actual size of the cl_mem held by buffer. elementSizeInBytes() * elementCount must be less than or equal to capacityInBytes.
[in] | plug | The plug whose data this buffer represents. |
[in] | name | The name of the buffer. |
[in] | readOnly | True if the MGPUDeformerBuffer is a read only buffer. |
[in] | elementSizeInBytes | The size of each element in the buffer in bytes. |
[in] | elementCount | The number of elements stored in the buffer. |
[in] | capacityInBytes | The capacity of the cl_mem in bytes. |
[in] | buffer | The OpenCL memory resource. |
[in] | event | The data is buffer is safe to read when event holds a NULL event or event is complete. |
MGPUDeformerBuffer | ( | const MGPUDeformerBuffer & | other | ) |
Copy constructor.
"This" and "other" will have different MAutoCLMem objects which reference the same underlying cl_mem. "This" and "other will have difference MAutoCLEvent objects which reference the same underlying cl_event.
[in] | other | MGPUDeformerBuffer to be copied. |
MGPUDeformerBuffer | ( | MGPUDeformerBuffer && | other | ) |
Move Constructor.
[in] | other | rvalue to "steal" resources from. |
MGPUDeformerBuffer & operator= | ( | const MGPUDeformerBuffer & | other | ) |
Copy Assignment Operator.
"This" and "other" will have different MAutoCLMem objects which reference the same underlying cl_mem. "This" and "other will have difference MAutoCLEvent objects which reference the same underlying cl_event.
[in] | other | MGPUDeformerBuffer to be copied. |
MGPUDeformerBuffer & operator= | ( | MGPUDeformerBuffer && | other | ) |
Move assignment operator.
[in] | other | rvalue to "steal" resources from. |
MOpenCLBuffer createMOpenCLBuffer | ( | ) |
Create and return an MOpenCLBuffer backed by the same GPU buffer that this MGPUDeformerBuffer is backed by.
If this MGPUDeformerBuffer is read only that property is inherited by the created MOpenCLBuffer.
To create a writable MOpenCLBuffer from a read only MGPUDeformerBuffer you must first call MPxGPUDeformer::createOutputBuffer().
bool isValid | ( | ) | const |
const MUniqueString name | ( | ) | const |
It is only safe to call name() when MGPUDeformerBuffer is valid.
const MPlug plug | ( | ) | const |
It is only safe to call name() when MGPUDeformerBuffer is valid.
bool isReadOnly | ( | ) | const |
It is only safe to call isReadOnly() when MGPUDeformerBuffer is valid.
unsigned int elementSizeInBytes | ( | ) | const |
It is only safe to call elementSizeInBytes() when MGPUDeformerBuffer is valid.
unsigned int elementCount | ( | ) | const |
It is only safe to call elementCount() when MGPUDeformerBuffer is valid.
const MAutoCLMem buffer | ( | ) | const |
It is only safe to call buffer() when MGPUDeformerBuffer is valid.
const MAutoCLEvent bufferReadyEvent | ( | ) | const |
It is only safe to call bufferReadyEvent() when MGPUDeformerBuffer is valid.
void setBufferReadyEvent | ( | const MAutoCLEvent & | event | ) |
It is only safe to call setBufferReadyEvent() when MGPUDeformerBuffer is valid.
void destroy | ( | ) |
Release all resources and references held by this MGPUDeformerBuffer.
This may or may not release the last reference to a cl_mem or cl_event object.