|
Blender V4.5
|
#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_framebuffer (VkFramebuffer vk_framebuffer) |
| void | discard_render_pass (VkRenderPass vk_render_pass) |
| void | discard_descriptor_pool (VkDescriptorPool vk_descriptor_pool) |
| void | move_data (VKDiscardPool &src_pool, TimelineValue timeline) |
| Mutex & | mutex_get () |
| void | destroy_discarded_resources (VKDevice &device, bool force=false) |
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 20 of file vk_resource_pool.cc.
References destroy_discarded_resources(), and VKDevice.
| void blender::gpu::VKDiscardPool::destroy_discarded_resources | ( | VKDevice & | device, |
| bool | force = false ) |
Definition at line 107 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::submission_finished_timeline_get(), UINT64_MAX, 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 61 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 67 of file vk_resource_pool.cc.
References mutex.
Referenced by blender::gpu::VKVertexBuffer::release_data().
| void blender::gpu::VKDiscardPool::discard_descriptor_pool | ( | VkDescriptorPool | vk_descriptor_pool | ) |
Definition at line 101 of file vk_resource_pool.cc.
References mutex.
Referenced by blender::gpu::VKDescriptorPools::discard().
| void blender::gpu::VKDiscardPool::discard_framebuffer | ( | VkFramebuffer | vk_framebuffer | ) |
Definition at line 89 of file vk_resource_pool.cc.
References mutex.
| void blender::gpu::VKDiscardPool::discard_image | ( | VkImage | vk_image, |
| VmaAllocation | vma_allocation ) |
Definition at line 49 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 55 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 78 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 83 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 157 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_render_pass | ( | VkRenderPass | vk_render_pass | ) |
Definition at line 95 of file vk_resource_pool.cc.
References mutex.
| void blender::gpu::VKDiscardPool::discard_shader_module | ( | VkShaderModule | vk_shader_module | ) |
Definition at line 73 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 25 of file vk_resource_pool.cc.
References blender::gpu::TimelineResources< Item >::update_timeline().
|
inline |
Definition at line 130 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.