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

#include <UniformBufferBase.hpp>

Inheritance diagram for castor3d::UniformBufferBase:
Inheritance graph
[legend]

Public Member Functions

C3D_API UniformBufferBase (RenderSystem const &renderSystem, VkDeviceSize elemCount, VkDeviceSize elemSize, VkBufferUsageFlags usage, VkMemoryPropertyFlags flags, castor::String debugName, ashes::QueueShare sharingMode={})
 Constructor.
 
virtual C3D_API ~UniformBufferBase () noexcept=default
 Destructor.
 
C3D_API uint32_t initialise (RenderDevice const &device)
 Initialises the GPU buffer.
 
C3D_API uint32_t initialise (RenderDevice const &device, ashes::QueueShare sharingMode)
 Initialises the GPU buffer.
 
C3D_API void cleanup () noexcept
 Cleans up the GPU buffer.
 
C3D_API bool hasAvailable () const noexcept
 
C3D_API uint32_t allocate () noexcept
 Allocates a memory chunk for a CPU buffer.
 
C3D_API void deallocate (uint32_t offset)
 Deallocates memory.
 
C3D_API void upload (ashes::BufferBase const &stagingBuffer, ashes::Queue const &queue, ashes::CommandPool const &commandPool, const void *data, size_t size, uint32_t offset, VkPipelineStageFlags flags) const
 Transfers data to the GPU buffer from RAM.
 
void upload (ashes::BufferBase const &stagingBuffer, ashes::Queue const &queue, ashes::CommandPool const &commandPool, ashes::ByteArray const &data, uint32_t offset, VkPipelineStageFlags flags) const
 Transfers data to the GPU buffer from RAM.
 
C3D_API void upload (ashes::BufferBase const &stagingBuffer, ashes::CommandBuffer const &commandBuffer, const void *data, size_t size, uint32_t offset, VkPipelineStageFlags flags) const
 Transfers data to the GPU buffer from RAM.
 
void upload (ashes::BufferBase const &stagingBuffer, ashes::CommandBuffer const &commandBuffer, ashes::ByteArray const &data, uint32_t offset, VkPipelineStageFlags flags) const
 Transfers data to the GPU buffer from RAM.
 
C3D_API void upload (ashes::BufferBase const &stagingBuffer, ashes::Queue const &queue, ashes::CommandPool const &commandPool, const void *data, size_t size, uint32_t offset, VkPipelineStageFlags flags, FramePassTimer &timer) const
 Transfers data to the GPU buffer from RAM.
 
void upload (ashes::BufferBase const &stagingBuffer, ashes::Queue const &queue, ashes::CommandPool const &commandPool, ashes::ByteArray const &data, uint32_t offset, VkPipelineStageFlags flags, FramePassTimer &timer) const
 Transfers data to the GPU buffer from RAM.
 
C3D_API void upload (ashes::BufferBase const &stagingBuffer, ashes::CommandBuffer const &commandBuffer, const void *data, size_t size, uint32_t offset, VkPipelineStageFlags flags, FramePassTimer &timer) const
 Transfers data to the GPU buffer from RAM.
 
void upload (ashes::BufferBase const &stagingBuffer, ashes::CommandBuffer const &commandBuffer, ashes::ByteArray const &data, uint32_t offset, VkPipelineStageFlags flags, FramePassTimer &timer) const
 Transfers data to the GPU buffer from RAM.
 
C3D_API void download (ashes::BufferBase const &stagingBuffer, ashes::Queue const &queue, ashes::CommandPool const &commandPool, void *data, size_t size, uint32_t offset, VkPipelineStageFlags flags, FramePassTimer &timer) const
 Transfers data from the GPU buffer to RAM.
 
void download (ashes::BufferBase const &stagingBuffer, ashes::Queue const &queue, ashes::CommandPool const &commandPool, ashes::ByteArray &data, uint32_t offset, VkPipelineStageFlags flags, FramePassTimer &timer) const
 Transfers data from the GPU buffer to RAM.
 
bool hasBuffer () const
 
ashes::UniformBuffer const & getBuffer () const
 
ashes::UniformBuffer & getBuffer ()
 
uint32_t getElementSize () const
 
uint32_t getAlignedSize (uint32_t size) const
 Retrieves the aligned size for an element.
 
uint32_t getAlignedSize () const
 

Constructor & Destructor Documentation

◆ UniformBufferBase()

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

Constructor.

Parameters
[in]renderSystemThe RenderSystem.
[in]elemCountThe elements count.
[in]elemSizeThe elements size.
[in]usageThe buffer usage flags.
[in]flagsThe buffer memory flags.
[in]debugNameThe buffer debug name.
[in]sharingModeThe buffer sharing mode.

◆ ~UniformBufferBase()

virtual C3D_API castor3d::UniformBufferBase::~UniformBufferBase ( )
virtualdefaultnoexcept

Destructor.

Member Function Documentation

◆ allocate()

C3D_API uint32_t castor3d::UniformBufferBase::allocate ( )
noexcept

Allocates a memory chunk for a CPU buffer.

Returns
The memory chunk offset.

◆ cleanup()

C3D_API void castor3d::UniformBufferBase::cleanup ( )
noexcept

Cleans up the GPU buffer.

◆ deallocate()

C3D_API void castor3d::UniformBufferBase::deallocate ( uint32_t offset)

Deallocates memory.

Parameters
[in]offsetThe memory chunk offset.

◆ download() [1/2]

void castor3d::UniformBufferBase::download ( ashes::BufferBase const & stagingBuffer,
ashes::Queue const & queue,
ashes::CommandPool const & commandPool,
ashes::ByteArray & data,
uint32_t offset,
VkPipelineStageFlags flags,
FramePassTimer & timer ) const
inline

Transfers data from the GPU buffer to RAM.

Remarks
Transfers data from buffer[offset*sizeof( T )] to buffer[(offset+count-1)*sizeof( T )].
Parameters
[in]stagingBufferThe staging buffer used to transfer the data.
[in]queueThe queue used to execute the transfer.
[in]commandPoolThe command pool on which the command buffer will be created.
[in]dataReceives the data to download, packed.
[in]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.
[in]timerThe render pass timer.

References download().

Here is the call graph for this function:

◆ download() [2/2]

C3D_API void castor3d::UniformBufferBase::download ( ashes::BufferBase const & stagingBuffer,
ashes::Queue const & queue,
ashes::CommandPool const & commandPool,
void * data,
size_t size,
uint32_t offset,
VkPipelineStageFlags flags,
FramePassTimer & timer ) const

Transfers data from the GPU buffer to RAM.

Remarks
Transfers data from buffer[offset*sizeof( T )] to buffer[(offset+count-1)*sizeof( T )].
Parameters
[in]stagingBufferThe staging buffer used to transfer the data.
[in]queueThe queue used to execute the transfer.
[in]commandPoolThe command pool on which the command buffer will be created.
[in]dataReceives the data to download, packed.
[in]sizeThe data size.
[in]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.
[in]timerThe render pass timer.

Referenced by download().

Here is the caller graph for this function:

◆ getAlignedSize() [1/2]

uint32_t castor3d::UniformBufferBase::getAlignedSize ( ) const
inline
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::UniformBufferBase::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().

Here is the call graph for this function:

◆ getBuffer() [1/2]

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

◆ getBuffer() [2/2]

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

Referenced by getAlignedSize(), and getElementSize().

Here is the caller graph for this function:

◆ getElementSize()

uint32_t castor3d::UniformBufferBase::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:

◆ hasAvailable()

C3D_API bool castor3d::UniformBufferBase::hasAvailable ( ) const
noexcept
Returns
true if there is enough remaining memory for a new element.

◆ hasBuffer()

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

◆ initialise() [1/2]

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

Initialises the GPU buffer.

Parameters
[in]deviceThe GPU device.

◆ initialise() [2/2]

C3D_API uint32_t castor3d::UniformBufferBase::initialise ( RenderDevice const & device,
ashes::QueueShare sharingMode )

Initialises the GPU buffer.

Parameters
[in]deviceThe GPU device.
[in]sharingModeThe buffer sharing mode.

◆ upload() [1/8]

void castor3d::UniformBufferBase::upload ( ashes::BufferBase const & stagingBuffer,
ashes::CommandBuffer const & commandBuffer,
ashes::ByteArray const & data,
uint32_t offset,
VkPipelineStageFlags flags ) const
inline

Transfers data to the GPU buffer from RAM.

Remarks
Transfers data from buffer[offset*sizeof( T )] to buffer[(offset+count-1)*sizeof( T )].
Parameters
[in]stagingBufferThe staging buffer used to transfer the data.
[in]commandBufferThe command buffer on which the transfer commands are recorded.
[in]dataThe data to upload, packed (will be aligned on upload).
[in]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.

References upload().

Here is the call graph for this function:

◆ upload() [2/8]

void castor3d::UniformBufferBase::upload ( ashes::BufferBase const & stagingBuffer,
ashes::CommandBuffer const & commandBuffer,
ashes::ByteArray const & data,
uint32_t offset,
VkPipelineStageFlags flags,
FramePassTimer & timer ) const
inline

Transfers data to the GPU buffer from RAM.

Remarks
Transfers data from buffer[offset*sizeof( T )] to buffer[(offset+count-1)*sizeof( T )].
Parameters
[in]stagingBufferThe staging buffer used to transfer the data.
[in]commandBufferThe command buffer on which the transfer commands are recorded.
[in]dataThe data to upload, packed (will be aligned on upload).
[in]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.
[in]timerThe render pass timer.

References upload().

Here is the call graph for this function:

◆ upload() [3/8]

C3D_API void castor3d::UniformBufferBase::upload ( ashes::BufferBase const & stagingBuffer,
ashes::CommandBuffer const & commandBuffer,
const void * data,
size_t size,
uint32_t offset,
VkPipelineStageFlags flags ) const

Transfers data to the GPU buffer from RAM.

Remarks
Transfers data from buffer[offset*sizeof( T )] to buffer[(offset+count-1)*sizeof( T )].
Parameters
[in]stagingBufferThe staging buffer used to transfer the data.
[in]commandBufferThe command buffer on which the transfer commands are recorded.
[in]dataThe data to upload, packed (will be aligned on upload).
[in]sizeThe data size.
[in]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.

◆ upload() [4/8]

C3D_API void castor3d::UniformBufferBase::upload ( ashes::BufferBase const & stagingBuffer,
ashes::CommandBuffer const & commandBuffer,
const void * data,
size_t size,
uint32_t offset,
VkPipelineStageFlags flags,
FramePassTimer & timer ) const

Transfers data to the GPU buffer from RAM.

Remarks
Transfers data from buffer[offset*sizeof( T )] to buffer[(offset+count-1)*sizeof( T )].
Parameters
[in]stagingBufferThe staging buffer used to transfer the data.
[in]commandBufferThe command buffer on which the transfer commands are recorded.
[in]dataThe data to upload, packed (will be aligned on upload).
[in]sizeThe data size.
[in]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.
[in]timerThe render pass timer.

◆ upload() [5/8]

void castor3d::UniformBufferBase::upload ( ashes::BufferBase const & stagingBuffer,
ashes::Queue const & queue,
ashes::CommandPool const & commandPool,
ashes::ByteArray const & data,
uint32_t offset,
VkPipelineStageFlags flags ) const
inline

Transfers data to the GPU buffer from RAM.

Remarks
Transfers data from buffer[offset*sizeof( T )] to buffer[(offset+count-1)*sizeof( T )].
Parameters
[in]stagingBufferThe staging buffer used to transfer the data.
[in]queueThe queue used to execute the transfer.
[in]commandPoolThe command pool on which the command buffer will be created.
[in]dataThe data to upload, packed (will be aligned on upload).
[in]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.

References upload().

Here is the call graph for this function:

◆ upload() [6/8]

void castor3d::UniformBufferBase::upload ( ashes::BufferBase const & stagingBuffer,
ashes::Queue const & queue,
ashes::CommandPool const & commandPool,
ashes::ByteArray const & data,
uint32_t offset,
VkPipelineStageFlags flags,
FramePassTimer & timer ) const
inline

Transfers data to the GPU buffer from RAM.

Remarks
Transfers data from buffer[offset*sizeof( T )] to buffer[(offset+count-1)*sizeof( T )].
Parameters
[in]stagingBufferThe staging buffer used to transfer the data.
[in]queueThe queue used to execute the transfer.
[in]commandPoolThe command pool on which the command buffer will be created.
[in]dataThe data to upload, packed (will be aligned on upload).
[in]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.
[in]timerThe render pass timer.

References upload().

Here is the call graph for this function:

◆ upload() [7/8]

C3D_API void castor3d::UniformBufferBase::upload ( ashes::BufferBase const & stagingBuffer,
ashes::Queue const & queue,
ashes::CommandPool const & commandPool,
const void * data,
size_t size,
uint32_t offset,
VkPipelineStageFlags flags ) const

Transfers data to the GPU buffer from RAM.

Remarks
Transfers data from buffer[offset*sizeof( T )] to buffer[(offset+count-1)*sizeof( T )].
Parameters
[in]stagingBufferThe staging buffer used to transfer the data.
[in]queueThe queue used to execute the transfer.
[in]commandPoolThe command pool on which the command buffer will be created.
[in]dataThe data to upload, packed (will be aligned on upload).
[in]sizeThe data size.
[in]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.

Referenced by upload(), upload(), upload(), and upload().

Here is the caller graph for this function:

◆ upload() [8/8]

C3D_API void castor3d::UniformBufferBase::upload ( ashes::BufferBase const & stagingBuffer,
ashes::Queue const & queue,
ashes::CommandPool const & commandPool,
const void * data,
size_t size,
uint32_t offset,
VkPipelineStageFlags flags,
FramePassTimer & timer ) const

Transfers data to the GPU buffer from RAM.

Remarks
Transfers data from buffer[offset*sizeof( T )] to buffer[(offset+count-1)*sizeof( T )].
Parameters
[in]stagingBufferThe staging buffer used to transfer the data.
[in]queueThe queue used to execute the transfer.
[in]commandPoolThe command pool on which the command buffer will be created.
[in]dataThe data to upload, packed (will be aligned on upload).
[in]sizeThe data size.
[in]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.
[in]timerThe render pass timer.

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