![]() |
NDEVR
API Documentation
|
A GPU storage buffer (SSBO) for compute shader use, with a separate staging buffer for host-visible upload/download transfers. More...
Public Member Functions | |
| void | allocate (VkDeviceSize byte_size, bool device_local=false) |
| Allocate the buffer. | |
| VkBuffer | buffer () const |
| The device-local VkBuffer (for binding as SSBO in descriptor sets). | |
| VkDeviceSize | byteSize () const |
| The allocated byte size. | |
| void | cleanup () |
| Free all Vulkan resources. | |
| void | download (void *data, VkDeviceSize byte_size) const |
| Download data from device buffer to CPU via staging. | |
| bool | isAllocated () const |
| Whether the buffer has been allocated. | |
| void | upload (const void *data, VkDeviceSize byte_size) |
| Upload data from CPU to the device buffer via staging. | |
A GPU storage buffer (SSBO) for compute shader use, with a separate staging buffer for host-visible upload/download transfers.
Allocates a device-local VkBuffer with STORAGE_BUFFER | TRANSFER_SRC | TRANSFER_DST usage, plus a host-visible staging buffer for data transfers. Follows the same pattern as VulkanBuffer::CreateVKBuffer but is specialized for compute shader SSBO access.
Definition at line 47 of file VulkanComputeBuffer.h.
| void VulkanComputeBuffer::allocate | ( | VkDeviceSize | byte_size, |
| bool | device_local = false ) |
Allocate the buffer.
| byte_size | Total size in bytes |
| device_local | When true, allocates DEVICE_LOCAL memory for shader use plus a HOST_VISIBLE staging buffer for transfers (best performance on discrete GPUs). When false, uses a single HOST_VISIBLE buffer (simplest, fine for integrated GPUs or small buffers). |
| void VulkanComputeBuffer::download | ( | void * | data, |
| VkDeviceSize | byte_size ) const |
Download data from device buffer to CPU via staging.
| data | Destination pointer |
| byte_size | Number of bytes to copy (must be <= allocated size) |
| void VulkanComputeBuffer::upload | ( | const void * | data, |
| VkDeviceSize | byte_size ) |
Upload data from CPU to the device buffer via staging.
| data | Source pointer |
| byte_size | Number of bytes to copy (must be <= allocated size) |