Castor3D 0.16.0
Multiplatform 3D engine
|
#include <UniformBufferBase.hpp>
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 |
C3D_API castor3d::UniformBufferBase::UniformBufferBase | ( | RenderSystem const & | renderSystem, |
VkDeviceSize | elemCount, | ||
VkDeviceSize | elemSize, | ||
VkBufferUsageFlags | usage, | ||
VkMemoryPropertyFlags | flags, | ||
castor::String | debugName, | ||
ashes::QueueShare | sharingMode = {} ) |
Constructor.
[in] | renderSystem | The RenderSystem. |
[in] | elemCount | The elements count. |
[in] | elemSize | The elements size. |
[in] | usage | The buffer usage flags. |
[in] | flags | The buffer memory flags. |
[in] | debugName | The buffer debug name. |
[in] | sharingMode | The buffer sharing mode. |
|
virtualdefaultnoexcept |
Destructor.
|
noexcept |
Allocates a memory chunk for a CPU buffer.
|
noexcept |
Cleans up the GPU buffer.
C3D_API void castor3d::UniformBufferBase::deallocate | ( | uint32_t | offset | ) |
Deallocates memory.
[in] | offset | The memory chunk offset. |
|
inline |
Transfers data from the GPU buffer to RAM.
[in] | stagingBuffer | The staging buffer used to transfer the data. |
[in] | queue | The queue used to execute the transfer. |
[in] | commandPool | The command pool on which the command buffer will be created. |
[in] | data | Receives the data to download, packed. |
[in] | offset | The start offset. |
[in] | flags | The pipeline stage flags for the out memory barrier. |
[in] | timer | The render pass timer. |
References download().
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.
[in] | stagingBuffer | The staging buffer used to transfer the data. |
[in] | queue | The queue used to execute the transfer. |
[in] | commandPool | The command pool on which the command buffer will be created. |
[in] | data | Receives the data to download, packed. |
[in] | size | The data size. |
[in] | offset | The start offset. |
[in] | flags | The pipeline stage flags for the out memory barrier. |
[in] | timer | The render pass timer. |
Referenced by download().
|
inline |
References getAlignedSize(), and getElementSize().
Referenced by getAlignedSize(), and getAlignedSize().
|
inline |
Retrieves the aligned size for an element.
[in] | size | The size of an element. |
References getAlignedSize(), and getBuffer().
|
inline |
|
inline |
Referenced by getAlignedSize(), and getElementSize().
|
inline |
References getBuffer(), and getElementSize().
Referenced by getAlignedSize(), and getElementSize().
|
noexcept |
true
if there is enough remaining memory for a new element.
|
inline |
false
if the internal buffer doesn't exist. C3D_API uint32_t castor3d::UniformBufferBase::initialise | ( | RenderDevice const & | device | ) |
Initialises the GPU buffer.
[in] | device | The GPU device. |
C3D_API uint32_t castor3d::UniformBufferBase::initialise | ( | RenderDevice const & | device, |
ashes::QueueShare | sharingMode ) |
Initialises the GPU buffer.
[in] | device | The GPU device. |
[in] | sharingMode | The buffer sharing mode. |
|
inline |
Transfers data to the GPU buffer from RAM.
[in] | stagingBuffer | The staging buffer used to transfer the data. |
[in] | commandBuffer | The command buffer on which the transfer commands are recorded. |
[in] | data | The data to upload, packed (will be aligned on upload). |
[in] | offset | The start offset. |
[in] | flags | The pipeline stage flags for the out memory barrier. |
References upload().
|
inline |
Transfers data to the GPU buffer from RAM.
[in] | stagingBuffer | The staging buffer used to transfer the data. |
[in] | commandBuffer | The command buffer on which the transfer commands are recorded. |
[in] | data | The data to upload, packed (will be aligned on upload). |
[in] | offset | The start offset. |
[in] | flags | The pipeline stage flags for the out memory barrier. |
[in] | timer | The render pass timer. |
References upload().
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.
[in] | stagingBuffer | The staging buffer used to transfer the data. |
[in] | commandBuffer | The command buffer on which the transfer commands are recorded. |
[in] | data | The data to upload, packed (will be aligned on upload). |
[in] | size | The data size. |
[in] | offset | The start offset. |
[in] | flags | The pipeline stage flags for the out memory barrier. |
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.
[in] | stagingBuffer | The staging buffer used to transfer the data. |
[in] | commandBuffer | The command buffer on which the transfer commands are recorded. |
[in] | data | The data to upload, packed (will be aligned on upload). |
[in] | size | The data size. |
[in] | offset | The start offset. |
[in] | flags | The pipeline stage flags for the out memory barrier. |
[in] | timer | The render pass timer. |
|
inline |
Transfers data to the GPU buffer from RAM.
[in] | stagingBuffer | The staging buffer used to transfer the data. |
[in] | queue | The queue used to execute the transfer. |
[in] | commandPool | The command pool on which the command buffer will be created. |
[in] | data | The data to upload, packed (will be aligned on upload). |
[in] | offset | The start offset. |
[in] | flags | The pipeline stage flags for the out memory barrier. |
References upload().
|
inline |
Transfers data to the GPU buffer from RAM.
[in] | stagingBuffer | The staging buffer used to transfer the data. |
[in] | queue | The queue used to execute the transfer. |
[in] | commandPool | The command pool on which the command buffer will be created. |
[in] | data | The data to upload, packed (will be aligned on upload). |
[in] | offset | The start offset. |
[in] | flags | The pipeline stage flags for the out memory barrier. |
[in] | timer | The render pass timer. |
References upload().
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.
[in] | stagingBuffer | The staging buffer used to transfer the data. |
[in] | queue | The queue used to execute the transfer. |
[in] | commandPool | The command pool on which the command buffer will be created. |
[in] | data | The data to upload, packed (will be aligned on upload). |
[in] | size | The data size. |
[in] | offset | The start offset. |
[in] | flags | The pipeline stage flags for the out memory barrier. |
Referenced by upload(), upload(), upload(), and upload().
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.
[in] | stagingBuffer | The staging buffer used to transfer the data. |
[in] | queue | The queue used to execute the transfer. |
[in] | commandPool | The command pool on which the command buffer will be created. |
[in] | data | The data to upload, packed (will be aligned on upload). |
[in] | size | The data size. |
[in] | offset | The start offset. |
[in] | flags | The pipeline stage flags for the out memory barrier. |
[in] | timer | The render pass timer. |