C++ API Reference
MGPUDeformerBuffer Class Reference

Store GPU Representation of a data buffer. More...

#include <MPxGPUDeformer.h>

Public Member Functions

 MGPUDeformerBuffer (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...
 
MGPUDeformerBufferoperator= (const MGPUDeformerBuffer &other)
 Copy Assignment Operator. More...
 
MGPUDeformerBufferoperator= (MGPUDeformerBuffer &&other)
 Move assignment operator. More...
 
bool isValid () const
 
const MUniqueString name () 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...
 

Detailed Description

Store GPU Representation of a data buffer.

MGPUDeformerBuffer is a simple buffer structure to group data related to a single GPU buffer.

Examples:
identityNode/identityNode.cpp, and offsetNode/offsetNode.cpp.

Constructor & Destructor Documentation

MGPUDeformerBuffer ( 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.

Parameters
[in]nameThe name of the buffer.
[in]readOnlyTrue if the MGPUDeformerBuffer is a read only buffer.
[in]elementSizeInBytesThe size of each element in the buffer in bytes.
[in]elementCountThe number of elements stored in the buffer.
[in]capacityInBytesThe capacity of the cl_mem in bytes.
[in]bufferThe OpenCL memory resource.
[in]eventThe data is buffer is safe to read when event holds a NULL event or event is complete.

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.

Parameters
[in]otherMGPUDeformerBuffer to be copied.

Move Constructor.

Parameters
[in]otherrvalue to "steal" resources from.

Member Function Documentation

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.

Parameters
[in]otherMGPUDeformerBuffer to be copied.
MGPUDeformerBuffer & operator= ( MGPUDeformerBuffer &&  other)

Move assignment operator.

Parameters
[in]otherrvalue to "steal" resources from.
bool isValid ( ) const
Returns
true if the MGPUDeformerBuffer is valid and safe to use.
Examples:
identityNode/identityNode.cpp, and offsetNode/offsetNode.cpp.
const MUniqueString name ( ) const

It is only safe to call name() when MGPUDeformerBuffer is valid.

Returns
The name of the MGPUDeformerBuffer.
bool isReadOnly ( ) const

It is only safe to call isReadOnly() when MGPUDeformerBuffer is valid.

Returns
true if the buffer is read only.
unsigned int elementSizeInBytes ( ) const

It is only safe to call elementSizeInBytes() when MGPUDeformerBuffer is valid.

Returns
The size in bytes of each element of the MGPUDeformerBuffer.
unsigned int elementCount ( ) const

It is only safe to call elementCount() when MGPUDeformerBuffer is valid.

Returns
The number of elements in the MGPUDeformerBuffer.
Examples:
identityNode/identityNode.cpp, and offsetNode/offsetNode.cpp.
const MAutoCLMem buffer ( ) const

It is only safe to call buffer() when MGPUDeformerBuffer is valid.

Returns
The OpenCL representation of the MGPUDeformerBuffer.
const MAutoCLEvent bufferReadyEvent ( ) const

It is only safe to call bufferReadyEvent() when MGPUDeformerBuffer is valid.

Returns
The event to wait on before reading the contents of buffer.
Examples:
identityNode/identityNode.cpp, and offsetNode/offsetNode.cpp.
void setBufferReadyEvent ( const MAutoCLEvent event)

It is only safe to call setBufferReadyEvent() when MGPUDeformerBuffer is valid.

Returns
A non-constant reference to the event to wait on which can be set after enqueuing work which modifies the buffer.
Examples:
identityNode/identityNode.cpp, and offsetNode/offsetNode.cpp.
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.


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