Castor3D 0.12.0
Multiplatform 3D engine
Public Member Functions | List of all members
castor3d::PoolUniformBuffer Class Reference

#include <PoolUniformBuffer.hpp>

Public Member Functions

C3D_API PoolUniformBuffer (RenderSystem const &renderSystem, castor::ArrayView< uint8_t > data, VkBufferUsageFlags usage, VkMemoryPropertyFlags flags, castor::String debugName, ashes::QueueShare sharingMode={})
 Constructor. More...
 
C3D_API uint32_t initialise (RenderDevice const &device)
 Initialises the GPU buffer. More...
 
C3D_API void cleanup (RenderDevice const &device)
 Cleans up the GPU buffer. More...
 
C3D_API bool hasAvailable (VkDeviceSize size) const
 
C3D_API bool hasAllocated () const
 
C3D_API MemChunk allocate (VkDeviceSize size)
 Allocates a memory chunk for a CPU buffer. More...
 
C3D_API void deallocate (VkDeviceSize offset)
 Deallocates memory. More...
 
template<typename DataT >
DataT const & getData (VkDeviceSize offset) const
 
template<typename DataT >
DataT & getData (VkDeviceSize offset)
 
castor::ArrayView< uint8_t > const & getDatas () const
 
castor::ArrayView< uint8_t > & getDatas ()
 
bool hasBuffer () const
 
ashes::UniformBuffer const & getBuffer () const
 
 operator ashes::UniformBuffer const & () const
 
ashes::UniformBuffer & getBuffer ()
 
 operator ashes::UniformBuffer & ()
 
uint32_t getElementSize () const
 
uint32_t getAlignedSize (uint32_t size) const
 Retrieves the aligned size for an element. More...
 
uint32_t getAlignedSize () const
 

Constructor & Destructor Documentation

◆ PoolUniformBuffer()

C3D_API castor3d::PoolUniformBuffer::PoolUniformBuffer ( RenderSystem const &  renderSystem,
castor::ArrayView< uint8_t >  data,
VkBufferUsageFlags  usage,
VkMemoryPropertyFlags  flags,
castor::String  debugName,
ashes::QueueShare  sharingMode = {} 
)

Constructor.

Parameters
[in]renderSystemThe RenderSystem.
[in]dataThe mapped data.
[in]usageThe buffer usage flags.
[in]flagsThe buffer memory flags.
[in]debugNameThe buffer debug name.
[in]sharingModeThe sharing mode.

Member Function Documentation

◆ allocate()

C3D_API MemChunk castor3d::PoolUniformBuffer::allocate ( VkDeviceSize  size)

Allocates a memory chunk for a CPU buffer.

Parameters
sizeThe size wanted.
Returns
The memory chunk offset.

◆ cleanup()

C3D_API void castor3d::PoolUniformBuffer::cleanup ( RenderDevice const &  device)

Cleans up the GPU buffer.

Parameters
[in]deviceThe GPU device.

◆ deallocate()

C3D_API void castor3d::PoolUniformBuffer::deallocate ( VkDeviceSize  offset)

Deallocates memory.

Parameters
[in]offsetThe memory chunk offset.

◆ getAlignedSize() [1/2]

uint32_t castor3d::PoolUniformBuffer::getAlignedSize ( ) const
inline
Returns
The aligned size for an element.

References getAlignedSize(), and getElementSize().

Referenced by getAlignedSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAlignedSize() [2/2]

uint32_t castor3d::PoolUniformBuffer::getAlignedSize ( uint32_t  size) const
inline

Retrieves the aligned size for an element.

Parameters
[in]sizeThe size of an element.
Returns
The aligned size.

References getAlignedSize(), and getBuffer().

Referenced by castor3d::UniformBufferOffsetT< DataT >::getAlignedSize(), and castor3d::UniformBufferOffsetT< DataT >::getData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBuffer() [1/2]

ashes::UniformBuffer & castor3d::PoolUniformBuffer::getBuffer ( )
inline
Returns
The internal buffer.

◆ getBuffer() [2/2]

ashes::UniformBuffer const & castor3d::PoolUniformBuffer::getBuffer ( ) const
inline

◆ getData() [1/2]

template<typename DataT >
DataT & castor3d::PoolUniformBuffer::getData ( VkDeviceSize  offset)
inline
Returns
The N-th instance of the data.
Parameters
[in]offsetThe memory chunk offset.

◆ getData() [2/2]

template<typename DataT >
DataT const & castor3d::PoolUniformBuffer::getData ( VkDeviceSize  offset) const
inline
Returns
The N-th instance of the data.
Parameters
[in]offsetThe memory chunk offset.

Referenced by castor3d::UniformBufferOffsetT< DataT >::getData().

Here is the caller graph for this function:

◆ getDatas() [1/2]

castor::ArrayView< uint8_t > & castor3d::PoolUniformBuffer::getDatas ( )
inline
Returns
The data.

◆ getDatas() [2/2]

castor::ArrayView< uint8_t > const & castor3d::PoolUniformBuffer::getDatas ( ) const
inline
Returns
The data.

◆ getElementSize()

uint32_t castor3d::PoolUniformBuffer::getElementSize ( ) const
inline
Returns
The size of one element in the buffer.

References getBuffer(), and getElementSize().

Referenced by getAlignedSize(), and getElementSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasAllocated()

C3D_API bool castor3d::PoolUniformBuffer::hasAllocated ( ) const
Returns
true if at least one element has been allocated.

◆ hasAvailable()

C3D_API bool castor3d::PoolUniformBuffer::hasAvailable ( VkDeviceSize  size) const
Parameters
sizeThe size wanted.
Returns
true if there is enough remaining memory for a new element.

◆ hasBuffer()

bool castor3d::PoolUniformBuffer::hasBuffer ( ) const
inline
Returns
false if the internal buffer doesn't exist.

Referenced by castor3d::UniformBufferOffsetT< DataT >::operator bool().

Here is the caller graph for this function:

◆ initialise()

C3D_API uint32_t castor3d::PoolUniformBuffer::initialise ( RenderDevice const &  device)

Initialises the GPU buffer.

Parameters
[in]deviceThe GPU device.

◆ operator ashes::UniformBuffer &()

castor3d::PoolUniformBuffer::operator ashes::UniformBuffer & ( )
inline

◆ operator ashes::UniformBuffer const &()

castor3d::PoolUniformBuffer::operator ashes::UniformBuffer const & ( ) const
inline

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