XII Release 0.1.0
Loading...
Searching...
No Matches
xiiGALMapHelper< DataType > Class Template Reference

Copyright (c) Theophilus Eriata. All Rights Reserved. More...

#include <MapHelper.h>

Public Member Functions

 xiiGALMapHelper ()
 Default constructor.
 xiiGALMapHelper (xiiGALCommandList *pCommandList, xiiGALBuffer *pBuffer, xiiEnum< xiiGALMapType > mapType, xiiBitflags< xiiGALMapFlags > mapFlags)
 xiiGALMapHelper (xiiGALCommandList &commandList, xiiGALBuffer *pBuffer, xiiEnum< xiiGALMapType > mapType, xiiBitflags< xiiGALMapFlags > mapFlags)
 xiiGALMapHelper (xiiGALMapHelper &&other) noexcept
 ~xiiGALMapHelper ()
 Destructor, automatically unmaps the resource.
xiiGALMapHelper< DataType > & operator= (xiiGALMapHelper &&other) noexcept
xiiResult Map (xiiGALCommandList *pCommandList, xiiGALBuffer *pBuffer, xiiEnum< xiiGALMapType > mapType, xiiBitflags< xiiGALMapFlags > mapFlags)
xiiResult Unmap ()
 operator DataType * ()
 Implicit conversion to DataType pointer.
 operator const DataType * () const
 Implicit conversion to const DataType pointer.
DataType * operator-> ()
const DataType * operator-> () const
XII_ALWAYS_INLINE DataType * GetMappedData () const

Detailed Description

template<typename DataType>
class xiiGALMapHelper< DataType >

Copyright (c) Theophilus Eriata. All Rights Reserved.

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.

Template Parameters
DataTypeThe type of data that will be mapped.
Note
This class is designed to streamline manual mapping/unmapping operations.

Usage example:

{
mapHelper->m_uiVar = 1.0f; // Access mapped data
}
xiiGALMapHelper()
Default constructor.
Definition MapHelper_inl.h:4
@ Discard
Definition GraphicsTypes.h:389
@ Read
The resource is mapped for reading.
Definition GraphicsTypes.h:366

Constructor & Destructor Documentation

◆ xiiGALMapHelper() [1/4]

template<typename DataType>
XII_ALWAYS_INLINE xiiGALMapHelper< DataType >::xiiGALMapHelper ( )

Default constructor.

Copyright (c) Theophilus Eriata. All Rights Reserved.

◆ xiiGALMapHelper() [2/4]

template<typename DataType>
XII_ALWAYS_INLINE xiiGALMapHelper< DataType >::xiiGALMapHelper ( xiiGALCommandList * pCommandList,
xiiGALBuffer * pBuffer,
xiiEnum< xiiGALMapType > mapType,
xiiBitflags< xiiGALMapFlags > mapFlags )

Constructs the helper and maps the specified resource.

Parameters
pCommandList- Pointer to the command list.
hBuffer- Handle to the buffer resource.
mapType- Type of mapping operation.
mapFlags- Mapping flags.

◆ xiiGALMapHelper() [3/4]

template<typename DataType>
XII_ALWAYS_INLINE xiiGALMapHelper< DataType >::xiiGALMapHelper ( xiiGALCommandList & commandList,
xiiGALBuffer * pBuffer,
xiiEnum< xiiGALMapType > mapType,
xiiBitflags< xiiGALMapFlags > mapFlags )

Constructs the helper and maps the specified resource.

Parameters
commandList- Reference to the command list.
hBuffer- Handle to the buffer resource.
mapType- Type of mapping operation.
mapFlags- Mapping flags.

◆ xiiGALMapHelper() [4/4]

template<typename DataType>
XII_ALWAYS_INLINE xiiGALMapHelper< DataType >::xiiGALMapHelper ( xiiGALMapHelper< DataType > && other)
noexcept

Move constructor.

Parameters
other- The other helper object to move from.

Member Function Documentation

◆ GetMappedData()

template<typename DataType>
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.

Returns
A raw pointer to the mapped data buffer.

◆ Map()

template<typename DataType>
XII_FORCE_INLINE xiiResult xiiGALMapHelper< DataType >::Map ( xiiGALCommandList * pCommandList,
xiiGALBuffer * pBuffer,
xiiEnum< xiiGALMapType > mapType,
xiiBitflags< xiiGALMapFlags > mapFlags )

Maps the specified resource.

Parameters
pCommandList- Pointer to the command list.
hBuffer- Handle to the buffer resource.
mapType- Type of mapping operation.
mapFlags- Mapping flags.
Returns
Result of the operation.

◆ operator->() [1/2]

template<typename DataType>
XII_ALWAYS_INLINE DataType * xiiGALMapHelper< DataType >::operator-> ( )

Provides direct access to the mapped data.

Returns
Pointer to the mapped data.

◆ operator->() [2/2]

template<typename DataType>
XII_ALWAYS_INLINE const DataType * xiiGALMapHelper< DataType >::operator-> ( ) const

Provides direct access to the mapped data (const version).

Returns
Pointer to the mapped data.

◆ operator=()

template<typename DataType>
XII_ALWAYS_INLINE xiiGALMapHelper< DataType > & xiiGALMapHelper< DataType >::operator= ( xiiGALMapHelper< DataType > && other)
noexcept

Move assignment operator.

Parameters
other- The other helper object to move from.
Returns
Reference to this object.

◆ Unmap()

template<typename DataType>
XII_FORCE_INLINE xiiResult xiiGALMapHelper< DataType >::Unmap ( )

Unmaps the specified resource.

Returns
Result of the operation.

The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/GraphicsFoundation/Tools/MapHelper.h
  • /home/runner/work/XII/XII/Source/Engine/GraphicsFoundation/Tools/Implementation/MapHelper_inl.h