vk: Minor improvement to descriptor and garbage collector interaction

This commit is contained in:
kd-11 2023-06-01 02:52:26 +03:00 committed by kd-11
parent 12f213ffad
commit f2f95a20a3
2 changed files with 11 additions and 4 deletions

View file

@ -876,6 +876,9 @@ VKGSRender::~VKGSRender()
g_fxo->get<vk::AsyncTaskScheduler>().destroy(); g_fxo->get<vk::AsyncTaskScheduler>().destroy();
} }
// GC cleanup
vk::get_resource_manager()->flush();
// Host data // Host data
if (m_host_object_data) if (m_host_object_data)
{ {
@ -945,7 +948,9 @@ VKGSRender::~VKGSRender()
// Overlay text handler // Overlay text handler
m_text_writer.reset(); m_text_writer.reset();
//Pipeline descriptors // Pipeline descriptors
m_descriptor_pool.destroy();
vkDestroyPipelineLayout(*m_device, m_pipeline_layout, nullptr); vkDestroyPipelineLayout(*m_device, m_pipeline_layout, nullptr);
vkDestroyDescriptorSetLayout(*m_device, m_descriptor_layouts, nullptr); vkDestroyDescriptorSetLayout(*m_device, m_descriptor_layouts, nullptr);
@ -963,9 +968,6 @@ VKGSRender::~VKGSRender()
// Global resources // Global resources
vk::destroy_global_resources(); vk::destroy_global_resources();
// Destroy at the end in case of lingering callbacks
m_descriptor_pool.destroy();
// Device handles/contexts // Device handles/contexts
m_swapchain->destroy(); m_swapchain->destroy();
m_instance.destroy(); m_instance.destroy();

View file

@ -75,6 +75,11 @@ namespace vk
~resource_manager() = default; ~resource_manager() = default;
void destroy() void destroy()
{
flush();
}
void flush()
{ {
m_eid_map.clear(); m_eid_map.clear();
m_sampler_pool.clear(); m_sampler_pool.clear();