From 360fdca5acae2a01186145315f524f9922166e6a Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sun, 15 May 2022 14:54:41 +0300 Subject: [PATCH] vk: Avoid multimap when handling image views --- rpcs3/Emu/RSX/VK/vkutils/image.cpp | 13 ++++++------- rpcs3/Emu/RSX/VK/vkutils/image.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/rpcs3/Emu/RSX/VK/vkutils/image.cpp b/rpcs3/Emu/RSX/VK/vkutils/image.cpp index 8304872854..2f90963153 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/image.cpp +++ b/rpcs3/Emu/RSX/VK/vkutils/image.cpp @@ -391,13 +391,12 @@ namespace vk } } - auto found = views.equal_range(remap_encoding); - for (auto It = found.first; It != found.second; ++It) + const auto storage_key = remap_encoding | (mask << 16); + auto found = views.find(storage_key); + if (found != views.end() && + found->second->info.subresourceRange.aspectMask & mask) { - if (It->second->info.subresourceRange.aspectMask & mask) - { - return It->second.get(); - } + return found->second.get(); } VkComponentMapping real_mapping; @@ -423,7 +422,7 @@ namespace vk auto view = std::make_unique(*g_render_device, this, VK_IMAGE_VIEW_TYPE_MAX_ENUM, real_mapping, range); auto result = view.get(); - views.emplace(remap_encoding, std::move(view)); + views.emplace(storage_key, std::move(view)); return result; } diff --git a/rpcs3/Emu/RSX/VK/vkutils/image.h b/rpcs3/Emu/RSX/VK/vkutils/image.h index a0ec374751..037786a16b 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/image.h +++ b/rpcs3/Emu/RSX/VK/vkutils/image.h @@ -124,7 +124,7 @@ namespace vk class viewable_image : public image { protected: - std::unordered_multimap> views; + std::unordered_map> views; viewable_image* clone(); public: