![]() |
XII Release 0.1.0
|
Helper class that automates resource mapping and unmapping. More...
#include <MapHelper.h>
Public Member Functions | |
xiiGALMapHelper () | |
Default constructor. | |
xiiGALMapHelper (xiiSharedPtr< xiiGALCommandList > pCommandList, xiiSharedPtr< xiiGALBuffer > pBuffer, xiiEnum< xiiGALMapType > mapType, xiiBitflags< xiiGALMapFlags > mapFlags) | |
Constructs the helper and maps the specified resource. | |
xiiGALMapHelper (xiiGALMapHelper &&other) noexcept | |
Move constructor. | |
~xiiGALMapHelper () | |
Destructor, automatically unmaps the resource. | |
xiiGALMapHelper< DataType > & | operator= (xiiGALMapHelper &&other) noexcept |
Move assignment operator. | |
xiiResult | Map (xiiSharedPtr< xiiGALCommandList > pCommandList, xiiSharedPtr< xiiGALBuffer > pBuffer, xiiEnum< xiiGALMapType > mapType, xiiBitflags< xiiGALMapFlags > mapFlags) |
Maps the specified resource. | |
xiiResult | Unmap () |
Unmaps the specified resource. | |
operator DataType * () | |
Implicit conversion to DataType pointer. | |
operator const DataType * () const | |
Implicit conversion to const DataType pointer. | |
DataType * | operator-> () |
Provides direct access to the mapped data. | |
const DataType * | operator-> () const |
Provides direct access to the mapped data (const version). | |
XII_ALWAYS_INLINE DataType * | GetMappedData () const |
Returns a pointer to the mapped buffer data. | |
![]() | |
virtual const xiiRTTI * | GetDynamicRTTI () const |
bool | IsInstanceOf (const xiiRTTI *pType) const |
Returns whether the type of this instance is of the given type or derived from it. | |
template<typename T> | |
XII_ALWAYS_INLINE bool | IsInstanceOf () const |
Returns whether the type of this instance is of the given type or derived from it. | |
Additional Inherited Members | |
![]() | |
static const xiiRTTI * | GetStaticRTTI () |
Helper class that automates resource mapping and unmapping.
This class simplifies the process of mapping and unmapping resources within a command list. It automatically maps the specified resource upon construction and unmaps it upon destruction.
DataType | The type of data that will be mapped. |
Usage example:
XII_ALWAYS_INLINE xiiGALMapHelper< DataType >::xiiGALMapHelper | ( | xiiSharedPtr< xiiGALCommandList > | pCommandList, |
xiiSharedPtr< xiiGALBuffer > | pBuffer, | ||
xiiEnum< xiiGALMapType > | mapType, | ||
xiiBitflags< xiiGALMapFlags > | mapFlags ) |
Constructs the helper and maps the specified resource.
pCommandList | - Pointer to the command list. |
hBuffer | - Handle to the buffer resource. |
mapType | - Type of mapping operation. |
mapFlags | - Mapping flags. |
|
noexcept |
Move constructor.
other | - The other helper object to move from. |
XII_ALWAYS_INLINE DataType * xiiGALMapHelper< DataType >::GetMappedData | ( | ) | const |
Returns a pointer to the mapped buffer data.
This function provides direct access to the memory where the buffer is mapped. It is typically used for reading from or writing to GPU buffer memory directly, assuming the buffer has been properly mapped beforehand.
XII_FORCE_INLINE xiiResult xiiGALMapHelper< DataType >::Map | ( | xiiSharedPtr< xiiGALCommandList > | pCommandList, |
xiiSharedPtr< xiiGALBuffer > | pBuffer, | ||
xiiEnum< xiiGALMapType > | mapType, | ||
xiiBitflags< xiiGALMapFlags > | mapFlags ) |
Maps the specified resource.
pCommandList | - Pointer to the command list. |
hBuffer | - Handle to the buffer resource. |
mapType | - Type of mapping operation. |
mapFlags | - Mapping flags. |
XII_ALWAYS_INLINE DataType * xiiGALMapHelper< DataType >::operator-> | ( | ) |
Provides direct access to the mapped data.
XII_ALWAYS_INLINE const DataType * xiiGALMapHelper< DataType >::operator-> | ( | ) | const |
Provides direct access to the mapped data (const version).
|
noexcept |
Move assignment operator.
other | - The other helper object to move from. |
XII_FORCE_INLINE xiiResult xiiGALMapHelper< DataType >::Unmap | ( | ) |
Unmaps the specified resource.