diff --git a/rpcs3/Emu/RSX/VK/vkutils/descriptors.cpp b/rpcs3/Emu/RSX/VK/vkutils/descriptors.cpp index 27b70d3932..611e2aae0e 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/descriptors.cpp +++ b/rpcs3/Emu/RSX/VK/vkutils/descriptors.cpp @@ -8,7 +8,7 @@ namespace vk class dispatch_manager { public: - void flush_all() + inline void flush_all() { for (auto& set : m_notification_list) { @@ -16,7 +16,7 @@ namespace vk } } - void notify(descriptor_set* set) + void register_(descriptor_set* set) { // Rare event, upon creation of a new set tracker. // Check for spurious 'new' events when the aux context is taking over @@ -26,7 +26,22 @@ namespace vk } m_notification_list.push_back(set); - rsx_log.error("Now monitoring %u descriptor sets", m_notification_list.size()); + rsx_log.warning("[descriptor_manager::register] Now monitoring %u descriptor sets", m_notification_list.size()); + } + + void deregister(descriptor_set* set) + { + for (auto it = m_notification_list.begin(); it != m_notification_list.end(); ++it) + { + if (*it == set) + { + *it = m_notification_list.back(); + m_notification_list.pop_back(); + break; + } + } + + rsx_log.warning("[descriptor_manager::deregister] Now monitoring %u descriptor sets", m_notification_list.size()); } dispatch_manager() = default; @@ -206,6 +221,14 @@ namespace vk m_handle = set; } + descriptor_set::~descriptor_set() + { + if (m_update_after_bind_mask) + { + g_fxo->get().deregister(this); + } + } + void descriptor_set::init(VkDescriptorSet new_set) { if (!m_in_use) [[unlikely]] @@ -219,7 +242,7 @@ namespace vk if (m_update_after_bind_mask) { - g_fxo->get().notify(this); + g_fxo->get().register_(this); } } else if (m_push_type_mask & ~m_update_after_bind_mask) diff --git a/rpcs3/Emu/RSX/VK/vkutils/descriptors.h b/rpcs3/Emu/RSX/VK/vkutils/descriptors.h index cd225f2241..c77a423107 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/descriptors.h +++ b/rpcs3/Emu/RSX/VK/vkutils/descriptors.h @@ -50,7 +50,7 @@ namespace vk public: descriptor_set(VkDescriptorSet set); descriptor_set() = default; - ~descriptor_set() = default; + ~descriptor_set(); descriptor_set(const descriptor_set&) = delete;