Blender V4.5
blender::gpu::VKBuffer Class Reference

#include <vk_buffer.hh>

Inherits blender::NonCopyable.

Public Member Functions

 VKBuffer ()=default
 
virtual ~VKBuffer ()
 
bool is_allocated () const
 
bool create (size_t size, VkBufferUsageFlags buffer_usage, VkMemoryPropertyFlags required_flags, VkMemoryPropertyFlags preferred_flags, VmaAllocationCreateFlags vma_allocation_flags, float priority, bool export_memory=false)
 
void clear (VKContext &context, uint32_t clear_value)
 
void update_immediately (const void *data) const
 
void update_sub_immediately (size_t start_offset, size_t data_size, const void *data) const
 
void update_render_graph (VKContext &context, void *data) const
 
void flush () const
 
void read (VKContext &context, void *data) const
 
void async_flush_to_host (VKContext &context)
 
void read_async (VKContext &context, void *data)
 
bool free ()
 
void free_immediately (VKDevice &device)
 
int64_t size_in_bytes () const
 
VkBuffer vk_handle () const
 
void * mapped_memory_get () const
 
VkDeviceAddress device_address_get () const
 
bool is_mapped () const
 
VkDeviceMemory export_memory_get (size_t &memory_size)
 
- Public Member Functions inherited from blender::NonCopyable
 NonCopyable (const NonCopyable &other)=delete
 
NonCopyableoperator= (const NonCopyable &other)=delete
 
 NonCopyable ()=default
 
 NonCopyable (NonCopyable &&other)=default
 
NonCopyableoperator= (NonCopyable &&other)=default
 

Detailed Description

Class for handing vulkan buffers (allocation/updating/binding).

Definition at line 23 of file vk_buffer.hh.

Constructor & Destructor Documentation

◆ VKBuffer()

blender::gpu::VKBuffer::VKBuffer ( )
default

◆ ~VKBuffer()

blender::gpu::VKBuffer::~VKBuffer ( )
virtual

Definition at line 16 of file vk_buffer.cc.

References free(), and is_allocated().

Member Function Documentation

◆ async_flush_to_host()

void blender::gpu::VKBuffer::async_flush_to_host ( VKContext & context)

Start a async read-back.

Definition at line 151 of file vk_buffer.cc.

References BLI_assert, blender::gpu::RENEW_RENDER_GRAPH, and blender::gpu::SUBMIT.

Referenced by blender::gpu::VKStorageBuffer::async_flush_to_host(), and read_async().

◆ clear()

◆ create()

◆ device_address_get()

◆ export_memory_get()

VkDeviceMemory blender::gpu::VKBuffer::export_memory_get ( size_t & memory_size)

◆ flush()

void blender::gpu::VKBuffer::flush ( ) const

◆ free()

bool blender::gpu::VKBuffer::free ( )

Free the buffer.

Discards the buffer so it can be destroyed safely later. Buffers can still be used when rendering so we can only destroy them after the rendering is completed.

Definition at line 219 of file vk_buffer.cc.

References blender::gpu::VKDiscardPool::discard_buffer(), blender::gpu::VKDiscardPool::discard_pool_get(), and is_mapped().

Referenced by blender::gpu::VKPixelBuffer::create(), blender::gpu::VKDevice::deinit(), blender::gpu::VKStagingBuffer::free(), and ~VKBuffer().

◆ free_immediately()

void blender::gpu::VKBuffer::free_immediately ( VKDevice & device)

◆ is_allocated()

◆ is_mapped()

◆ mapped_memory_get()

void * blender::gpu::VKBuffer::mapped_memory_get ( ) const
inline

◆ read()

void blender::gpu::VKBuffer::read ( VKContext & context,
void * data ) const

◆ read_async()

void blender::gpu::VKBuffer::read_async ( VKContext & context,
void * data )

Wait until the async read back is finished and fill the given data with the content of the buffer.

Will start a new async read-back when there is no read back in progress.

Definition at line 159 of file vk_buffer.cc.

References async_flush_to_host(), BLI_assert_msg, data, blender::gpu::VKBackend::device, blender::gpu::VKBackend::get(), is_mapped(), and blender::gpu::VKDevice::wait_for_timeline().

Referenced by blender::gpu::VKStorageBuffer::read().

◆ size_in_bytes()

int64_t blender::gpu::VKBuffer::size_in_bytes ( ) const
inline

◆ update_immediately()

void blender::gpu::VKBuffer::update_immediately ( const void * data) const

◆ update_render_graph()

void blender::gpu::VKBuffer::update_render_graph ( VKContext & context,
void * data ) const

Update the buffer as part of the render graph evaluation. The ownership of data will be transferred to the render graph and should have been allocated using guarded alloc.

Definition at line 125 of file vk_buffer.cc.

References BLI_assert, blender::gpu::render_graph::VKUpdateBufferData::data, data, blender::gpu::render_graph::VKUpdateBufferData::data_size, and blender::gpu::render_graph::VKUpdateBufferData::dst_buffer.

Referenced by blender::gpu::VKUniformBuffer::ensure_updated(), and blender::gpu::VKUniformBuffer::update().

◆ update_sub_immediately()

void blender::gpu::VKBuffer::update_sub_immediately ( size_t start_offset,
size_t data_size,
const void * data ) const

◆ vk_handle()


The documentation for this class was generated from the following files: