|
Blender V4.3
|
#include <vk_staging_buffer.hh>
Public Types | |
| enum class | Direction { HostToDevice , DeviceToHost } |
Public Member Functions | |
| VKStagingBuffer (const VKBuffer &device_buffer, Direction direction) | |
| void | copy_to_device (VKContext &context) |
| void | copy_from_device (VKContext &context) |
| const VKBuffer & | host_buffer_get () const |
| void | free () |
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 ) |
Definition at line 14 of file vk_staging_buffer.cc.
References blender::gpu::VKBuffer::create(), DeviceToHost, GPU_USAGE_STREAM, HostToDevice, blender::gpu::debug::object_label(), blender::gpu::VKBuffer::size_in_bytes(), and blender::gpu::VKBuffer::vk_handle().
| void blender::gpu::VKStagingBuffer::copy_from_device | ( | VKContext & | context | ) |
Copy the content of the device buffer to the host buffer.
Definition at line 41 of file vk_staging_buffer.cc.
References BLI_assert, blender::gpu::render_graph::VKCopyBufferData::dst_buffer, blender::gpu::VKBuffer::is_allocated(), blender::gpu::VKBuffer::is_mapped(), blender::gpu::render_graph::VKCopyBufferData::region, blender::gpu::VKBuffer::size_in_bytes(), blender::gpu::render_graph::VKCopyBufferData::src_buffer, and blender::gpu::VKBuffer::vk_handle().
Referenced by blender::gpu::VKIndexBuffer::read(), blender::gpu::VKStorageBuffer::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 30 of file vk_staging_buffer.cc.
References BLI_assert, blender::gpu::render_graph::VKCopyBufferData::dst_buffer, blender::gpu::VKBuffer::is_allocated(), blender::gpu::VKBuffer::is_mapped(), blender::gpu::render_graph::VKCopyBufferData::region, blender::gpu::VKBuffer::size_in_bytes(), blender::gpu::render_graph::VKCopyBufferData::src_buffer, and blender::gpu::VKBuffer::vk_handle().
Referenced by blender::gpu::VKIndexBuffer::ensure_updated(), and blender::gpu::VKStorageBuffer::update().
| 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 52 of file vk_staging_buffer.cc.
References blender::gpu::VKBuffer::free().
|
inline |
Get the reference to the host buffer to update/load the data.
Definition at line 64 of file vk_staging_buffer.hh.
Referenced by blender::gpu::VKIndexBuffer::ensure_updated(), blender::gpu::VKIndexBuffer::read(), blender::gpu::VKStorageBuffer::read(), blender::gpu::VKVertexBuffer::read(), and blender::gpu::VKStorageBuffer::update().