|
Blender V5.3
|
#include <vk_resource_pool.hh>
Public Member Functions | |
| void | deinit (VKDevice &device) |
| void | discard_swapchain_image (ResourceHandle image_handle) |
| void | discard_image_view (VkImageView vk_image_view) |
| void | discard_resources (Span< render_graph::VKResourceStateTracker::DiscardableResource > discardable, TimelineValue timeline) |
| void | discard_allocation (VmaAllocation vma_allocation) |
| 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 | discard_acceleration_structure (VkAccelerationStructureKHR vk_acceleration_structure) |
| 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 |
| std::ostream & | operator<< (std::ostream &os, const VKDiscardPool &discard_pool) |
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 79 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.
Referenced by blender::gpu::VKDevice::deinit(), and VKBackend.
| void blender::gpu::VKDiscardPool::destroy_discarded_resources | ( | VKDevice & | device, |
| TimelineValue | current_timeline ) |
Definition at line 135 of file vk_resource_pool.cc.
References blender::gpu::VKDevice::functions, blender::gpu::render_graph::VKResourceStateTracker::get_vk_image(), blender::gpu::VKDevice::mem_allocator_get(), blender::gpu::render_graph::VKResourceStateTracker::remove_buffer(), blender::gpu::render_graph::VKResourceStateTracker::remove_image(), blender::gpu::render_graph::VKResourceStateTracker::remove_swapchain_image(), blender::gpu::VKDevice::resources, blender::gpu::render_graph::VKResourceStateTracker::take_views(), blender::gpu::VKDevice::vk_handle(), and VKDevice.
Referenced by deinit(), and blender::gpu::VKDevice::submission_runner().
| void blender::gpu::VKDiscardPool::discard_acceleration_structure | ( | VkAccelerationStructureKHR | vk_acceleration_structure | ) |
Definition at line 128 of file vk_resource_pool.cc.
Referenced by VKBackend, blender::gpu::VKBottomLevelAS::~VKBottomLevelAS(), and blender::gpu::VKTopLevelAS::~VKTopLevelAS().
| void blender::gpu::VKDiscardPool::discard_allocation | ( | VmaAllocation | vma_allocation | ) |
Definition at line 99 of file vk_resource_pool.cc.
Referenced by VKBackend.
| void blender::gpu::VKDiscardPool::discard_descriptor_pool_for_reuse | ( | VkDescriptorPool | vk_descriptor_pool, |
| VKDescriptorPools * | descriptor_pools ) |
Definition at line 121 of file vk_resource_pool.cc.
Referenced by VKBackend.
| void blender::gpu::VKDiscardPool::discard_image_view | ( | VkImageView | vk_image_view | ) |
Discard an image view that belongs to a resource removed outside the discard flow (e.g. a swapchain image).
Definition at line 53 of file vk_resource_pool.cc.
Referenced by VKBackend.
| void blender::gpu::VKDiscardPool::discard_pipeline | ( | VkPipeline | vk_pipeline | ) |
Definition at line 110 of file vk_resource_pool.cc.
Referenced by blender::gpu::VKPipelineMap< PipelineInfo >::discard(), and VKBackend.
| void blender::gpu::VKDiscardPool::discard_pipeline_layout | ( | VkPipelineLayout | vk_pipeline_layout | ) |
Definition at line 115 of file vk_resource_pool.cc.
Referenced by VKBackend, and 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 196 of file vk_resource_pool.cc.
References blender::gpu::VKBackend::device, blender::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::VKBottomLevelAS::~VKBottomLevelAS(), blender::gpu::VKShader::~VKShader(), blender::gpu::VKShaderModule::~VKShaderModule(), and blender::gpu::VKTopLevelAS::~VKTopLevelAS().
| void blender::gpu::VKDiscardPool::discard_resources | ( | Span< render_graph::VKResourceStateTracker::DiscardableResource > | discardable, |
| TimelineValue | timeline ) |
Discard a batch of resources (and their registered views).
Scheduling a resource that is already scheduled for destruction is an error (asserted).
Definition at line 58 of file vk_resource_pool.cc.
References blender::BLI_assert(), blender::gpu::render_graph::BUFFER, and blender::gpu::render_graph::IMAGE.
Referenced by blender::gpu::VKDevice::deinit(), blender::gpu::VKDevice::submission_runner(), and VKBackend.
| void blender::gpu::VKDiscardPool::discard_shader_module | ( | VkShaderModule | vk_shader_module | ) |
Definition at line 105 of file vk_resource_pool.cc.
Referenced by VKBackend, and blender::gpu::VKShaderModule::~VKShaderModule().
| void blender::gpu::VKDiscardPool::discard_swapchain_image | ( | ResourceHandle | image_handle | ) |
Definition at line 47 of file vk_resource_pool.cc.
Referenced by VKBackend.
| 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:
Definition at line 20 of file vk_resource_pool.cc.
References blender::gpu::TimelineResources< Item >::update_timeline().
Referenced by blender::gpu::VKDevice::context_unregister(), blender::gpu::VKDevice::render_graph_submit(), and VKBackend.
|
inline |
Definition at line 144 of file vk_resource_pool.hh.
Referenced by blender::gpu::VKDevice::context_unregister(), and blender::gpu::VKDevice::render_graph_submit().
|
friend |
Definition at line 210 of file vk_resource_pool.cc.
References blender::gpu::TimelineResources< Item >::is_empty(), operator<<, and blender::gpu::TimelineResources< Item >::size().
Referenced by operator<<.
|
friend |
Definition at line 81 of file vk_resource_pool.hh.
References deinit(), discard_acceleration_structure(), discard_allocation(), discard_descriptor_pool_for_reuse(), discard_image_view(), discard_pipeline(), discard_pipeline_layout(), discard_resources(), discard_shader_module(), discard_swapchain_image(), move_data(), UINT64_MAX, VKBackend, and VKDevice.
Referenced by VKBackend.
|
friend |
Definition at line 80 of file vk_resource_pool.hh.
References VKDevice.
Referenced by deinit(), destroy_discarded_resources(), discard_pool_get(), VKBackend, and VKDevice.