|
Blender V5.0
|
#include <vk_staging_buffer.hh>
Public Types | |
| enum class | Direction { HostToDevice , DeviceToHost } |
Public Member Functions | |
| VKStagingBuffer (const VKBuffer &device_buffer, Direction direction, VkDeviceSize device_buffer_offset=0, VkDeviceSize region_size=UINT64_MAX) | |
| void | copy_to_device (VKContext &context) |
| void | copy_from_device (VKContext &context) |
| VKBuffer & | host_buffer_get () |
| void | free () |
| VkDeviceSize | size_in_bytes_get () const |
Utility class to copy data from host to device and vise versa.
This is a common as buffers on device are more performant than when located inside host memory.
Definition at line 21 of file vk_staging_buffer.hh.
|
strong |
Direction of the transfer.
| Enumerator | |
|---|---|
| HostToDevice | Transferring data from host to device. |
| DeviceToHost | Transferring data from device to host. |
Definition at line 26 of file vk_staging_buffer.hh.
| blender::gpu::VKStagingBuffer::VKStagingBuffer | ( | const VKBuffer & | device_buffer, |
| Direction | direction, | ||
| VkDeviceSize | device_buffer_offset = 0, | ||
| VkDeviceSize | region_size = UINT64_MAX ) |
Definition at line 14 of file vk_staging_buffer.cc.
References DeviceToHost, HostToDevice, blender::gpu::debug::object_label(), and UINT64_MAX.
| void blender::gpu::VKStagingBuffer::copy_from_device | ( | VKContext & | context | ) |
Copy the content of the device buffer to the host buffer.
Definition at line 52 of file vk_staging_buffer.cc.
References BLI_assert, blender::gpu::render_graph::VKCopyBufferData::dst_buffer, blender::gpu::render_graph::VKCopyBufferData::region, and blender::gpu::render_graph::VKCopyBufferData::src_buffer.
Referenced by blender::gpu::VKIndexBuffer::read(), and blender::gpu::VKVertexBuffer::read().
| void blender::gpu::VKStagingBuffer::copy_to_device | ( | VKContext & | context | ) |
Copy the content of the host buffer to the device buffer.
Definition at line 40 of file vk_staging_buffer.cc.
References BLI_assert, blender::gpu::render_graph::VKCopyBufferData::dst_buffer, blender::gpu::render_graph::VKCopyBufferData::region, and blender::gpu::render_graph::VKCopyBufferData::src_buffer.
Referenced by blender::gpu::VKIndexBuffer::ensure_updated(), blender::gpu::VKStorageBuffer::update(), and blender::gpu::VKVertexBuffer::update_sub().
| void blender::gpu::VKStagingBuffer::free | ( | ) |
Free the host memory.
In case a reference of the staging buffer is kept, but the host resource isn't needed anymore.
Definition at line 64 of file vk_staging_buffer.cc.
|
inline |
Get the reference to the host buffer to update/load the data.
Definition at line 70 of file vk_staging_buffer.hh.
Referenced by blender::gpu::VKIndexBuffer::ensure_updated(), blender::gpu::VKIndexBuffer::read(), blender::gpu::VKVertexBuffer::read(), blender::gpu::VKStorageBuffer::update(), and blender::gpu::VKVertexBuffer::update_sub().
|
inline |
Definition at line 82 of file vk_staging_buffer.hh.