From 7fda6dde73ab9fa1eab40d43c90720a1d9ba054f Mon Sep 17 00:00:00 2001 From: crueter Date: Mon, 31 Aug 2026 02:58:09 +0200 Subject: [common] Switch to boost::unordered_flat containers (#4326) Replaces all instances of ankerl's unordered map/set with boost's `unordered_flat_*` classes. This uses std::hash since boost::hash is actually a lot slower. Also adds an abstraction layer in `Common` so future changes are quicker and easier. Other implementation details: - ankerl provided hash specializations for tuple and pair, so those were ported here - std::erase_if doesn't work on boost, so just used the ADL'd erase_if This should be about equal or superior performance as unordered_dense for everything except iteration. Signed-off-by: crueter - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4326 Reviewed-by: Lizzie and Samuel Reviewed-by: MaranBr --- src/video_core/vulkan_common/vulkan_device.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/video_core/vulkan_common/vulkan_device.cpp') diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index b2cfd2c01d..fb3a9c4e7a 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -11,7 +11,8 @@ #include #include #include -#include +#include "common/container/unordered_map.h" +#include "common/container/unordered_set.h" #include #include @@ -157,7 +158,7 @@ VkFormatFeatureFlags GetFormatFeatures(VkFormatProperties properties, FormatType } } -ankerl::unordered_dense::map GetFormatProperties(vk::PhysicalDevice physical) { +::Common::unordered_map GetFormatProperties(vk::PhysicalDevice physical) { static constexpr std::array formats{ VK_FORMAT_A1R5G5B5_UNORM_PACK16, VK_FORMAT_A2B10G10R10_SINT_PACK32, @@ -309,7 +310,7 @@ ankerl::unordered_dense::map GetFormatProperties(v VK_FORMAT_EAC_R11G11_UNORM_BLOCK, VK_FORMAT_EAC_R11G11_SNORM_BLOCK, }; - ankerl::unordered_dense::map format_properties; + ::Common::unordered_map format_properties; for (const auto format : formats) { format_properties.emplace(format, physical.GetFormatProperties(format)); } @@ -317,7 +318,7 @@ ankerl::unordered_dense::map GetFormatProperties(v } #if defined(__ANDROID__) && defined(ARCHITECTURE_arm64) -void OverrideBcnFormats(ankerl::unordered_dense::map& format_properties) { +void OverrideBcnFormats(::Common::unordered_map& format_properties) { // These properties are extracted from Adreno driver 512.687.0 constexpr VkFormatFeatureFlags tiling_features{VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT | @@ -1676,7 +1677,7 @@ void Device::CollectToolingInfo() { std::vector Device::GetDeviceQueueCreateInfos() const { static constexpr float QUEUE_PRIORITY = 1.0f; - ankerl::unordered_dense::set unique_queue_families{graphics_family, present_family}; + ::Common::unordered_set unique_queue_families{graphics_family, present_family}; std::vector queue_cis; queue_cis.reserve(unique_queue_families.size()); -- cgit v1.2.3