A ring buffer for staging GPU uploads.
More...
|
| | VulkanStagingRing (const VulkanDevice *device) |
| | Constructs a staging ring for the given device.
|
| | ~VulkanStagingRing () |
| | Destructor.
|
|
void | begin () |
| | Begins a new staging cycle.
|
|
void | cleanup () |
| | Releases all staging ring resources.
|
|
void | end () |
| | Ends the current staging cycle and submits pending transfers.
|
|
void | ensureComplete () |
| | Ensures all pending transfers are complete before returning.
|
| void | ensureSize (VkDeviceSize size) |
| | Ensures the staging buffer is at least the given size.
|
| VkCommandBuffer | getCommandBuffer () |
| | Returns a command buffer for recording transfer commands.
|
| void * | mapData (VkDeviceSize size) |
| | Maps a region of the staging buffer for writing.
|
| void | moveData (VkBuffer target, VkDeviceSize src_offset, VkDeviceSize dst_offset, VkDeviceSize size) |
| | Moves data within a buffer using a transfer command.
|
| void | removePending (VkBuffer buffer) |
| | Removes all pending copy operations targeting the given buffer.
|
| void | sendData (VkBuffer dst, VkDeviceSize dst_offset_bytes) |
| | Queues a copy from the staging buffer to a destination buffer.
|
| void | sendData (VkImage dst, Vector< 2, uint04 > image_size, uint04 mip_level, uint04 image_layer, VkCommandBuffer command_buffer) |
| | Queues a copy from the staging buffer to a destination image.
|
| void | setData (const void *data, VkDeviceSize byte_size, VkDeviceSize alignment=1) |
| | Writes data into the staging buffer.
|
|
void | setDeviceLost () |
| | Handles device lost by resetting internal state.
|
| void | setSize (VkDeviceSize size) |
| | Sets the staging buffer to the given size.
|
A ring buffer for staging GPU uploads.
Batches CPU-to-GPU data transfers through a shared staging buffer, submitting them as command buffers when ready.
Definition at line 34 of file VulkanStagingRing.h.
◆ VulkanStagingRing()
| VulkanStagingRing::VulkanStagingRing |
( |
const VulkanDevice * | device | ) |
|
Constructs a staging ring for the given device.
- Parameters
-
| [in] | device | The Vulkan device. |
◆ ~VulkanStagingRing()
| VulkanStagingRing::~VulkanStagingRing |
( |
| ) |
|
Destructor.
Cleans up staging resources.
◆ ensureSize()
| void VulkanStagingRing::ensureSize |
( |
VkDeviceSize | size | ) |
|
Ensures the staging buffer is at least the given size.
- Parameters
-
| [in] | size | The minimum required size in bytes. |
◆ getCommandBuffer()
| VkCommandBuffer VulkanStagingRing::getCommandBuffer |
( |
| ) |
|
Returns a command buffer for recording transfer commands.
- Returns
- The VkCommandBuffer handle.
◆ mapData()
| void * VulkanStagingRing::mapData |
( |
VkDeviceSize | size | ) |
|
Maps a region of the staging buffer for writing.
- Parameters
-
| [in] | size | The number of bytes to map. |
- Returns
- A pointer to the mapped memory.
◆ moveData()
| void VulkanStagingRing::moveData |
( |
VkBuffer | target, |
|
|
VkDeviceSize | src_offset, |
|
|
VkDeviceSize | dst_offset, |
|
|
VkDeviceSize | size ) |
Moves data within a buffer using a transfer command.
- Parameters
-
| [in] | target | The VkBuffer to move data within. |
| [in] | src_offset | The source byte offset. |
| [in] | dst_offset | The destination byte offset. |
| [in] | size | The number of bytes to move. |
◆ removePending()
| void VulkanStagingRing::removePending |
( |
VkBuffer | buffer | ) |
|
Removes all pending copy operations targeting the given buffer.
- Parameters
-
| [in] | buffer | The VkBuffer to remove pending operations for. |
◆ sendData() [1/2]
| void VulkanStagingRing::sendData |
( |
VkBuffer | dst, |
|
|
VkDeviceSize | dst_offset_bytes ) |
Queues a copy from the staging buffer to a destination buffer.
- Parameters
-
| [in] | dst | The destination VkBuffer. |
| [in] | dst_offset_bytes | The byte offset in the destination buffer. |
◆ sendData() [2/2]
| void VulkanStagingRing::sendData |
( |
VkImage | dst, |
|
|
Vector< 2, uint04 > | image_size, |
|
|
uint04 | mip_level, |
|
|
uint04 | image_layer, |
|
|
VkCommandBuffer | command_buffer ) |
Queues a copy from the staging buffer to a destination image.
- Parameters
-
| [in] | dst | The destination VkImage. |
| [in] | image_size | The image dimensions. |
| [in] | mip_level | The target mip level. |
| [in] | image_layer | The target array layer. |
| [in] | command_buffer | The command buffer to record into. |
◆ setData()
| void VulkanStagingRing::setData |
( |
const void * | data, |
|
|
VkDeviceSize | byte_size, |
|
|
VkDeviceSize | alignment = 1 ) |
Writes data into the staging buffer.
- Parameters
-
| [in] | data | Pointer to the source data. |
| [in] | byte_size | The number of bytes to write. |
| [in] | alignment | The required alignment in bytes. |
◆ setSize()
| void VulkanStagingRing::setSize |
( |
VkDeviceSize | size | ) |
|
Sets the staging buffer to the given size.
- Parameters
-
| [in] | size | The size in bytes. |
The documentation for this class was generated from the following file: