Castor3D 0.16.0
Multiplatform 3D engine
Public Member Functions | List of all members
castor3d::UniformBufferT< DataT > Class Template Reference

A uniform typed buffer, than can contain multiple sub-buffers. More...

#include <UniformBuffer.hpp>

Inheritance diagram for castor3d::UniformBufferT< DataT >:
Inheritance graph
[legend]
Collaboration diagram for castor3d::UniformBufferT< DataT >:
Collaboration graph
[legend]

Public Member Functions

 UniformBufferT (RenderSystem const &renderSystem, VkDeviceSize count, VkBufferUsageFlags usage, VkMemoryPropertyFlags flags, castor::String debugName, ashes::QueueShare sharingMode={})
 Constructor.
 
void upload (ashes::BufferBase const &stagingBuffer, ashes::Queue const &queue, ashes::CommandPool const &commandPool, uint32_t offset, VkPipelineStageFlags flags) const
 Transfers data to the GPU buffer from RAM.
 
void upload (ashes::BufferBase const &stagingBuffer, ashes::CommandBuffer const &commandBuffer, 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, uint32_t offset, VkPipelineStageFlags flags, FramePassTimer const &timer, uint32_t index) const
 Transfers data to the GPU buffer from RAM.
 
void upload (ashes::BufferBase const &stagingBuffer, ashes::CommandBuffer const &commandBuffer, uint32_t offset, VkPipelineStageFlags flags, FramePassTimer const &timer, uint32_t index) const
 Transfers data to the GPU buffer from RAM.
 
void upload (VkDeviceSize offset=0u, VkDeviceSize range=1u) const
 Uploads the buffer data to VRAM.
 
void download (ashes::BufferBase const &stagingBuffer, ashes::Queue const &queue, ashes::CommandPool const &commandPool, uint32_t offset, VkPipelineStageFlags flags, FramePassTimer const &timer, uint32_t index)
 Transfers data from the GPU buffer to RAM.
 
DataT const & getData (VkDeviceSize index=0) const
 
DataT & getData (VkDeviceSize index=0)
 
castor::Vector< DataT > const & getDatas () const
 
castor::Vector< DataT > & getDatas ()
 
- Public Member Functions inherited from castor3d::UniformBufferBase
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
 

Detailed Description

template<typename DataT>
class castor3d::UniformBufferT< DataT >

A uniform typed buffer, than can contain multiple sub-buffers.

Constructor & Destructor Documentation

◆ UniformBufferT()

template<typename DataT >
castor3d::UniformBufferT< DataT >::UniformBufferT ( RenderSystem const & renderSystem,
VkDeviceSize count,
VkBufferUsageFlags usage,
VkMemoryPropertyFlags flags,
castor::String debugName,
ashes::QueueShare sharingMode = {} )

Constructor.

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

Member Function Documentation

◆ download()

template<typename DataT >
void castor3d::UniformBufferT< DataT >::download ( ashes::BufferBase const & stagingBuffer,
ashes::Queue const & queue,
ashes::CommandPool const & commandPool,
uint32_t offset,
VkPipelineStageFlags flags,
FramePassTimer const & timer,
uint32_t index )

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]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.
[in]timerThe render pass timer.
[in]indexThe render pass index.

◆ getData() [1/2]

template<typename DataT >
DataT & castor3d::UniformBufferT< DataT >::getData ( VkDeviceSize index = 0)
inline
Returns
The N-th instance of the data.
Parameters
[in]indexThe instance index.

◆ getData() [2/2]

template<typename DataT >
DataT const & castor3d::UniformBufferT< DataT >::getData ( VkDeviceSize index = 0) const
inline
Returns
The N-th instance of the data.
Parameters
[in]indexThe instance index.

◆ getDatas() [1/2]

template<typename DataT >
castor::Vector< DataT > & castor3d::UniformBufferT< DataT >::getDatas ( )
inline
Returns
The data.

◆ getDatas() [2/2]

template<typename DataT >
castor::Vector< DataT > const & castor3d::UniformBufferT< DataT >::getDatas ( ) const
inline
Returns
The data.

◆ upload() [1/5]

template<typename DataT >
void castor3d::UniformBufferT< DataT >::upload ( ashes::BufferBase const & stagingBuffer,
ashes::CommandBuffer const & commandBuffer,
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]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.

◆ upload() [2/5]

template<typename DataT >
void castor3d::UniformBufferT< DataT >::upload ( ashes::BufferBase const & stagingBuffer,
ashes::CommandBuffer const & commandBuffer,
uint32_t offset,
VkPipelineStageFlags flags,
FramePassTimer const & timer,
uint32_t index ) 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]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.
[in]timerThe render pass timer.
[in]indexThe render pass index.

◆ upload() [3/5]

template<typename DataT >
void castor3d::UniformBufferT< DataT >::upload ( ashes::BufferBase const & stagingBuffer,
ashes::Queue const & queue,
ashes::CommandPool const & commandPool,
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]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.

◆ upload() [4/5]

template<typename DataT >
void castor3d::UniformBufferT< DataT >::upload ( ashes::BufferBase const & stagingBuffer,
ashes::Queue const & queue,
ashes::CommandPool const & commandPool,
uint32_t offset,
VkPipelineStageFlags flags,
FramePassTimer const & timer,
uint32_t index ) 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]offsetThe start offset.
[in]flagsThe pipeline stage flags for the out memory barrier.
[in]timerThe render pass timer.
[in]indexThe render pass index.

◆ upload() [5/5]

template<typename DataT >
void castor3d::UniformBufferT< DataT >::upload ( VkDeviceSize offset = 0u,
VkDeviceSize range = 1u ) const

Uploads the buffer data to VRAM.

Parameters
[in]offsetThe offset in elements from which buffer memory is mapped.
[in]rangeThe number of elements to map.

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