|
Blender V5.0
|
#include <vk_resource_pool.hh>
Public Member Functions | |
| void | deinit (VKDevice &device) |
| void | discard_image (VkImage vk_image, VmaAllocation vma_allocation) |
| void | discard_image_view (VkImageView vk_image_view) |
| void | discard_buffer (VkBuffer vk_buffer, VmaAllocation vma_allocation) |
| void | discard_buffer_view (VkBufferView vk_buffer_view) |
| void | discard_shader_module (VkShaderModule vk_shader_module) |
| void | discard_pipeline (VkPipeline vk_pipeline) |
| void | discard_pipeline_layout (VkPipelineLayout vk_pipeline_layout) |
| void | discard_descriptor_pool_for_reuse (VkDescriptorPool vk_descriptor_pool, VKDescriptorPools *descriptor_pools) |
| void | move_data (VKDiscardPool &src_pool, TimelineValue timeline) |
| Mutex & | mutex_get () |
| void | destroy_discarded_resources (VKDevice &device, TimelineValue current_timeline) |
Static Public Member Functions | |
| static VKDiscardPool & | discard_pool_get () |
Friends | |
| class | VKDevice |
| class | VKBackend |
Pool of resources that are discarded, but can still be in used and cannot be destroyed.
When GPU resources are deleted (GPU_*_delete) the GPU handles are kept inside a discard pool. When we are sure that the resource isn't used on the GPU anymore we can safely destroy it.
When preparing the next frame, the previous frame can still be rendered. Resources that needs to be destroyed can only be when the previous frame has been completed and being displayed on the screen.
Definition at line 77 of file vk_resource_pool.hh.
| void blender::gpu::VKDiscardPool::deinit | ( | VKDevice & | device | ) |
Definition at line 15 of file vk_resource_pool.cc.
References destroy_discarded_resources(), UINT64_MAX, and VKDevice.
| void blender::gpu::VKDiscardPool::destroy_discarded_resources | ( | VKDevice & | device, |
| TimelineValue | current_timeline ) |
Definition at line 87 of file vk_resource_pool.cc.
References blender::gpu::VKDevice::mem_allocator_get(), mutex, blender::gpu::render_graph::VKResourceStateTracker::remove_buffer(), blender::gpu::render_graph::VKResourceStateTracker::remove_image(), blender::gpu::VKDevice::resources, blender::gpu::VKDevice::vk_handle(), and VKDevice.
Referenced by deinit(), and blender::gpu::VKDevice::submission_runner().
| void blender::gpu::VKDiscardPool::discard_buffer | ( | VkBuffer | vk_buffer, |
| VmaAllocation | vma_allocation ) |
Definition at line 52 of file vk_resource_pool.cc.
References mutex.
Referenced by blender::gpu::VKBuffer::free().
| void blender::gpu::VKDiscardPool::discard_buffer_view | ( | VkBufferView | vk_buffer_view | ) |
Definition at line 58 of file vk_resource_pool.cc.
References mutex.
Referenced by blender::gpu::VKVertexBuffer::release_data().
| void blender::gpu::VKDiscardPool::discard_descriptor_pool_for_reuse | ( | VkDescriptorPool | vk_descriptor_pool, |
| VKDescriptorPools * | descriptor_pools ) |
Definition at line 80 of file vk_resource_pool.cc.
References mutex.
| void blender::gpu::VKDiscardPool::discard_image | ( | VkImage | vk_image, |
| VmaAllocation | vma_allocation ) |
Definition at line 40 of file vk_resource_pool.cc.
References mutex.
Referenced by blender::gpu::VKTexture::~VKTexture().
| void blender::gpu::VKDiscardPool::discard_image_view | ( | VkImageView | vk_image_view | ) |
Definition at line 46 of file vk_resource_pool.cc.
References mutex.
Referenced by blender::gpu::VKImageView::~VKImageView().
| void blender::gpu::VKDiscardPool::discard_pipeline | ( | VkPipeline | vk_pipeline | ) |
Definition at line 69 of file vk_resource_pool.cc.
References mutex.
Referenced by blender::gpu::VKPipelinePool::discard().
| void blender::gpu::VKDiscardPool::discard_pipeline_layout | ( | VkPipelineLayout | vk_pipeline_layout | ) |
Definition at line 74 of file vk_resource_pool.cc.
References mutex.
Referenced by blender::gpu::VKShader::~VKShader().
|
static |
Returns the discard pool for the current thread.
When active thread has a context it uses the context discard pool. Otherwise a device discard pool is used.
Definition at line 127 of file vk_resource_pool.cc.
References blender::gpu::VKBackend::device, G, blender::gpu::VKBackend::get(), blender::gpu::VKContext::get(), blender::gpu::VKDevice::orphaned_data, blender::gpu::VKDevice::orphaned_data_render, and VKDevice.
Referenced by blender::gpu::VKBuffer::free(), blender::gpu::VKVertexBuffer::release_data(), blender::gpu::VKImageView::~VKImageView(), blender::gpu::VKShader::~VKShader(), blender::gpu::VKShaderModule::~VKShaderModule(), and blender::gpu::VKTexture::~VKTexture().
| void blender::gpu::VKDiscardPool::discard_shader_module | ( | VkShaderModule | vk_shader_module | ) |
Definition at line 64 of file vk_resource_pool.cc.
References mutex.
Referenced by blender::gpu::VKShaderModule::~VKShaderModule().
| void blender::gpu::VKDiscardPool::move_data | ( | VKDiscardPool & | src_pool, |
| TimelineValue | timeline ) |
Move discarded resources from src_pool into this.
GPU resources that are discarded from the dependency graph are stored in the device orphaned data. When a swap-chain context list is made active the orphaned data can be merged into a swap-chain discard pool.
All moved items will receive a new timeline.
Function must be externally synced (
<source> { std::scoped_lock lock(pool.mutex_get())); pool.move_data(src_pool, timeline); } </source>
Definition at line 20 of file vk_resource_pool.cc.
References blender::gpu::TimelineResources< Item >::update_timeline().
|
inline |
Definition at line 127 of file vk_resource_pool.hh.
|
friend |
Definition at line 79 of file vk_resource_pool.hh.
References UINT64_MAX, VKBackend, and VKDevice.
Referenced by VKBackend.
|
friend |
Definition at line 78 of file vk_resource_pool.hh.
References VKDevice.
Referenced by deinit(), destroy_discarded_resources(), discard_pool_get(), VKBackend, and VKDevice.