From 249c3c10156c461ed6e38f9b5b72811a32e0458e Mon Sep 17 00:00:00 2001 From: Franco Date: Sun, 17 Sep 2023 21:36:38 -0300 Subject: [PATCH] Robin map and robin set implemented Robin map and robin set implemented, like Skyline, for more performance. --- .gitmodules | 3 +++ externals/CMakeLists.txt | 3 +++ src/android/app/src/main/jni/native.cpp | 2 +- src/common/fs/path_util.cpp | 4 +-- src/common/host_memory.cpp | 5 ++-- src/common/input.h | 5 ++-- src/common/param_package.h | 4 +-- src/core/arm/dynarmic/arm_dynarmic_32.h | 4 +-- src/core/arm/dynarmic/arm_dynarmic_64.h | 4 +-- src/core/hid/emulated_console.h | 4 +-- src/core/hid/emulated_controller.h | 4 +-- src/core/hid/emulated_devices.h | 4 +-- src/core/hle/kernel/kernel.cpp | 6 ++--- src/core/hle/kernel/kernel.h | 2 +- .../am/applets/applet_web_browser_types.h | 4 +-- src/core/hle/service/ldn/lan_discovery.h | 4 +-- src/core/hle/service/lm/lm.cpp | 5 ++-- src/core/hle/service/nvdrv/core/container.h | 4 +-- src/core/hle/service/nvdrv/core/nvmap.h | 4 +-- src/core/hle/service/nvdrv/devices/nvmap.h | 3 ++- src/core/hle/service/nvdrv/nvdrv.h | 6 ++--- .../nvnflinger/hos_binder_driver_server.h | 4 +-- src/core/hle/service/sm/sm.h | 6 ++--- src/input_common/drivers/sdl_driver.cpp | 2 +- src/input_common/drivers/sdl_driver.h | 5 ++-- src/input_common/input_engine.h | 14 +++++----- src/input_common/main.h | 8 +++--- .../maxwell/structured_control_flow.cpp | 4 +-- .../ir_opt/ssa_rewrite_pass.cpp | 8 +++--- src/tests/common/fibers.cpp | 4 +-- src/tests/video_core/memory_tracker.cpp | 5 ++-- .../buffer_cache/buffer_cache_base.h | 2 +- .../buffer_cache/memory_tracker_base.h | 4 +-- src/video_core/control/channel_state_cache.h | 6 ++--- src/video_core/control/scheduler.h | 4 +-- src/video_core/engines/maxwell_3d.h | 2 +- .../engines/sw_blitter/converter.cpp | 4 +-- src/video_core/gpu.cpp | 2 +- src/video_core/macro/macro.h | 6 +++-- src/video_core/macro/macro_hle.h | 3 ++- src/video_core/query_cache.h | 6 ++--- .../renderer_opengl/gl_shader_cache.h | 6 ++--- .../renderer_opengl/gl_texture_cache.h | 2 +- .../renderer_vulkan/vk_pipeline_cache.h | 6 ++--- .../renderer_vulkan/vk_render_pass_cache.cpp | 3 +-- .../renderer_vulkan/vk_render_pass_cache.h | 3 ++- src/video_core/shader_cache.h | 6 ++--- src/video_core/shader_environment.h | 18 ++++++------- src/video_core/texture_cache/texture_cache.h | 4 +-- .../texture_cache/texture_cache_base.h | 26 +++++++++---------- .../vulkan_common/vulkan_device.cpp | 10 +++---- src/video_core/vulkan_common/vulkan_device.h | 5 ++-- src/yuzu/compatibility_list.h | 5 ++-- src/yuzu/configuration/input_profiles.h | 4 +-- src/yuzu/loading_screen.cpp | 2 +- src/yuzu/loading_screen.h | 4 +-- src/yuzu/multiplayer/chat_room.h | 8 +++--- 57 files changed, 152 insertions(+), 143 deletions(-) diff --git a/.gitmodules b/.gitmodules index 361f4845bb..ebe926d123 100644 --- a/.gitmodules +++ b/.gitmodules @@ -58,3 +58,6 @@ [submodule "VulkanMemoryAllocator"] path = externals/VulkanMemoryAllocator url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git +[submodule "robin-map"] + path = externals/robin-map + url = https://github.com/Tessil/robin-map diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 82a6da9fde..7a919192fc 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -14,6 +14,9 @@ set(BUILD_SHARED_LIBS OFF) # Skip install rules for all externals set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL ON) +# Robin-map +add_subdirectory(robin-map) + # xbyak if ((ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) AND NOT TARGET xbyak::xbyak) add_subdirectory(xbyak) diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 0f2a6d9e4e..e6528cafd1 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -529,7 +529,7 @@ private: static EmulationSession s_instance; // Frontend management - std::unordered_map m_rom_metadata_cache; + tsl::robin_map m_rom_metadata_cache; // Window management std::unique_ptr m_window; diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp index d71cfacc6a..2507306496 100644 --- a/src/common/fs/path_util.cpp +++ b/src/common/fs/path_util.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include "common/fs/fs.h" #ifdef ANDROID @@ -141,7 +141,7 @@ private: SetYuzuPathImpl(yuzu_path, new_path); } - std::unordered_map yuzu_paths; + tsl::robin_map yuzu_paths; }; bool ValidatePath(const fs::path& path) { diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp index ba22595e06..d46677d15b 100644 --- a/src/common/host_memory.cpp +++ b/src/common/host_memory.cpp @@ -4,8 +4,9 @@ #ifdef _WIN32 #include -#include +#include #include + #include #include "common/dynamic_library.h" @@ -348,7 +349,7 @@ private: std::mutex placeholder_mutex; ///< Mutex for placeholders boost::icl::separate_interval_set placeholders; ///< Mapped placeholders - std::unordered_map placeholder_host_pointers; ///< Placeholder backing offset + tsl::robin_map placeholder_host_pointers; ///< Placeholder backing offset }; #elif defined(__linux__) || defined(__FreeBSD__) // ^^^ Windows ^^^ vvv Linux vvv diff --git a/src/common/input.h b/src/common/input.h index 2c4ccea22e..a3497011ec 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -6,9 +6,10 @@ #include #include #include -#include +#include #include #include + #include "common/logging/log.h" #include "common/param_package.h" #include "common/uuid.h" @@ -409,7 +410,7 @@ public: namespace Impl { template -using FactoryListType = std::unordered_map>>; +using FactoryListType = tsl::robin_map>>; template struct FactoryList { diff --git a/src/common/param_package.h b/src/common/param_package.h index d7c13cb1fc..5679edd1f9 100644 --- a/src/common/param_package.h +++ b/src/common/param_package.h @@ -5,14 +5,14 @@ #include #include -#include +#include namespace Common { /// A string-based key-value container supporting serializing to and deserializing from a string class ParamPackage { public: - using DataType = std::unordered_map; + using DataType = tsl::robin_map; ParamPackage() = default; explicit ParamPackage(const std::string& serialized); diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.h b/src/core/arm/dynarmic/arm_dynarmic_32.h index 92fb3f8368..57a68bf29c 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.h +++ b/src/core/arm/dynarmic/arm_dynarmic_32.h @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include @@ -81,7 +81,7 @@ private: using JitCacheKey = std::pair; using JitCacheType = - std::unordered_map, Common::PairHash>; + tsl::robin_map, Common::PairHash>; friend class DynarmicCallbacks32; friend class DynarmicCP15; diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.h b/src/core/arm/dynarmic/arm_dynarmic_64.h index 2b88a08e2f..d19556b885 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.h +++ b/src/core/arm/dynarmic/arm_dynarmic_64.h @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include "common/common_types.h" @@ -73,7 +73,7 @@ private: using JitCacheKey = std::pair; using JitCacheType = - std::unordered_map, Common::PairHash>; + tsl::robin_map, Common::PairHash>; friend class DynarmicCallbacks64; std::unique_ptr cb; diff --git a/src/core/hid/emulated_console.h b/src/core/hid/emulated_console.h index 79114bb6d0..aa36e5930f 100644 --- a/src/core/hid/emulated_console.h +++ b/src/core/hid/emulated_console.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include "common/common_funcs.h" #include "common/common_types.h" @@ -190,7 +190,7 @@ private: mutable std::mutex mutex; mutable std::mutex callback_mutex; - std::unordered_map callback_list; + tsl::robin_map callback_list; int last_callback_key = 0; // Stores the current status of all console input diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index 88d77db8de..1cf84d9a49 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include "common/common_types.h" @@ -603,7 +603,7 @@ private: mutable std::mutex mutex; mutable std::mutex callback_mutex; - std::unordered_map callback_list; + tsl::robin_map callback_list; int last_callback_key = 0; // Stores the current status of all controller input diff --git a/src/core/hid/emulated_devices.h b/src/core/hid/emulated_devices.h index 5eab693e46..d470936d37 100644 --- a/src/core/hid/emulated_devices.h +++ b/src/core/hid/emulated_devices.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include "common/common_types.h" @@ -202,7 +202,7 @@ private: mutable std::mutex mutex; mutable std::mutex callback_mutex; - std::unordered_map callback_list; + tsl::robin_map callback_list; int last_callback_key = 0; // Stores the current status of all external device input diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index a1134b7e26..6d293d6a8e 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include "common/assert.h" @@ -798,8 +798,8 @@ struct KernelCore::Impl { std::unique_ptr object_name_global_data; - std::unordered_set registered_objects; - std::unordered_set registered_in_use_objects; + tsl::robin_set registered_objects; + tsl::robin_set registered_in_use_objects; std::mutex server_lock; std::vector> server_managers; diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index d5b08eeb5b..94df91fe06 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include "common/polyfill_thread.h" diff --git a/src/core/hle/service/am/applets/applet_web_browser_types.h b/src/core/hle/service/am/applets/applet_web_browser_types.h index c522c5c1a5..d1d7efaac0 100644 --- a/src/core/hle/service/am/applets/applet_web_browser_types.h +++ b/src/core/hle/service/am/applets/applet_web_browser_types.h @@ -4,7 +4,7 @@ #pragma once #include -#include +#include #include #include "common/common_funcs.h" @@ -172,6 +172,6 @@ struct WebCommonReturnValue { }; static_assert(sizeof(WebCommonReturnValue) == 0x1010, "WebCommonReturnValue has incorrect size."); -using WebArgInputTLVMap = std::unordered_map>; +using WebArgInputTLVMap = tsl::robin_map>; } // namespace Service::AM::Applets diff --git a/src/core/hle/service/ldn/lan_discovery.h b/src/core/hle/service/ldn/lan_discovery.h index 3833cd764a..e5dcb957d2 100644 --- a/src/core/hle/service/ldn/lan_discovery.h +++ b/src/core/hle/service/ldn/lan_discovery.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include "common/logging/log.h" #include "common/socket_types.h" @@ -117,7 +117,7 @@ protected: std::array stations; std::array node_changes{}; std::array node_last_states{}; - std::unordered_map scan_results{}; + tsl::robin_map scan_results{}; NodeInfo node_info{}; NetworkInfo network_info{}; State state{State::None}; diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index 20df002330..e41c7b36fc 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp @@ -4,8 +4,9 @@ #include #include -#include +#include #include + #include "common/logging/log.h" #include "core/core.h" #include "core/hle/service/ipc_helpers.h" @@ -326,7 +327,7 @@ private: }; static_assert(sizeof(LogPacketHeader) == 0x18, "LogPacketHeader is an invalid size"); - std::unordered_map> entries{}; + tsl::robin_map> entries{}; LogDestination destination{LogDestination::All}; }; diff --git a/src/core/hle/service/nvdrv/core/container.h b/src/core/hle/service/nvdrv/core/container.h index b4b63ac90c..50f87d7721 100644 --- a/src/core/hle/service/nvdrv/core/container.h +++ b/src/core/hle/service/nvdrv/core/container.h @@ -6,7 +6,7 @@ #include #include -#include +#include #include "core/hle/service/nvdrv/nvdata.h" @@ -35,7 +35,7 @@ public: const SyncpointManager& GetSyncpointManager() const; struct Host1xDeviceFileData { - std::unordered_map fd_to_id{}; + tsl::robin_map fd_to_id{}; std::deque syncpts_accumulated{}; u32 nvdec_next_id{}; u32 vic_next_id{}; diff --git a/src/core/hle/service/nvdrv/core/nvmap.h b/src/core/hle/service/nvdrv/core/nvmap.h index a8e5738909..f8bfa56c98 100644 --- a/src/core/hle/service/nvdrv/core/nvmap.h +++ b/src/core/hle/service/nvdrv/core/nvmap.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include "common/bit_field.h" @@ -149,7 +149,7 @@ private: std::list> unmap_queue{}; std::mutex unmap_queue_lock{}; //!< Protects access to `unmap_queue` - std::unordered_map> + tsl::robin_map> handles{}; //!< Main owning map of handles std::mutex handles_lock; //!< Protects access to `handles` diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.h index 40c65b430b..056bcb49ea 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.h +++ b/src/core/hle/service/nvdrv/devices/nvmap.h @@ -4,8 +4,9 @@ #pragma once #include -#include +#include #include + #include "common/common_funcs.h" #include "common/common_types.h" #include "common/swap.h" diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index d8622b3ca4..1139215a68 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include "common/common_types.h" @@ -103,7 +103,7 @@ private: /// Id to use for the next open file descriptor. DeviceFD next_fd = 1; - using FilesContainerType = std::unordered_map>; + using FilesContainerType = tsl::robin_map>; /// Mapping of file descriptors to the devices they reference. FilesContainerType open_files; @@ -111,7 +111,7 @@ private: EventInterface events_interface; - std::unordered_map> builders; + tsl::robin_map> builders; }; void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system); diff --git a/src/core/hle/service/nvnflinger/hos_binder_driver_server.h b/src/core/hle/service/nvnflinger/hos_binder_driver_server.h index 58bb9469ad..f7ab30e68e 100644 --- a/src/core/hle/service/nvnflinger/hos_binder_driver_server.h +++ b/src/core/hle/service/nvnflinger/hos_binder_driver_server.h @@ -5,7 +5,7 @@ #include #include -#include +#include #include "common/common_types.h" #include "core/hle/service/kernel_helpers.h" @@ -29,7 +29,7 @@ public: private: KernelHelpers::ServiceContext service_context; - std::unordered_map> producers; + tsl::robin_map> producers; std::mutex lock; u64 last_id{}; }; diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index 14bfaf8c29..bfc31a357e 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include "common/concepts.h" #include "core/hle/kernel/k_port.h" @@ -79,8 +79,8 @@ private: /// Map of registered services, retrieved using GetServicePort. std::mutex lock; - std::unordered_map registered_services; - std::unordered_map service_ports; + tsl::robin_map registered_services; + tsl::robin_map service_ports; /// Kernel context Kernel::KernelCore& kernel; diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index 66e3ae9afd..5be5923448 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp @@ -570,7 +570,7 @@ SDLDriver::~SDLDriver() { std::vector SDLDriver::GetInputDevices() const { std::vector devices; - std::unordered_map> joycon_pairs; + tsl::robin_map> joycon_pairs; for (const auto& [key, value] : joystick_map) { for (const auto& joystick : value) { if (!joystick->GetSDLJoystick()) { diff --git a/src/input_common/drivers/sdl_driver.h b/src/input_common/drivers/sdl_driver.h index fcba4e3c63..86406e36cd 100644 --- a/src/input_common/drivers/sdl_driver.h +++ b/src/input_common/drivers/sdl_driver.h @@ -6,8 +6,7 @@ #include #include #include -#include - +#include #include #include "common/common_types.h" @@ -121,7 +120,7 @@ private: Common::SPSCQueue vibration_queue; /// Map of GUID of a list of corresponding virtual Joysticks - std::unordered_map>> joystick_map; + tsl::robin_map>> joystick_map; std::mutex joystick_map_mutex; bool start_thread = false; diff --git a/src/input_common/input_engine.h b/src/input_common/input_engine.h index c2d0cbb34f..adfcab165c 100644 --- a/src/input_common/input_engine.h +++ b/src/input_common/input_engine.h @@ -5,7 +5,7 @@ #include #include -#include +#include #include "common/common_types.h" #include "common/input.h" @@ -262,10 +262,10 @@ protected: private: struct ControllerData { - std::unordered_map buttons; - std::unordered_map hat_buttons; - std::unordered_map axes; - std::unordered_map motions; + tsl::robin_map buttons; + tsl::robin_map hat_buttons; + tsl::robin_map axes; + tsl::robin_map motions; Common::Input::BatteryLevel battery{}; Common::Input::BodyColorStatus color{}; Common::Input::CameraStatus camera{}; @@ -293,8 +293,8 @@ private: bool configuring{false}; const std::string input_engine; int last_callback_key = 0; - std::unordered_map controller_list; - std::unordered_map callback_list; + tsl::robin_map controller_list; + tsl::robin_map callback_list; MappingCallback mapping_callback; }; diff --git a/src/input_common/main.h b/src/input_common/main.h index d64a6cb4c6..d14cf29334 100644 --- a/src/input_common/main.h +++ b/src/input_common/main.h @@ -5,7 +5,7 @@ #include #include -#include +#include #include namespace Common { @@ -52,9 +52,9 @@ enum class InputType { None, Button, Stick, Motion, Touch }; * Given a ParamPackage for a Device returned from `GetInputDevices`, attempt to get the default * mapping for the device. */ -using AnalogMapping = std::unordered_map; -using ButtonMapping = std::unordered_map; -using MotionMapping = std::unordered_map; +using AnalogMapping = tsl::robin_map; +using ButtonMapping = tsl::robin_map; +using MotionMapping = tsl::robin_map; class InputSubsystem { public: diff --git a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp index 80c90fe6ac..8db123cbd7 100644 --- a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp +++ b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include @@ -387,7 +387,7 @@ private: std::optional return_label) { Statement* const false_stmt{pool.Create(Identity{}, IR::Condition{false}, &root_stmt)}; Tree& root{root_stmt.children}; - std::unordered_map local_labels; + tsl::robin_map local_labels; local_labels.reserve(function.blocks.size()); for (Flow::Block& block : function.blocks) { diff --git a/src/shader_recompiler/ir_opt/ssa_rewrite_pass.cpp b/src/shader_recompiler/ir_opt/ssa_rewrite_pass.cpp index 07cabca43e..b37da787e2 100644 --- a/src/shader_recompiler/ir_opt/ssa_rewrite_pass.cpp +++ b/src/shader_recompiler/ir_opt/ssa_rewrite_pass.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include @@ -52,7 +52,7 @@ struct IndirectBranchVariable { using Variant = std::variant; -using ValueMap = std::unordered_map; +using ValueMap = tsl::robin_map; struct DefTable { const IR::Value& Def(IR::Block* block, IR::Reg variable) { @@ -112,7 +112,7 @@ struct DefTable { } std::array preds; - std::unordered_map goto_vars; + tsl::robin_map goto_vars; ValueMap indirect_branch_var; ValueMap zero_flag; ValueMap sign_flag; @@ -295,7 +295,7 @@ private: return same; } - std::unordered_map> incomplete_phis; + tsl::robin_map> incomplete_phis; DefTable current_def; }; diff --git a/src/tests/common/fibers.cpp b/src/tests/common/fibers.cpp index ecad7583ff..186a7fec6d 100644 --- a/src/tests/common/fibers.cpp +++ b/src/tests/common/fibers.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include @@ -36,7 +36,7 @@ public: private: mutable std::mutex mutex; - std::unordered_map ids; + tsl::robin_map ids; }; class TestControl1 { diff --git a/src/tests/video_core/memory_tracker.cpp b/src/tests/video_core/memory_tracker.cpp index 6187936683..d6e79811c0 100644 --- a/src/tests/video_core/memory_tracker.cpp +++ b/src/tests/video_core/memory_tracker.cpp @@ -3,8 +3,7 @@ #include #include -#include - +#include #include #include "common/alignment.h" @@ -53,7 +52,7 @@ public: } private: - std::unordered_map page_table; + tsl::robin_map page_table; }; } // Anonymous namespace diff --git a/src/video_core/buffer_cache/buffer_cache_base.h b/src/video_core/buffer_cache/buffer_cache_base.h index 0b7135d493..a8e63813d6 100644 --- a/src/video_core/buffer_cache/buffer_cache_base.h +++ b/src/video_core/buffer_cache/buffer_cache_base.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/video_core/buffer_cache/memory_tracker_base.h b/src/video_core/buffer_cache/memory_tracker_base.h index 6036b21c99..f0c86d2d88 100644 --- a/src/video_core/buffer_cache/memory_tracker_base.h +++ b/src/video_core/buffer_cache/memory_tracker_base.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include "common/alignment.h" @@ -291,7 +291,7 @@ private: std::array top_tier{}; - std::unordered_set cached_pages; + tsl::robin_set cached_pages; RasterizerInterface* rasterizer = nullptr; }; diff --git a/src/video_core/control/channel_state_cache.h b/src/video_core/control/channel_state_cache.h index 46bc9e3227..e12cc81ca4 100644 --- a/src/video_core/control/channel_state_cache.h +++ b/src/video_core/control/channel_state_cache.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include "common/common_types.h" @@ -83,14 +83,14 @@ protected: std::deque

channel_storage; std::deque free_channel_ids; - std::unordered_map channel_map; + tsl::robin_map channel_map; std::vector active_channel_ids; struct AddresSpaceRef { size_t ref_count; size_t storage_id; Tegra::MemoryManager* gpu_memory; }; - std::unordered_map address_spaces; + tsl::robin_map address_spaces; mutable std::mutex config_mutex; virtual void OnGPUASRegister([[maybe_unused]] size_t map_id) {} diff --git a/src/video_core/control/scheduler.h b/src/video_core/control/scheduler.h index 44addf61c4..b3b4a352c2 100644 --- a/src/video_core/control/scheduler.h +++ b/src/video_core/control/scheduler.h @@ -5,7 +5,7 @@ #include #include -#include +#include #include "video_core/dma_pusher.h" @@ -27,7 +27,7 @@ public: void DeclareChannel(std::shared_ptr new_channel); private: - std::unordered_map> channels; + tsl::robin_map> channels; std::mutex scheduling_guard; GPU& gpu; }; diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 6c19354e1d..9f166e9fbc 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -3053,7 +3053,7 @@ public: void SetHLEReplacementAttributeType(u32 bank, u32 offset, HLEReplacementAttributeType name); - std::unordered_map replace_table; + tsl::robin_map replace_table; static_assert(sizeof(Regs) == Regs::NUM_REGS * sizeof(u32), "Maxwell3D Regs has wrong size"); static_assert(std::is_trivially_copyable_v, "Maxwell3D Regs must be trivially copyable"); diff --git a/src/video_core/engines/sw_blitter/converter.cpp b/src/video_core/engines/sw_blitter/converter.cpp index 2419b56321..0c3066db57 100644 --- a/src/video_core/engines/sw_blitter/converter.cpp +++ b/src/video_core/engines/sw_blitter/converter.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include "common/assert.h" #include "common/bit_cast.h" @@ -921,7 +921,7 @@ public: }; struct ConverterFactory::ConverterFactoryImpl { - std::unordered_map> converters_cache; + tsl::robin_map> converters_cache; }; ConverterFactory::ConverterFactory() { diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index c192e33b28..baf2dc117a 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -385,7 +385,7 @@ struct GPU::Impl { std::unique_ptr cpu_context; std::unique_ptr scheduler; - std::unordered_map> channels; + tsl::robin_map> channels; Tegra::Control::ChannelState* current_channel; s32 bound_channel{-1}; diff --git a/src/video_core/macro/macro.h b/src/video_core/macro/macro.h index 737ced9a45..ed31ab9b36 100644 --- a/src/video_core/macro/macro.h +++ b/src/video_core/macro/macro.h @@ -5,7 +5,9 @@ #include #include +#include #include + #include "common/bit_field.h" #include "common/common_types.h" @@ -134,8 +136,8 @@ private: bool has_hle_program{}; }; - std::unordered_map macro_cache; - std::unordered_map> uploaded_macro_code; + tsl::robin_map macro_cache; + tsl::robin_map> uploaded_macro_code; std::unique_ptr hle_macros; Engines::Maxwell3D& maxwell3d; }; diff --git a/src/video_core/macro/macro_hle.h b/src/video_core/macro/macro_hle.h index 33f92fab16..f2100f8e3c 100644 --- a/src/video_core/macro/macro_hle.h +++ b/src/video_core/macro/macro_hle.h @@ -6,6 +6,7 @@ #include #include #include +#include #include "common/common_types.h" @@ -26,7 +27,7 @@ public: private: Engines::Maxwell3D& maxwell3d; - std::unordered_map(Engines::Maxwell3D&)>> + tsl::robin_map(Engines::Maxwell3D&)>> builders; }; diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h index 7047e2e631..4d7445ba30 100644 --- a/src/video_core/query_cache.h +++ b/src/video_core/query_cache.h @@ -12,8 +12,8 @@ #include #include #include -#include -#include +#include +#include #include #include "common/assert.h" @@ -340,7 +340,7 @@ private: mutable std::recursive_mutex mutex; - std::unordered_map> cached_queries; + tsl::robin_map> cached_queries; std::array streams; diff --git a/src/video_core/renderer_opengl/gl_shader_cache.h b/src/video_core/renderer_opengl/gl_shader_cache.h index 6b9732fca1..61baf9bb3b 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.h +++ b/src/video_core/renderer_opengl/gl_shader_cache.h @@ -4,7 +4,7 @@ #pragma once #include -#include +#include #include "common/common_types.h" #include "common/thread_worker.h" @@ -77,8 +77,8 @@ private: GraphicsPipeline* current_pipeline{}; ShaderContext::ShaderPools main_pools; - std::unordered_map> graphics_cache; - std::unordered_map> compute_cache; + tsl::robin_map> graphics_cache; + tsl::robin_map> compute_cache; Shader::Profile profile; Shader::HostTranslateInfo host_info; diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index 3676eaaa96..3da5fc453c 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h @@ -149,7 +149,7 @@ private: UtilShaders util_shaders; FormatConversionPass format_conversion_pass; - std::array, 3> format_properties; + std::array, 3> format_properties; bool has_broken_texture_view_formats = false; OGLTexture null_image_1d_array; diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.h b/src/video_core/renderer_vulkan/vk_pipeline_cache.h index e323ea0fd4..96aab30ae5 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.h +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include "common/common_types.h" @@ -154,8 +154,8 @@ private: GraphicsPipelineCacheKey graphics_key{}; GraphicsPipeline* current_pipeline{}; - std::unordered_map> compute_cache; - std::unordered_map> graphics_cache; + tsl::robin_map> compute_cache; + tsl::robin_map> graphics_cache; ShaderPools main_pools; diff --git a/src/video_core/renderer_vulkan/vk_render_pass_cache.cpp b/src/video_core/renderer_vulkan/vk_render_pass_cache.cpp index ae9f1de642..e6dbc3bf13 100644 --- a/src/video_core/renderer_vulkan/vk_render_pass_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_render_pass_cache.cpp @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include - +#include #include #include "video_core/renderer_vulkan/maxwell_to_vk.h" diff --git a/src/video_core/renderer_vulkan/vk_render_pass_cache.h b/src/video_core/renderer_vulkan/vk_render_pass_cache.h index 91ad4bf577..e2b6262b8f 100644 --- a/src/video_core/renderer_vulkan/vk_render_pass_cache.h +++ b/src/video_core/renderer_vulkan/vk_render_pass_cache.h @@ -5,6 +5,7 @@ #include #include +#include #include "video_core/surface.h" #include "video_core/vulkan_common/vulkan_wrapper.h" @@ -47,7 +48,7 @@ public: private: const Device* device{}; - std::unordered_map cache; + tsl::robin_map cache; std::mutex mutex; }; diff --git a/src/video_core/shader_cache.h b/src/video_core/shader_cache.h index a76896620a..8bd2de379f 100644 --- a/src/video_core/shader_cache.h +++ b/src/video_core/shader_cache.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include @@ -150,8 +150,8 @@ private: mutable std::mutex lookup_mutex; std::mutex invalidation_mutex; - std::unordered_map> lookup_cache; - std::unordered_map> invalidation_cache; + tsl::robin_map> lookup_cache; + tsl::robin_map> invalidation_cache; std::vector> storage; std::vector marked_for_removal; }; diff --git a/src/video_core/shader_environment.h b/src/video_core/shader_environment.h index b90f3d44e2..f7d34be27a 100644 --- a/src/video_core/shader_environment.h +++ b/src/video_core/shader_environment.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include "common/common_types.h" @@ -76,10 +76,10 @@ protected: GPUVAddr program_base{}; std::vector code; - std::unordered_map texture_types; - std::unordered_map texture_pixel_formats; - std::unordered_map cbuf_values; - std::unordered_map cbuf_replacements; + tsl::robin_map texture_types; + tsl::robin_map texture_pixel_formats; + tsl::robin_map cbuf_values; + tsl::robin_map cbuf_replacements; u32 local_memory_size{}; u32 texture_bound{}; @@ -192,10 +192,10 @@ public: private: std::vector code; - std::unordered_map texture_types; - std::unordered_map texture_pixel_formats; - std::unordered_map cbuf_values; - std::unordered_map cbuf_replacements; + tsl::robin_map texture_types; + tsl::robin_map texture_pixel_formats; + tsl::robin_map cbuf_values; + tsl::robin_map cbuf_replacements; std::array workgroup_size{}; u32 local_memory_size{}; u32 shared_memory_size{}; diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 4457b366f1..a559ad3ca7 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -3,7 +3,7 @@ #pragma once -#include +#include #include #include "common/alignment.h" @@ -1970,7 +1970,7 @@ void TextureCache

::UnregisterImage(ImageId image_id) { lru_cache.Free(image.lru_index); const auto& clear_page_table = [image_id](u64 page, - std::unordered_map, Common::IdentityHash>& + tsl::robin_map, Common::IdentityHash>& selected_page_table) { const auto page_it = selected_page_table.find(page); if (page_it == selected_page_table.end()) { diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index a40825c9f2..f14203bdfa 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h @@ -9,8 +9,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -61,7 +61,7 @@ struct AsyncDecodeContext { std::atomic_bool complete; }; -using TextureCacheGPUMap = std::unordered_map, Common::IdentityHash>; +using TextureCacheGPUMap = tsl::robin_map, Common::IdentityHash>; class TextureCacheChannelInfo : public ChannelInfo { public: @@ -80,8 +80,8 @@ public: std::vector compute_sampler_ids; std::vector compute_image_view_ids; - std::unordered_map image_views; - std::unordered_map samplers; + tsl::robin_map image_views; + tsl::robin_map samplers; TextureCacheGPUMap* gpu_page_table; }; @@ -425,11 +425,11 @@ private: RenderTargets render_targets; - std::unordered_map framebuffers; + tsl::robin_map framebuffers; - std::unordered_map, Common::IdentityHash> page_table; - std::unordered_map, Common::IdentityHash> sparse_page_table; - std::unordered_map> sparse_views; + tsl::robin_map, Common::IdentityHash> page_table; + tsl::robin_map, Common::IdentityHash> sparse_page_table; + tsl::robin_map> sparse_views; VAddr virtual_invalid_space{}; @@ -478,7 +478,7 @@ private: DelayedDestructionRing sentenced_image_view; DelayedDestructionRing sentenced_framebuffers; - std::unordered_map image_allocs_table; + tsl::robin_map image_allocs_table; Common::ScratchBuffer swizzle_data_buffer; Common::ScratchBuffer unswizzle_data_buffer; @@ -491,17 +491,17 @@ private: // Join caching boost::container::small_vector join_overlap_ids; - std::unordered_set join_overlaps_found; + tsl::robin_set join_overlaps_found; boost::container::small_vector join_left_aliased_ids; boost::container::small_vector join_right_aliased_ids; - std::unordered_set join_ignore_textures; + tsl::robin_set join_ignore_textures; boost::container::small_vector join_bad_overlap_ids; struct JoinCopy { bool is_alias; ImageId id; }; boost::container::small_vector join_copies_to_do; - std::unordered_map join_alias_indices; + tsl::robin_map join_alias_indices; }; } // namespace VideoCommon diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 6174170407..4504c3043f 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include @@ -128,7 +128,7 @@ VkFormatFeatureFlags GetFormatFeatures(VkFormatProperties properties, FormatType } } -std::unordered_map GetFormatProperties(vk::PhysicalDevice physical) { +tsl::robin_map GetFormatProperties(vk::PhysicalDevice physical) { static constexpr std::array formats{ VK_FORMAT_A1R5G5B5_UNORM_PACK16, VK_FORMAT_A2B10G10R10_SINT_PACK32, @@ -268,7 +268,7 @@ std::unordered_map GetFormatProperties(vk::Physica VK_FORMAT_R8_USCALED, VK_FORMAT_S8_UINT, }; - std::unordered_map format_properties; + tsl::robin_map format_properties; for (const auto format : formats) { format_properties.emplace(format, physical.GetFormatProperties(format)); } @@ -276,7 +276,7 @@ std::unordered_map GetFormatProperties(vk::Physica } #if defined(ANDROID) && defined(ARCHITECTURE_arm64) -void OverrideBcnFormats(std::unordered_map& format_properties) { +void OverrideBcnFormats(tsl::robin_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 | @@ -1262,7 +1262,7 @@ void Device::CollectToolingInfo() { std::vector Device::GetDeviceQueueCreateInfos() const { static constexpr float QUEUE_PRIORITY = 1.0f; - std::unordered_set unique_queue_families{graphics_family, present_family}; + tsl::robin_set unique_queue_families{graphics_family, present_family}; std::vector queue_cis; queue_cis.reserve(unique_queue_families.size()); diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 488fdd3139..d65d1d71fe 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h @@ -6,9 +6,8 @@ #include #include #include -#include +#include #include - #include "common/common_types.h" #include "common/logging/log.h" #include "common/settings.h" @@ -756,7 +755,7 @@ private: std::vector valid_heap_memory; ///< Heaps used. /// Format properties dictionary. - std::unordered_map format_properties; + tsl::robin_map format_properties; /// Nsight Aftermath GPU crash tracker std::unique_ptr nsight_aftermath_tracker; diff --git a/src/yuzu/compatibility_list.h b/src/yuzu/compatibility_list.h index c0675d7936..c803597671 100644 --- a/src/yuzu/compatibility_list.h +++ b/src/yuzu/compatibility_list.h @@ -4,13 +4,12 @@ #pragma once #include -#include - +#include #include #include "common/common_types.h" -using CompatibilityList = std::unordered_map>; +using CompatibilityList = tsl::robin_map>; CompatibilityList::const_iterator FindMatchingCompatibilityEntry( const CompatibilityList& compatibility_list, u64 program_id); diff --git a/src/yuzu/configuration/input_profiles.h b/src/yuzu/configuration/input_profiles.h index 2bf3e42508..380d6e59e7 100644 --- a/src/yuzu/configuration/input_profiles.h +++ b/src/yuzu/configuration/input_profiles.h @@ -4,7 +4,7 @@ #pragma once #include -#include +#include namespace Core { class System; @@ -30,5 +30,5 @@ public: private: bool ProfileExistsInMap(const std::string& profile_name) const; - std::unordered_map> map_profiles; + tsl::robin_map> map_profiles; }; diff --git a/src/yuzu/loading_screen.cpp b/src/yuzu/loading_screen.cpp index b081fff6b6..29df15ab8a 100644 --- a/src/yuzu/loading_screen.cpp +++ b/src/yuzu/loading_screen.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include +#include #include #include #include diff --git a/src/yuzu/loading_screen.h b/src/yuzu/loading_screen.h index 17045595d3..9d2caaa494 100644 --- a/src/yuzu/loading_screen.h +++ b/src/yuzu/loading_screen.h @@ -77,8 +77,8 @@ private: std::unique_ptr fadeout_animation; // Definitions for the differences in text and styling for each stage - std::unordered_map progressbar_style; - std::unordered_map stage_translations; + tsl::robin_map progressbar_style; + tsl::robin_map stage_translations; // newly generated shaders are added to the end of the file, so when loading and compiling // shaders, it will start quickly but end slow if new shaders were added since previous launch. diff --git a/src/yuzu/multiplayer/chat_room.h b/src/yuzu/multiplayer/chat_room.h index dd71ea4cdd..8d3d38fe19 100644 --- a/src/yuzu/multiplayer/chat_room.h +++ b/src/yuzu/multiplayer/chat_room.h @@ -4,8 +4,8 @@ #pragma once #include -#include -#include +#include +#include #include #include #include @@ -64,8 +64,8 @@ private: bool has_mod_perms = false; QStandardItemModel* player_list; std::unique_ptr ui; - std::unordered_set block_list; - std::unordered_map icon_cache; + tsl::robin_set block_list; + tsl::robin_map icon_cache; Network::RoomNetwork* room_network; };