Castor3D 0.16.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, VkBufferUsageFlags usage, VkMemoryPropertyFlags flags, castor::String debugName, ashes::QueueShare sharingMode={})
 Constructor.
 
C3D_API uint32_t initialise (RenderDevice const &device)
 Initialises the GPU buffer.
 
C3D_API void cleanup (RenderDevice const &device) noexcept
 Cleans up the GPU buffer.
 
C3D_API void flush ()
 Makes current local modifications available in VRAM.
 
C3D_API bool hasAvailable (VkDeviceSize size) const noexcept
 
C3D_API bool hasAllocated () const noexcept
 
C3D_API MemChunk allocate (VkDeviceSize size)
 Allocates a memory chunk for a CPU buffer.
 
C3D_API void deallocate (VkDeviceSize offset) noexcept
 Deallocates memory.
 
template<typename DataT >
DataT const & getData (VkDeviceSize offset) const noexcept
 
template<typename DataT >
DataT & getData (VkDeviceSize offset) noexcept
 
castor::ByteArrayView const & getDatas () const noexcept
 
castor::ByteArrayView & getDatas () noexcept
 
bool hasBuffer () const noexcept
 
ashes::UniformBuffer const & getBuffer () const noexcept
 
ashes::UniformBuffer & getBuffer () noexcept
 
uint32_t getElementSize () const noexcept
 
uint32_t getAlignedSize (uint32_t size) const noexcept
 Retrieves the aligned size for an element.
 
uint32_t getAlignedSize () const noexcept
 

Constructor & Destructor Documentation

◆ PoolUniformBuffer()

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

Constructor.

Parameters
[in]renderSystemThe RenderSystem.
[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)
noexcept

Cleans up the GPU buffer.

Parameters
[in]deviceThe GPU device.

◆ deallocate()

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

Deallocates memory.

Parameters
[in]offsetThe memory chunk offset.

◆ flush()

C3D_API void castor3d::PoolUniformBuffer::flush ( )

Makes current local modifications available in VRAM.

◆ getAlignedSize() [1/2]

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

References getAlignedSize(), and getElementSize().

Referenced by getAlignedSize(), and 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
inlinenoexcept

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(), castor3d::UniformBufferOffsetT< DataT >::getData(), 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 const & castor3d::PoolUniformBuffer::getBuffer ( ) const
inlinenoexcept

◆ getBuffer() [2/2]

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

◆ getData() [1/2]

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

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

Here is the caller graph for this function:

◆ getData() [2/2]

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

◆ getDatas() [1/2]

castor::ByteArrayView const & castor3d::PoolUniformBuffer::getDatas ( ) const
inlinenoexcept
Returns
The data.

◆ getDatas() [2/2]

castor::ByteArrayView & castor3d::PoolUniformBuffer::getDatas ( )
inlinenoexcept
Returns
The data.

◆ getElementSize()

uint32_t castor3d::PoolUniformBuffer::getElementSize ( ) const
inlinenoexcept
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
noexcept
Returns
true if at least one element has been allocated.

◆ hasAvailable()

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

◆ hasBuffer()

bool castor3d::PoolUniformBuffer::hasBuffer ( ) const
inlinenoexcept
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.

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