From 14625af98eff0e9ad37da1dd97be5bc5ea832413 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 31 Dec 2025 18:10:27 +1000 Subject: [PATCH] Common: Remove fallback for missing heterogeneous lookup Minspec has this now, and I don't need to worry about Debian 11 anymore. --- src/common/heterogeneous_containers.h | 21 --------------------- src/common/memory_settings_interface.h | 4 ++-- src/common/string_pool.h | 2 +- src/core/game_database.cpp | 8 ++++---- src/core/game_list.cpp | 4 ++-- src/core/gpu_hw_texture_cache.cpp | 4 ++-- src/duckstation-qt/gamelistwidget.h | 2 +- src/util/postprocessing_shader_slang.cpp | 2 +- src/util/translation.cpp | 4 ++-- 9 files changed, 15 insertions(+), 36 deletions(-) diff --git a/src/common/heterogeneous_containers.h b/src/common/heterogeneous_containers.h index 1549f36e7..ce05c971a 100644 --- a/src/common/heterogeneous_containers.h +++ b/src/common/heterogeneous_containers.h @@ -55,7 +55,6 @@ using StringMultiMap = std::multimap; using StringMultiSet = std::multiset; -#if defined(__cpp_lib_generic_unordered_lookup) && __cpp_lib_generic_unordered_lookup >= 201811L template using UnorderedStringMap = std::unordered_map; @@ -66,23 +65,3 @@ using UnorderedStringSet = std::unordered_set; using UnorderedStringMultiSet = std::unordered_multiset; - -template -using PreferUnorderedStringMap = UnorderedStringMap; -template -using PreferUnorderedStringMultimap = UnorderedStringMultimap; -using PreferUnorderedStringSet = UnorderedStringSet; -using PreferUnorderedStringMultiSet = UnorderedStringMultiSet; -#else - -#pragma message "__cpp_lib_generic_unordered_lookup is missing, performance will be slower." - -// GCC 10 doesn't support generic_unordered_lookup... -template -using PreferUnorderedStringMap = StringMap; -template -using PreferUnorderedStringMultimap = StringMultiMap; -using PreferUnorderedStringSet = StringSet; -using PreferUnorderedStringMultiSet = StringMultiSet; - -#endif diff --git a/src/common/memory_settings_interface.h b/src/common/memory_settings_interface.h index 6460e1399..3ea68e7bd 100644 --- a/src/common/memory_settings_interface.h +++ b/src/common/memory_settings_interface.h @@ -52,8 +52,8 @@ public: using SettingsInterface::GetUIntValue; private: - using KeyMap = PreferUnorderedStringMultimap; - using SectionMap = PreferUnorderedStringMap; + using KeyMap = UnorderedStringMultimap; + using SectionMap = UnorderedStringMap; void SetValue(const char* section, const char* key, std::string value); diff --git a/src/common/string_pool.h b/src/common/string_pool.h index 98ccdfb0b..ad58a88a7 100644 --- a/src/common/string_pool.h +++ b/src/common/string_pool.h @@ -75,5 +75,5 @@ public: private: std::vector m_buffer; - PreferUnorderedStringMap m_string_map; + UnorderedStringMap m_string_map; }; diff --git a/src/core/game_database.cpp b/src/core/game_database.cpp index 894b8c8cf..b8cac7656 100644 --- a/src/core/game_database.cpp +++ b/src/core/game_database.cpp @@ -55,7 +55,7 @@ static bool SaveToCache(); static bool LoadGameDBYaml(); static bool ParseYamlEntry(Entry* entry, const ryml::ConstNodeRef& value); static bool ParseYamlDiscSetEntry(DiscSetEntry* entry, const ryml::ConstNodeRef& value); -static bool ParseYamlCodes(PreferUnorderedStringMap& lookup, const ryml::ConstNodeRef& value, +static bool ParseYamlCodes(UnorderedStringMap& lookup, const ryml::ConstNodeRef& value, std::string_view serial); static void BindDiscSetsToEntries(); static bool LoadTrackHashes(); @@ -179,7 +179,7 @@ struct State std::vector entries; std::vector disc_sets; - PreferUnorderedStringMap code_lookup; + UnorderedStringMap code_lookup; TrackHashesMap track_hashes_map; @@ -1342,7 +1342,7 @@ bool GameDatabase::LoadGameDBYaml() return false; } - PreferUnorderedStringMap code_lookup; + UnorderedStringMap code_lookup; { const ryml::Tree tree = ryml::parse_in_place( to_csubstr(GAMEDB_YAML_FILENAME), c4::substr(reinterpret_cast(gamedb_data->data()), gamedb_data->size())); @@ -1696,7 +1696,7 @@ void GameDatabase::BindDiscSetsToEntries() } } -bool GameDatabase::ParseYamlCodes(PreferUnorderedStringMap& lookup, const ryml::ConstNodeRef& value, +bool GameDatabase::ParseYamlCodes(UnorderedStringMap& lookup, const ryml::ConstNodeRef& value, std::string_view serial) { const ryml::ConstNodeRef& codes = value.find_child(to_csubstr("codes")); diff --git a/src/core/game_list.cpp b/src/core/game_list.cpp index 9e0e34c8f..9d3ffac56 100644 --- a/src/core/game_list.cpp +++ b/src/core/game_list.cpp @@ -87,8 +87,8 @@ struct MemcardTimestampCacheEntry } // namespace -using CacheMap = PreferUnorderedStringMap; -using PlayedTimeMap = PreferUnorderedStringMap; +using CacheMap = UnorderedStringMap; +using PlayedTimeMap = UnorderedStringMap; static_assert(std::is_same_v); diff --git a/src/core/gpu_hw_texture_cache.cpp b/src/core/gpu_hw_texture_cache.cpp index b1d060ee7..babb09315 100644 --- a/src/core/gpu_hw_texture_cache.cpp +++ b/src/core/gpu_hw_texture_cache.cpp @@ -246,8 +246,8 @@ struct DumpedTextureKeyHash } // namespace using HashCache = std::unordered_map; -using ReplacementImageCache = PreferUnorderedStringMap; -using GPUReplacementImageCache = PreferUnorderedStringMap, u32>>; +using ReplacementImageCache = UnorderedStringMap; +using GPUReplacementImageCache = UnorderedStringMap, u32>>; using VRAMReplacementMap = std::unordered_map; using TextureReplacementMap = diff --git a/src/duckstation-qt/gamelistwidget.h b/src/duckstation-qt/gamelistwidget.h index 71ebddc02..aab2bdcb9 100644 --- a/src/duckstation-qt/gamelistwidget.h +++ b/src/duckstation-qt/gamelistwidget.h @@ -179,7 +179,7 @@ private: QPixmap m_has_achievements_pixmap; QPixmap m_mastered_achievements_pixmap; - mutable PreferUnorderedStringMap m_flag_pixmap_cache; + mutable UnorderedStringMap m_flag_pixmap_cache; mutable LRUCache m_icon_pixmap_cache; diff --git a/src/util/postprocessing_shader_slang.cpp b/src/util/postprocessing_shader_slang.cpp index c71097182..6e7664d8b 100644 --- a/src/util/postprocessing_shader_slang.cpp +++ b/src/util/postprocessing_shader_slang.cpp @@ -89,7 +89,7 @@ public: private: static bool GetLine(const std::string_view& contents, std::string_view* line, size_t& offset); - PreferUnorderedStringMap m_options; + UnorderedStringMap m_options; }; class SlangShaderPreprocessor diff --git a/src/util/translation.cpp b/src/util/translation.cpp index c8529845e..1ed40e197 100644 --- a/src/util/translation.cpp +++ b/src/util/translation.cpp @@ -19,8 +19,8 @@ static std::pair LookupTranslationString(std::string_view cont std::string_view disambiguation); static constexpr u32 TRANSLATION_STRING_CACHE_SIZE = 4 * 1024 * 1024; -using TranslationStringMap = PreferUnorderedStringMap>; -using TranslationStringContextMap = PreferUnorderedStringMap; +using TranslationStringMap = UnorderedStringMap>; +using TranslationStringContextMap = UnorderedStringMap; struct TranslationLocals {