Compare commits

..

3 Commits

Author SHA1 Message Date
Aydar Kamaltdinov d0a6e951ff shader_recompiler: gl_PrimitiveId scatter for geometry-stage stream compaction (#4330)
Guest shaders that reserve a compacted output slot via subgroup ballot
-> popcount -> atomic add cannot preserve the originating primitives'
relative order once run through the single-invocation subgroup
fallback for stages without subgroup support. gl_PrimitiveId is
already hardware-guaranteed unique and monotonically increasing per
primitive, so CompactionFallbackPass rewrites that pattern into a
gl_PrimitiveId-indexed scatter instead.

Confirmed fixing corrupted/order-scrambled compacted draws in NieR
Automata on a device without geometry-stage subgroup support.

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4330
2026-08-31 11:25:25 +02:00
CamilleLaVey 1bd6656b3c Little adjustment 2026-08-30 15:01:41 -04:00
CamilleLaVey f6508c7c74 [shader, recompiler, spir-v] Reviewed community patch provided for warp intrinsects fallback within VOTE missing instructions for QCOM drivers 2026-08-30 12:19:30 -04:00
138 changed files with 814 additions and 431 deletions
@@ -0,0 +1,26 @@
From b3622608433c183ba868a1dc8dd9cf285eb3b916 Mon Sep 17 00:00:00 2001
From: Dario Petrillo <dario.pk1@gmail.com>
Date: Thu, 27 Nov 2025 23:12:38 +0100
Subject: [PATCH] avoid extra memset when clearing an empty table
---
include/ankerl/unordered_dense.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/ankerl/unordered_dense.h b/include/ankerl/unordered_dense.h
index 0835342..4938212 100644
--- a/include/ankerl/unordered_dense.h
+++ b/include/ankerl/unordered_dense.h
@@ -1490,8 +1490,10 @@ class table : public std::conditional_t<is_map_v<T>, base_table_type_map<T>, bas
// modifiers //////////////////////////////////////////////////////////////
void clear() {
- m_values.clear();
- clear_buckets();
+ if (!empty()) {
+ m_values.clear();
+ clear_buckets();
+ }
}
auto insert(value_type const& value) -> std::pair<iterator, bool> {
+1
View File
@@ -540,6 +540,7 @@ add_subdirectory(externals)
# pass targets from externals
# TODO(crueter): CPMUtil Propagate func?
find_package(enet)
find_package(unordered_dense REQUIRED)
if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64)
find_package(xbyak)
+17
View File
@@ -179,6 +179,12 @@
"repo": "eden-emulator/oaknut",
"version": "v2.0.3"
},
"oboe": {
"bundled": true,
"hash": "ce4011afe7345370d4ead3b891cd69a5ef224b129535783586c0ca75051d303ed446e6c7f10bde8da31fff58d6e307f1732a3ffd03b249f9ef1fd48fd4132715",
"repo": "google/oboe",
"version": "1.10.0"
},
"openssl": {
"hash": "29002ce50cb95a4f4f1d0e9d3f684401fbd4eac34203dc2eef3b6334af5d44aa46bf788b63a6f5c139c383eafb7269ae87a58a9a3ad5912903b9773e545ccc0a",
"min_version": "3.0.0",
@@ -295,6 +301,17 @@
"repo": "eden-emu/tzdb_to_nx",
"version": "230326"
},
"unordered-dense": {
"bundled": true,
"find_args": "CONFIG",
"hash": "d2106f6640f6bfb81755e4b8bfb64982e46ec4a507cacdb38f940123212ccf35a20b43c70c6f01d7bfb8c246d1a16f7845d8052971949cea9def1475e3fa02c8",
"package": "unordered_dense",
"patches": [
"0001-avoid-memset-when-clearing-an-empty-table.patch"
],
"repo": "martinus/unordered_dense",
"version": "7b55cab841"
},
"vulkan-headers": {
"hash": "d2846ea228415772645eea4b52a9efd33e6a563043dd3de059e798be6391a8f0ca089f455ae420ff22574939ed0f48ed7c6ff3d5a9987d5231dbf3b3f89b484b",
"min_version": "1.4.317",
+5 -4
View File
@@ -80,6 +80,7 @@ Certain other dependencies will be fetched by CPM regardless. System packages *c
* [httplib](https://github.com/yhirose/cpp-httplib) - if `ENABLE_UPDATE_CHECKER` or `ENABLE_WEB_SERVICE` are on
* This package is known to be broken on the AUR.
* [cpp-jwt](https://github.com/arun11299/cpp-jwt) 1.4+ - if `ENABLE_WEB_SERVICE` is on
* [unordered-dense](https://github.com/martinus/unordered_dense)
On amd64:
@@ -118,7 +119,7 @@ Now, install all deps:
sudo emerge -a \
app-arch/lz4 app-arch/zstd app-arch/unzip \
dev-libs/libfmt dev-libs/libusb dev-libs/mcl dev-libs/sirit \
dev-libs/boost dev-libs/openssl dev-libs/discord-rpc \
dev-libs/unordered_dense dev-libs/boost dev-libs/openssl dev-libs/discord-rpc \
dev-util/spirv-tools dev-util/spirv-headers dev-util/vulkan-headers \
dev-util/vulkan-utility-libraries dev-util/glslang \
media-gfx/renderdoc media-libs/libva media-libs/opus media-video/ffmpeg \
@@ -259,7 +260,7 @@ brew install molten-vk
<details>
<summary>FreeBSD</summary>
As root run: `pkg install devel/cmake sdl3 devel/boost-libs devel/catch2 devel/libfmt devel/nlohmann-json devel/ninja devel/nasm devel/autoconf devel/pkgconf devel/qt6-base devel/qt6-charts devel/simpleini net/enet multimedia/ffnvcodec-headers multimedia/ffmpeg audio/opus archivers/liblz4 lang/gcc12 graphics/glslang graphics/vulkan-utility-libraries graphics/spirv-tools www/cpp-httplib vulkan-headers quazip-qt6`
As root run: `pkg install devel/cmake sdl3 devel/boost-libs devel/catch2 devel/libfmt devel/nlohmann-json devel/ninja devel/nasm devel/autoconf devel/pkgconf devel/qt6-base devel/qt6-charts devel/simpleini net/enet multimedia/ffnvcodec-headers multimedia/ffmpeg audio/opus archivers/liblz4 lang/gcc12 graphics/glslang graphics/vulkan-utility-libraries graphics/spirv-tools www/cpp-httplib devel/unordered-dense vulkan-headers quazip-qt6`
If using FreeBSD 12 or prior, use `devel/pkg-config` instead.
@@ -293,7 +294,7 @@ pkg_add cmake nasm git boost unzip--iconv autoconf-2.72p0 bash ffmpeg glslang gm
<summary>DragonFlyBSD</summary>
```sh
pkg install gcc14 git cmake unzip nasm autoconf bash pkgconf ffmpeg glslang gmake jq nlohmann-json enet spirv-tools sdl3 vulkan-utility-libraries vulkan-headers catch2 libfmt openssl liblz4 boost-libs cpp-httplib qt6-base qt6-charts quazip-qt6 libva-vdpau-driver libva-utils libva-intel-driver
pkg install gcc14 git cmake unzip nasm autoconf bash pkgconf ffmpeg glslang gmake jq nlohmann-json enet spirv-tools sdl3 vulkan-utility-libraries vulkan-headers catch2 libfmt openssl liblz4 boost-libs cpp-httplib qt6-base qt6-charts quazip-qt6 unordered-dense libva-vdpau-driver libva-utils libva-intel-driver
```
[Caveats](./Caveats.md#dragonflybsd).
@@ -327,7 +328,7 @@ sudo pkgin install git cmake autoconf build-essential libusb-1 nasm gcc13
```sh
BASE="git make autoconf libtool automake-wrapper jq patch"
MINGW="qt6-base qt6-charts qt6-tools qt6-translations qt6-svg cmake toolchain clang python-pip openssl vulkan-memory-allocator vulkan-devel glslang boost fmt lz4 nlohmann-json zlib zstd enet opus libusb openssl SDL3"
MINGW="qt6-base qt6-charts qt6-tools qt6-translations qt6-svg cmake toolchain clang python-pip openssl vulkan-memory-allocator vulkan-devel glslang boost fmt lz4 nlohmann-json zlib zstd enet opus libusb unordered_dense openssl SDL3"
# Either x86_64 or clang-aarch64 (Windows on ARM)
packages="$BASE"
for pkg in $MINGW; do
+26
View File
@@ -308,6 +308,32 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
### unordered_dense
```
MIT License
Copyright (c) 2022 Martin Leitner-Ankerl
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
### xbyak
```
+10
View File
@@ -58,6 +58,9 @@ if (WIN32 AND NOT TARGET LLVM::Demangle)
add_library(LLVM::Demangle ALIAS demangle)
endif()
# unordered_dense
AddJsonPackage(unordered-dense)
# httplib
if (IOS)
set(HTTPLIB_USE_BROTLI_IF_AVAILABLE OFF)
@@ -388,6 +391,13 @@ if (YUZU_CRASH_DUMPS AND NOT TARGET libbreakpad_client)
endif()
endif()
# oboe
if (ANDROID)
AddJsonPackage(oboe)
add_library(oboe::oboe ALIAS oboe)
endif()
if (APPLE)
# moltenvk
if (NOT YUZU_USE_BUNDLED_MOLTENVK)
@@ -11,7 +11,6 @@ import org.yuzu.yuzu_emu.utils.NativeConfig
enum class StringSetting(override val key: String) : AbstractStringSetting {
DRIVER_PATH("driver_path"),
DEVICE_NAME("device_name"),
LOG_FILTER("log_filter"),
PROGRAM_ARGS("program_args"),
WEB_TOKEN("eden_token"),
@@ -1033,13 +1033,6 @@ abstract class SettingsItem(
descriptionId = R.string.use_auto_stub_description
)
)
put(
StringInputSetting(
StringSetting.LOG_FILTER,
titleId = R.string.log_filter,
descriptionId = R.string.log_filter_description
)
)
put(
SpinBoxSetting(
UShortSetting.DEBUG_KNOBS,
@@ -1323,7 +1323,6 @@ class SettingsFragmentPresenter(
add(HeaderSetting(R.string.log))
add(BooleanSetting.DEBUG_FLUSH_BY_LINE.key)
add(StringSetting.LOG_FILTER.key)
}
add(HeaderSetting(R.string.general))
@@ -20,7 +20,7 @@ struct RomMetadata {
std::vector<u8> icon;
bool isHomebrew;
};
static ::Common::unordered_map<std::string, RomMetadata> m_rom_metadata_cache;
static ankerl::unordered_dense::map<std::string, RomMetadata> m_rom_metadata_cache;
static RomMetadata CacheRomMetadata(const std::string& path) {
auto& instance = EmulationSession::GetInstance();
@@ -21,7 +21,7 @@
#include "input_common/drivers/virtual_gamepad.h"
#include "native.h"
::Common::unordered_map<std::string, std::unique_ptr<AndroidConfig>> map_profiles;
ankerl::unordered_dense::map<std::string, std::unique_ptr<AndroidConfig>> map_profiles;
bool IsHandheldOnly() {
const auto npad_style_set =
@@ -799,6 +799,10 @@
<string name="theme_mode_light">روشن</string>
<string name="theme_mode_dark">تاریک</string>
<!-- Audio output engines -->
<string name="oboe">oboe</string>
<string name="cubeb">cubeb</string>
<!-- Anisotropic filtering options -->
<string name="multiplier_x2">x2</string>
<string name="multiplier_x4">x4</string>
@@ -465,14 +465,14 @@
<string-array name="outputEngineEntries">
<item>@string/auto</item>
<item>@string/oboe</item>
<item>@string/cubeb</item>
<item>@string/sdl3</item>
<item>@string/string_null</item>
</string-array>
<integer-array name="outputEngineValues">
<item>0</item>
<item>4</item>
<item>1</item>
<item>2</item>
<item>3</item>
</integer-array>
@@ -636,8 +636,6 @@
<string name="log">Logging</string>
<string name="flush_by_line">Flush debug logs by line</string>
<string name="flush_by_line_description">Flushes debugging logs on each line written, making debugging easier in cases of crashing or freezing.</string>
<string name="log_filter">Log filter</string>
<string name="log_filter_description">Controls Eden\'s log categories. Example: *:Info Service.LM:Debug</string>
<!-- GPU Logging strings -->
<string name="gpu_logging_header">GPU Logging</string>
@@ -1240,7 +1238,7 @@
<string name="theme_mode_dark">Dark</string>
<!-- Audio output engines -->
<string name="sdl3" translatable="false">sdl3</string>
<string name="oboe" translatable="false">oboe</string>
<string name="cubeb" translatable="false">cubeb</string>
<!-- Anisotropic filtering options -->
+15 -5
View File
@@ -238,10 +238,20 @@ if (ENABLE_CUBEB)
target_compile_definitions(audio_core PRIVATE HAVE_CUBEB=1)
endif()
target_sources(audio_core PRIVATE
sink/sdl3_sink.cpp
sink/sdl3_sink.h)
target_link_libraries(audio_core PRIVATE SDL3::SDL3)
target_compile_definitions(audio_core PRIVATE HAVE_SDL3)
if(ANDROID)
target_sources(audio_core PRIVATE
sink/oboe_sink.cpp
sink/oboe_sink.h)
target_link_libraries(audio_core PRIVATE oboe)
target_compile_definitions(audio_core PUBLIC HAVE_OBOE)
else()
target_sources(audio_core PRIVATE
sink/sdl3_sink.cpp
sink/sdl3_sink.h)
target_link_libraries(audio_core PRIVATE SDL3::SDL3)
target_compile_definitions(audio_core PRIVATE HAVE_SDL3)
endif()
create_target_directory_groups(audio_core)
+230
View File
@@ -0,0 +1,230 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <span>
#include <vector>
#include <oboe/Oboe.h>
#include "audio_core/common/common.h"
#include "audio_core/sink/oboe_sink.h"
#include "audio_core/sink/sink_stream.h"
#include "common/logging.h"
#include "common/scope_exit.h"
#include "core/core.h"
namespace AudioCore::Sink {
class OboeSinkStream final : public SinkStream,
public oboe::AudioStreamDataCallback,
public oboe::AudioStreamErrorCallback {
public:
explicit OboeSinkStream(Core::System& system_, StreamType type_, const std::string& name_,
u32 system_channels_)
: SinkStream(system_, type_) {
name = name_;
system_channels = system_channels_;
this->OpenStream();
}
~OboeSinkStream() override {
LOG_INFO(Audio_Sink, "Destroyed Oboe stream");
}
void Finalize() override {
this->Stop();
m_stream.reset();
}
void Start(bool resume = false) override {
if (!m_stream || !paused) {
return;
}
paused = false;
if (m_stream->start() != oboe::Result::OK) {
LOG_CRITICAL(Audio_Sink, "Error starting Oboe stream");
}
}
void Stop() override {
if (!m_stream || paused) {
return;
}
this->SignalPause();
if (m_stream->stop() != oboe::Result::OK) {
LOG_CRITICAL(Audio_Sink, "Error stopping Oboe stream");
}
}
public:
static s32 QueryChannelCount(oboe::Direction direction) {
std::shared_ptr<oboe::AudioStream> temp_stream;
oboe::AudioStreamBuilder builder;
const auto result = ConfigureBuilder(builder, direction)->openStream(temp_stream);
if (result == oboe::Result::OK) {
return temp_stream->getChannelCount() >= 6 ? 6 : 2;
}
LOG_ERROR(Audio_Sink, "Failed to open {} stream. Using default channel count 2",
direction == oboe::Direction::Output ? "output" : "input");
return 2;
}
protected:
oboe::DataCallbackResult onAudioReady(oboe::AudioStream*, void* audio_data,
s32 num_buffer_frames) override {
const size_t num_channels = this->GetDeviceChannels();
const size_t frame_size = num_channels;
const size_t num_frames = static_cast<size_t>(num_buffer_frames);
if (type == StreamType::In) {
std::span<const s16> input_buffer{reinterpret_cast<const s16*>(audio_data),
num_frames * frame_size};
this->ProcessAudioIn(input_buffer, num_frames);
} else {
std::span<s16> output_buffer{reinterpret_cast<s16*>(audio_data),
num_frames * frame_size};
this->ProcessAudioOutAndRender(output_buffer, num_frames);
}
return oboe::DataCallbackResult::Continue;
}
void onErrorAfterClose(oboe::AudioStream*, oboe::Result) override {
LOG_INFO(Audio_Sink, "Audio stream closed, reinitializing");
if (this->OpenStream()) {
m_stream->start();
}
}
private:
static oboe::AudioStreamBuilder* ConfigureBuilder(oboe::AudioStreamBuilder& builder,
oboe::Direction direction) {
// TODO: investigate callback delay issues when using AAudio
return builder.setPerformanceMode(oboe::PerformanceMode::LowLatency)
->setAudioApi(oboe::AudioApi::OpenSLES)
->setDirection(direction)
->setSampleRate(TargetSampleRate)
->setSampleRateConversionQuality(oboe::SampleRateConversionQuality::High)
->setFormat(oboe::AudioFormat::I16)
->setFormatConversionAllowed(true)
->setUsage(oboe::Usage::Game)
->setBufferCapacityInFrames(TargetSampleCount * 2);
}
bool OpenStream() {
const auto direction = [&]() {
switch (type) {
case StreamType::In:
return oboe::Direction::Input;
case StreamType::Out:
case StreamType::Render:
return oboe::Direction::Output;
default:
ASSERT(false);
return oboe::Direction::Output;
}
}();
const auto expected_channels = QueryChannelCount(direction);
const auto expected_mask = [&]() {
switch (expected_channels) {
case 1:
return oboe::ChannelMask::Mono;
case 2:
return oboe::ChannelMask::Stereo;
case 6:
return oboe::ChannelMask::CM5Point1;
default:
ASSERT(false);
return oboe::ChannelMask::Unspecified;
}
}();
oboe::AudioStreamBuilder builder;
const auto result = ConfigureBuilder(builder, direction)
->setChannelCount(expected_channels)
->setChannelMask(expected_mask)
->setChannelConversionAllowed(true)
->setDataCallback(this)
->setErrorCallback(this)
->openStream(m_stream);
ASSERT(result == oboe::Result::OK);
return result == oboe::Result::OK && this->SetStreamProperties();
}
bool SetStreamProperties() {
ASSERT(m_stream);
m_stream->setBufferSizeInFrames(TargetSampleCount * 2);
device_channels = m_stream->getChannelCount();
const auto sample_rate = m_stream->getSampleRate();
const auto buffer_capacity = m_stream->getBufferCapacityInFrames();
const auto stream_backend =
m_stream->getAudioApi() == oboe::AudioApi::AAudio ? "AAudio" : "OpenSLES";
LOG_INFO(Audio_Sink, "Opened Oboe {} stream with {} channels sample rate {} capacity {}",
stream_backend, device_channels, sample_rate, buffer_capacity);
return true;
}
std::shared_ptr<oboe::AudioStream> m_stream{};
};
OboeSink::OboeSink() {
// TODO: This is not generally knowable
// The channel count is distinct based on direction and can change
device_channels = OboeSinkStream::QueryChannelCount(oboe::Direction::Output);
}
OboeSink::~OboeSink() = default;
SinkStream* OboeSink::AcquireSinkStream(Core::System& system, u32 system_channels,
const std::string& name, StreamType type) {
SinkStreamPtr& stream = sink_streams.emplace_back(
std::make_unique<OboeSinkStream>(system, type, name, system_channels));
return stream.get();
}
void OboeSink::CloseStream(SinkStream* to_remove) {
sink_streams.remove_if([&](auto& stream) { return stream.get() == to_remove; });
}
void OboeSink::CloseStreams() {
sink_streams.clear();
}
f32 OboeSink::GetDeviceVolume() const {
if (sink_streams.empty()) {
return 1.0f;
}
return sink_streams.front()->GetDeviceVolume();
}
void OboeSink::SetDeviceVolume(f32 volume) {
for (auto& stream : sink_streams) {
stream->SetDeviceVolume(volume);
}
}
void OboeSink::SetSystemVolume(f32 volume) {
for (auto& stream : sink_streams) {
stream->SetSystemVolume(volume);
}
}
} // namespace AudioCore::Sink
+75
View File
@@ -0,0 +1,75 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <list>
#include <string>
#include "audio_core/sink/sink.h"
namespace Core {
class System;
}
namespace AudioCore::Sink {
class SinkStream;
class OboeSink final : public Sink {
public:
explicit OboeSink();
~OboeSink() override;
/**
* Create a new sink stream.
*
* @param system - Core system.
* @param system_channels - Number of channels the audio system expects.
* May differ from the device's channel count.
* @param name - Name of this stream.
* @param type - Type of this stream, render/in/out.
*
* @return A pointer to the created SinkStream
*/
SinkStream* AcquireSinkStream(Core::System& system, u32 system_channels,
const std::string& name, StreamType type) override;
/**
* Close a given stream.
*
* @param stream - The stream to close.
*/
void CloseStream(SinkStream* stream) override;
/**
* Close all streams.
*/
void CloseStreams() override;
/**
* Get the device volume. Set from calls to the IAudioDevice service.
*
* @return Volume of the device.
*/
f32 GetDeviceVolume() const override;
/**
* Set the device volume. Set from calls to the IAudioDevice service.
*
* @param volume - New volume of the device.
*/
void SetDeviceVolume(f32 volume) override;
/**
* Set the system volume. Comes from the audio system using this stream.
*
* @param volume - New volume of the system.
*/
void SetSystemVolume(f32 volume) override;
private:
/// List of streams managed by this sink
std::list<SinkStreamPtr> sink_streams{};
};
} // namespace AudioCore::Sink
+13
View File
@@ -10,6 +10,9 @@
#include <vector>
#include "audio_core/sink/sink_details.h"
#ifdef HAVE_OBOE
#include "audio_core/sink/oboe_sink.h"
#endif
#ifdef HAVE_CUBEB
#include "audio_core/sink/cubeb_sink.h"
#endif
@@ -48,6 +51,16 @@ struct SinkDetails {
// sink_details is ordered in terms of desirability, with the best choice at the top.
constexpr SinkDetails sink_details[] = {
#ifdef HAVE_OBOE
SinkDetails{
Settings::AudioEngine::Oboe,
[](std::string_view device_id) -> std::unique_ptr<Sink> {
return std::make_unique<OboeSink>();
},
[](bool capture) { return std::vector<std::string>{"Default"}; },
[]() { return 0u; },
},
#endif
#ifdef HAVE_CUBEB
SinkDetails{
Settings::AudioEngine::Cubeb,
+2 -3
View File
@@ -147,8 +147,7 @@ add_library(
cpu_features.cpp
cpu_features.h
httplib.h
net/net.h net/net.cpp
container/unordered_map.h container/unordered_set.h)
net/net.h net/net.cpp)
if(WIN32)
target_sources(common PRIVATE windows/timer_resolution.cpp
@@ -242,7 +241,7 @@ if (lz4_ADDED)
target_include_directories(common PRIVATE ${lz4_SOURCE_DIR}/lib)
endif()
target_link_libraries(common PUBLIC fmt::fmt stb::headers Threads::Threads)
target_link_libraries(common PUBLIC fmt::fmt stb::headers Threads::Threads unordered_dense::unordered_dense)
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd)
# Please refer to src/common/demangle.cpp
-16
View File
@@ -1,16 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include "common/container_hash.h"
#include <boost/unordered/unordered_flat_map.hpp>
namespace Common {
template <class Key, class T, class Hash = std::hash<Key>, class Pred = std::equal_to<Key>,
class Allocator = std::allocator<std::pair<const Key, T>>>
using unordered_map = boost::unordered::unordered_flat_map<Key, T, Hash, Pred, Allocator>;
}
-16
View File
@@ -1,16 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include "common/container_hash.h"
#include <boost/unordered/unordered_flat_set.hpp>
namespace Common {
template <class Key, class Hash = std::hash<Key>, class Pred = std::equal_to<Key>,
class Allocator = std::allocator<Key>>
using unordered_set = boost::unordered::unordered_flat_set<Key, Hash, Pred, Allocator>;
}
-33
View File
@@ -10,11 +10,8 @@
#include <array>
#include <climits>
#include <cstdint>
#include <functional>
#include <limits>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
namespace Common {
@@ -72,17 +69,10 @@ struct HashCombineImpl<64> {
} // namespace detail
template <typename T>
requires std::is_unsigned_v<T>
inline void HashCombine(std::size_t& seed, const T& v) {
seed = detail::HashCombineImpl<sizeof(std::size_t) * CHAR_BIT>::fn(seed, detail::HashValue(v));
}
template <typename T>
requires (!std::is_unsigned_v<T>)
inline void HashCombine(std::size_t& seed, const T& v) {
seed = detail::HashCombineImpl<sizeof(std::size_t) * CHAR_BIT>::fn(seed, std::hash<T>{}(v));
}
template <typename It>
inline std::size_t HashRange(It first, It last) {
std::size_t seed = 0;
@@ -105,26 +95,3 @@ std::size_t HashValue(const std::vector<T, Allocator>& v) {
}
} // namespace Common
namespace std {
template <typename... Args>
struct hash<std::tuple<Args...>> {
std::size_t operator()(const std::tuple<Args...>& t) const noexcept {
std::size_t seed = 0;
std::apply([&seed](const Args&... args) { (Common::HashCombine(seed, args), ...); }, t);
return seed;
}
};
template <class A, class B>
struct hash<std::pair<A, B>> {
std::size_t operator()(const std::pair<A, B>& p) const noexcept {
std::size_t seed = 0;
Common::HashCombine(seed, p.first);
Common::HashCombine(seed, p.second);
return seed;
}
};
} // namespace std
+3 -3
View File
@@ -7,7 +7,7 @@
#include <algorithm>
#include <iostream>
#include <sstream>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/assert.h"
#include "common/fs/fs.h"
@@ -196,8 +196,8 @@ private:
SetLegacyPathImpl(legacy_path, new_path);
}
::Common::unordered_map<EdenPath, fs::path> eden_paths;
::Common::unordered_map<EmuPath, fs::path> legacy_paths;
ankerl::unordered_dense::map<EdenPath, fs::path> eden_paths;
ankerl::unordered_dense::map<EmuPath, fs::path> legacy_paths;
};
bool ValidatePath(const fs::path& path) {
+2 -2
View File
@@ -7,7 +7,7 @@
#ifdef _WIN32
#include <iterator>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <boost/icl/separate_interval_set.hpp>
#include <windows.h>
#include "common/dynamic_library.h"
@@ -391,7 +391,7 @@ private:
std::mutex placeholder_mutex; ///< Mutex for placeholders
boost::icl::separate_interval_set<size_t> placeholders; ///< Mapped placeholders
::Common::unordered_map<size_t, size_t> placeholder_host_pointers; ///< Placeholder backing offset
ankerl::unordered_dense::map<size_t, size_t> placeholder_host_pointers; ///< Placeholder backing offset
};
#elif defined(__OPENORBIS__) || defined(__managarm__)
+2 -2
View File
@@ -9,7 +9,7 @@
#include <functional>
#include <memory>
#include <string>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <utility>
#include <vector>
#include "common/logging.h"
@@ -412,7 +412,7 @@ public:
namespace Impl {
template <typename InputDeviceType>
using FactoryListType = ::Common::unordered_map<std::string, std::shared_ptr<Factory<InputDeviceType>>>;
using FactoryListType = ankerl::unordered_dense::map<std::string, std::shared_ptr<Factory<InputDeviceType>>>;
template <typename InputDeviceType>
struct FactoryList {
+2 -2
View File
@@ -8,14 +8,14 @@
#include <initializer_list>
#include <string>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
namespace Common {
/// A string-based key-value container supporting serializing to and deserializing from a string
class ParamPackage {
public:
using DataType = ::Common::unordered_map<std::string, std::string>;
using DataType = ankerl::unordered_dense::map<std::string, std::string>;
ParamPackage() = default;
explicit ParamPackage(const std::string& serialized);
+3 -3
View File
@@ -92,14 +92,14 @@ struct EnumMetadata {
// AudioEngine must be specified discretely due to having existing but slightly different
// canonicalizations
// TODO (lat9nq): Remove explicit definition of AudioEngine/sink_id
enum class AudioEngine : u32 { Auto, Cubeb, Sdl3, Null, };
enum class AudioEngine : u32 { Auto, Cubeb, Sdl3, Null, Oboe, };
template<>
inline std::vector<std::pair<std::string_view, AudioEngine>> EnumMetadata<AudioEngine>::Canonicalizations() {
return {
{"auto", AudioEngine::Auto},
{"cubeb", AudioEngine::Cubeb},
{"sdl3", AudioEngine::Sdl3},
{"null", AudioEngine::Null},
{"null", AudioEngine::Null}, {"oboe", AudioEngine::Oboe},
};
}
/// @brief This is just a sufficiently large number that is more than the number of other enums declared here
@@ -113,7 +113,7 @@ inline AudioEngine EnumMetadata<AudioEngine>::GetFirst() {
}
template<>
inline AudioEngine EnumMetadata<AudioEngine>::GetLast() {
return AudioEngine::Null;
return AudioEngine::Oboe;
}
ENUM(AudioMode, Mono, Stereo, Surround);
+3 -4
View File
@@ -22,11 +22,10 @@
#endif
// You must ensure this matches with src/common/x64/xbyak.h on root dir
#include "common/container/unordered_map.h"
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include <boost/unordered_map.hpp>
#define XBYAK_STD_UNORDERED_SET ::Common::unordered_set
#define XBYAK_STD_UNORDERED_MAP ::Common::unordered_map
#define XBYAK_STD_UNORDERED_SET ankerl::unordered_dense::set
#define XBYAK_STD_UNORDERED_MAP ankerl::unordered_dense::map
#define XBYAK_STD_UNORDERED_MULTIMAP boost::unordered_multimap
#include <xbyak/xbyak.h>
#include <xbyak/xbyak_util.h>
+1 -1
View File
@@ -8,7 +8,7 @@
#include <atomic>
#include <memory>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <dynarmic/interface/A64/a64.h>
#include <dynarmic/interface/code_page.h>
+2 -2
View File
@@ -4,7 +4,7 @@
#pragma once
#include <span>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <vector>
#include <oaknut/code_block.hpp>
#include <oaknut/oaknut.hpp>
@@ -46,7 +46,7 @@ enum class PatchMode : u32 {
using ModuleTextAddress = u64;
using PatchTextAddress = u64;
using EntryTrampolines = ::Common::unordered_map<ModuleTextAddress, PatchTextAddress>;
using EntryTrampolines = ankerl::unordered_dense::map<ModuleTextAddress, PatchTextAddress>;
class Patcher {
public:
+33 -59
View File
@@ -8,7 +8,7 @@
#include <utility>
#include <span>
#include <cctype>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/hex_util.h"
#include "common/logging.h"
@@ -104,7 +104,7 @@ struct IPSwitchRecord {
size_t count;
};
struct IPSwitchCompiler::IPSwitchPatch {
::Common::unordered_map<u32, IPSwitchRecord> records;
ankerl::unordered_dense::map<u32, IPSwitchRecord> records;
bool enabled;
};
@@ -123,13 +123,11 @@ static IPSwitchRecord EscapeStringSequences(std::string_view sv) {
for (auto it = sv.cbegin(); it != sv.cend(); ) {
if (*it == '\\' && it + 1 < sv.cend()) {
switch (it[1]) {
case 'a': r.data[r.count] = '\a'; break;
case 'b': r.data[r.count] = '\b'; break;
case 'e': r.data[r.count] = '\e'; break;
case 'f': r.data[r.count] = '\f'; break;
case 'n': r.data[r.count] = '\n'; break;
case 'r': r.data[r.count] = '\r'; break;
case 't': r.data[r.count] = '\t'; break;
case 'b': r.data[r.count] = '\b'; break;
case 'r': r.data[r.count] = '\r'; break;
case 'e': r.data[r.count] = '\e'; break;
case 'v': r.data[r.count] = '\v'; break;
case '?': r.data[r.count] = '\?'; break;
default: r.data[r.count] = it[1]; break;
@@ -144,60 +142,40 @@ static IPSwitchRecord EscapeStringSequences(std::string_view sv) {
return r;
}
[[nodiscard]] static inline std::array<u8, 32> ReadNSOBuildId(std::string_view const s) {
std::array<u8, 32> r{};
for (std::size_t i = 0; i < s.size(); ++i)
r[i / 2] |= u8(u8(Common::ToHexNibble(s[i])) << u8((i % 2) * 4));
return r;
}
void IPSwitchCompiler::Parse(std::span<u8 const> bytes) {
LOG_INFO(Loader, "IPSwitchCompiler: '{}'", patch_text->GetName());
bool is_little_endian = true;
bool is_little_endian = false;
s64 offset_shift = 0;
//bool print_values = false;
auto const parse_line = [&](std::string_view const line) {
// Keep in mind lines have trimmed spaces (at the end & start)!
LOG_INFO(Loader, "<{}>", line);
// IPSwitch is case insensitive
// Yes this is how the logic goes for the main reference parsers!
if (line.size() > 2 && line[0] == '@') {
switch (line[1]) {
// yes, @nsobid too -- NSO Build ID Specifier
case 'n':
case 'N':
nso_build_id = Common::HexStringToArray<0x20>(fmt::format("{:0<64}", line.substr(8)));
break;
// @stop
case 's':
case 'S':
return false;
// @enabled
case 'e':
case 'E':
patches.push_back({{}, true});
break;
// @disabled
case 'd':
case 'D':
patches.push_back({{}, false});
break;
// @flag
case 'f':
case 'F': {
if (line.starts_with("@flag offset_shift")) {
offset_shift = std::strtoll(line.data() + 19, nullptr, 0); // Offset Shift Flag
} else if (line.starts_with("@flag print_values")) {
//print_values = true; // Force printing of applied values
}
break;
}
case 'l':
case 'L':
is_little_endian = true;
break;
// IPS parsers dont support big endian no more, we do due to backcompat
case 'b':
case 'B':
is_little_endian = false;
break;
default:
LOG_WARNING(Loader, "Unknown flag {}", line);
break;
}
if (line.starts_with("@stop")) {
return false; // Force stop
} else if (line.starts_with("@nsobid-")) { // NSO Build ID Specifier
nso_build_id = ReadNSOBuildId(line.substr(8));
} else if (line.starts_with("@enabled")) {
patches.push_back({{}, true}); //enabled patch
} else if (line.starts_with("@disabled")) {
patches.push_back({{}, false}); //disabled patch
} else if (line.starts_with("@flag offset_shift ")) {
offset_shift = std::strtoll(line.data() + 19, nullptr, 0); // Offset Shift Flag
} else if (line.starts_with("@little-endian")) {
is_little_endian = true; // Set values to read as little endian
} else if (line.starts_with("@big-endian")) {
is_little_endian = false; // Set values to read as big endian
} else if (line.starts_with("@flag print_values")) {
//print_values = true; // Force printing of applied values
} else if (line.starts_with("@")) {
LOG_WARNING(Loader, "Unknown flag {}", line);
} else {
size_t offset = size_t(std::strtoul(line.data(), nullptr, 16));
offset += size_t(offset_shift);
@@ -219,7 +197,6 @@ void IPSwitchCompiler::Parse(std::span<u8 const> bytes) {
auto const start = line.cbegin() + first_space + 1;
auto const end = line.cend();
if (start <= line.cend() && end <= line.cend()) {
// Actually IPS wants ordering from {lsb, ..., msb} -- so LE and BE are inverted, fun!
auto const hs = Common::HexStringToVector({start, end}, is_little_endian);
std::memcpy(r.data.data(), hs.data(), hs.size());
r.count = hs.size();
@@ -254,8 +231,7 @@ void IPSwitchCompiler::Parse(std::span<u8 const> bytes) {
char quote = '\0';
auto const sline_start = p;
for (; p < sline.cend(); ) {
// we dont check for "//", IPS checks for '/' only...
if ((!quote && p[0] == '/')
if ((!quote && p + 1 < sline.cend() && p[0] == '/' && p[1] == '/')
|| (!quote && p[0] == '#')) {
break;
} else if (p[0] == '\"' || p[0] == '\'') {
@@ -290,8 +266,6 @@ VirtualFile IPSwitchCompiler::Apply(const VirtualFile& in) const {
if (record.first + replace_size > in_data.size())
replace_size = in_data.size() - record.first;
std::memcpy(in_data.data() + record.first, record.second.data.data(), replace_size);
} else {
LOG_WARNING(Loader, "record offs={:x},size={:x}", record.first, record.second.data.size());
}
}
}
+1 -1
View File
@@ -566,7 +566,7 @@ VirtualFile RegisteredCache::GetFileAtID(NcaID id) const {
return file;
}
static std::optional<NcaID> CheckMapForContentRecord(const ::Common::unordered_map<u64, CNMT>& map, u64 title_id, ContentRecordType type) {
static std::optional<NcaID> CheckMapForContentRecord(const ankerl::unordered_dense::map<u64, CNMT>& map, u64 title_id, ContentRecordType type) {
auto cmnt_iter = map.find(title_id);
u8 id_offset = 0;
+6 -6
View File
@@ -12,7 +12,7 @@
#include <optional>
#include <string>
#include <vector>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <boost/container/flat_map.hpp>
#include "common/common_types.h"
#include "core/crypto/key_manager.h"
@@ -209,11 +209,11 @@ private:
ContentProviderParsingFunction parser;
// maps tid -> NcaID of meta
::Common::unordered_map<u64, NcaID> meta_id;
ankerl::unordered_dense::map<u64, NcaID> meta_id;
// maps tid -> meta
::Common::unordered_map<u64, CNMT> meta;
ankerl::unordered_dense::map<u64, CNMT> meta;
// maps tid -> meta for CNMT in yuzu_meta
::Common::unordered_map<u64, CNMT> yuzu_meta;
ankerl::unordered_dense::map<u64, CNMT> yuzu_meta;
};
enum class ContentProviderUnionSlot {
@@ -313,8 +313,8 @@ private:
void ProcessXCI(const VirtualFile& file);
std::vector<VirtualDir> load_dirs;
::Common::unordered_map<std::tuple<u64, ContentRecordType, TitleType>, VirtualFile> entries;
::Common::unordered_map<u64, u32> versions;
ankerl::unordered_dense::map<std::tuple<u64, ContentRecordType, TitleType>, VirtualFile> entries;
ankerl::unordered_dense::map<u64, u32> versions;
std::vector<ExternalUpdateEntry> multi_version_entries;
};
+3 -3
View File
@@ -6,7 +6,7 @@
#include <algorithm>
#include <set>
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include <utility>
#include "core/file_sys/vfs/vfs_layered.h"
@@ -63,7 +63,7 @@ std::string LayeredVfsDirectory::GetFullPath() const {
std::vector<VirtualFile> LayeredVfsDirectory::GetFiles() const {
std::vector<VirtualFile> out;
::Common::unordered_set<std::string> out_names;
ankerl::unordered_dense::set<std::string> out_names;
for (const auto& layer : dirs) {
for (auto& file : layer->GetFiles()) {
@@ -79,7 +79,7 @@ std::vector<VirtualFile> LayeredVfsDirectory::GetFiles() const {
std::vector<VirtualDir> LayeredVfsDirectory::GetSubdirectories() const {
std::vector<VirtualDir> out;
::Common::unordered_set<std::string> out_names;
ankerl::unordered_dense::set<std::string> out_names;
for (const auto& layer : dirs) {
for (const auto& sd : layer->GetSubdirectories()) {
+2 -2
View File
@@ -78,7 +78,7 @@ private:
std::array<DebugWatchpoint, Core::Hardware::NUM_WATCHPOINTS> m_watchpoints{};
std::map<KProcessAddress, u64> m_debug_page_refcounts{};
#ifdef HAS_NCE
::Common::unordered_map<u64, u64> m_post_handlers{};
ankerl::unordered_dense::map<u64, u64> m_post_handlers{};
#endif
std::unique_ptr<Core::ExclusiveMonitor> m_exclusive_monitor;
Core::Memory::Memory m_memory;
@@ -494,7 +494,7 @@ public:
static void Switch(KernelCore& kernel, KProcess* cur_process, KProcess* next_process);
#ifdef HAS_NCE
::Common::unordered_map<u64, u64>& GetPostHandlers() noexcept {
ankerl::unordered_dense::map<u64, u64>& GetPostHandlers() noexcept {
return m_post_handlers;
}
#endif
+3 -4
View File
@@ -10,8 +10,7 @@
#include <functional>
#include <memory>
#include <thread>
#include "common/container/unordered_map.h"
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include <utility>
#include "common/assert.h"
@@ -793,8 +792,8 @@ struct KernelCore::Impl {
std::optional<KObjectNameGlobalData> object_name_global_data;
::Common::unordered_set<KAutoObject*> registered_objects;
::Common::unordered_set<KAutoObject*> registered_in_use_objects;
ankerl::unordered_dense::set<KAutoObject*> registered_objects;
ankerl::unordered_dense::set<KAutoObject*> registered_in_use_objects;
std::mutex server_lock;
std::vector<std::unique_ptr<Service::ServerManager>> server_managers;
+1 -1
View File
@@ -11,7 +11,7 @@
#include <list>
#include <memory>
#include <string>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <vector>
#include "common/polyfill_thread.h"
@@ -7,7 +7,7 @@
#pragma once
#include <array>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <vector>
#include "common/common_funcs.h"
@@ -176,6 +176,6 @@ struct WebCommonReturnValue {
};
static_assert(sizeof(WebCommonReturnValue) == 0x1010, "WebCommonReturnValue has incorrect size.");
using WebArgInputTLVMap = ::Common::unordered_map<WebArgInputTLVType, std::vector<u8>>;
using WebArgInputTLVMap = ankerl::unordered_dense::map<WebArgInputTLVType, std::vector<u8>>;
} // namespace Service::AM::Frontend
@@ -40,8 +40,8 @@ std::vector<u8> default_logo_small;
std::vector<u8> default_logo_large;
bool default_logos_loaded = false;
::Common::unordered_map<std::string, std::vector<u8>> news_images_small;
::Common::unordered_map<std::string, std::vector<u8>> news_images_large;
ankerl::unordered_dense::map<std::string, std::vector<u8>> news_images_small;
ankerl::unordered_dense::map<std::string, std::vector<u8>> news_images_large;
std::mutex images_mutex;
@@ -12,7 +12,7 @@
#include <optional>
#include <span>
#include <string>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <vector>
#include "common/common_types.h"
@@ -93,7 +93,7 @@ private:
static s64 Now();
mutable std::mutex mtx;
::Common::unordered_map<std::string, StoredNews> items;
ankerl::unordered_dense::map<std::string, StoredNews> items;
size_t open_counter{};
};
+2 -2
View File
@@ -6,7 +6,7 @@
#pragma once
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/fs/fs.h"
#include "core/hle/result.h"
@@ -88,7 +88,7 @@ private:
AlbumFileDateTime ConvertToAlbumDateTime(u64 posix_time) const;
bool is_mounted{};
::Common::unordered_map<AlbumFileId, std::filesystem::path> album_files;
ankerl::unordered_dense::map<AlbumFileId, std::filesystem::path> album_files;
Core::System& system;
};
+2 -2
View File
@@ -15,7 +15,7 @@
#include <random>
#include <span>
#include <thread>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/logging.h"
#include "common/socket_types.h"
@@ -119,7 +119,7 @@ protected:
std::array<LanStation, StationCountMax> stations;
std::array<NodeLatestUpdate, NodeCountMax> node_changes{};
std::array<u8, NodeCountMax> node_last_states{};
::Common::unordered_map<MacAddress, NetworkInfo, MACAddressHash> scan_results{};
ankerl::unordered_dense::map<MacAddress, NetworkInfo, MACAddressHash> scan_results{};
NodeInfo node_info{};
NetworkInfo network_info{};
State state{State::None};
+2 -2
View File
@@ -7,7 +7,7 @@
#include <string>
#include <optional>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <boost/container_hash/hash.hpp>
#include "common/logging.h"
#include "core/core.h"
@@ -331,7 +331,7 @@ private:
};
static_assert(sizeof(LogPacketHeader) == 0x18, "LogPacketHeader is an invalid size");
::Common::unordered_map<LogPacketHeaderEntry, std::vector<u8>> entries{};
ankerl::unordered_dense::map<LogPacketHeaderEntry, std::vector<u8>> entries{};
LogDestination destination{LogDestination::All};
};
+1 -1
View File
@@ -23,7 +23,7 @@
#include <mutex>
#include <optional>
#include <thread>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <common/settings.h>
#ifdef _WIN32
+1 -1
View File
@@ -9,7 +9,7 @@
#include <deque>
#include <memory>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "core/device_memory_manager.h"
#include "core/hle/service/nvdrv/nvdata.h"
+2 -2
View File
@@ -12,7 +12,7 @@
#include <memory>
#include <mutex>
#include <optional>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <assert.h>
#include "common/bit_field.h"
@@ -161,7 +161,7 @@ private:
std::list<std::shared_ptr<Handle>> unmap_queue{};
std::mutex unmap_queue_lock{}; //!< Protects access to `unmap_queue`
::Common::unordered_map<Handle::Id, std::shared_ptr<Handle>>
ankerl::unordered_dense::map<Handle::Id, std::shared_ptr<Handle>>
handles{}; //!< Main owning map of handles
std::mutex handles_lock; //!< Protects access to `handles`
@@ -13,7 +13,7 @@
#include <memory>
#include <mutex>
#include <optional>
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include <vector>
#include "common/address_space.h"
@@ -113,7 +113,7 @@ private:
};
static_assert(sizeof(IoctlRemapEntry) == 20, "IoctlRemapEntry is incorrect size");
::Common::unordered_set<s64_le> map_buffer_offsets{};
ankerl::unordered_dense::set<s64_le> map_buffer_offsets{};
struct IoctlMapBufferEx {
MappingFlags flags{}; // bit0: fixed_offset, bit2: cacheable
@@ -217,7 +217,7 @@ private:
NvCore::SyncpointManager& syncpoint_manager;
NvCore::NvMap& nvmap;
std::shared_ptr<Tegra::Control::ChannelState> channel_state;
::Common::unordered_map<DeviceFD, NvCore::SessionId> sessions;
ankerl::unordered_dense::map<DeviceFD, NvCore::SessionId> sessions;
u32 channel_syncpoint;
std::mutex channel_mutex;
@@ -7,7 +7,7 @@
#pragma once
#include <deque>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <vector>
#include "common/common_types.h"
@@ -138,7 +138,7 @@ protected:
NvCore::NvMap& nvmap;
NvCore::ChannelType channel_type;
std::array<u32, MaxSyncPoints> device_syncpoints{};
::Common::unordered_map<DeviceFD, NvCore::SessionId> sessions;
ankerl::unordered_dense::map<DeviceFD, NvCore::SessionId> sessions;
};
}; // namespace Devices
} // namespace Service::Nvidia
+2 -2
View File
@@ -7,7 +7,7 @@
#pragma once
#include <memory>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <vector>
#include "common/common_funcs.h"
#include "common/common_types.h"
@@ -118,7 +118,7 @@ private:
NvCore::Container& container;
NvCore::NvMap& file;
::Common::unordered_map<DeviceFD, NvCore::SessionId> sessions;
ankerl::unordered_dense::map<DeviceFD, NvCore::SessionId> sessions;
};
} // namespace Service::Nvidia::Devices
+3 -3
View File
@@ -12,7 +12,7 @@
#include <memory>
#include <span>
#include <string>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/common_types.h"
#include "core/hle/service/kernel_helpers.h"
@@ -103,7 +103,7 @@ private:
/// Id to use for the next open file descriptor.
DeviceFD next_fd = 1;
using FilesContainerType = ::Common::unordered_map<DeviceFD, std::shared_ptr<Devices::nvdevice>>;
using FilesContainerType = ankerl::unordered_dense::map<DeviceFD, std::shared_ptr<Devices::nvdevice>>;
/// Mapping of file descriptors to the devices they reference.
FilesContainerType open_files;
@@ -111,7 +111,7 @@ private:
EventInterface events_interface;
::Common::unordered_map<std::string, std::function<FilesContainerType::iterator(DeviceFD)>> builders;
ankerl::unordered_dense::map<std::string, std::function<FilesContainerType::iterator(DeviceFD)>> builders;
};
void LoopProcess(Core::System& system);
@@ -8,7 +8,7 @@
#include <memory>
#include <mutex>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/common_types.h"
#include "core/hle/service/nvnflinger/binder.h"
@@ -39,8 +39,8 @@ private:
mutable std::mutex lock;
s32 last_id = 0;
::Common::unordered_map<s32, std::shared_ptr<android::IBinder>> binders;
::Common::unordered_map<s32, RefCounts> refcounts;
ankerl::unordered_dense::map<s32, std::shared_ptr<android::IBinder>> binders;
ankerl::unordered_dense::map<s32, RefCounts> refcounts;
};
} // namespace Service::Nvnflinger
@@ -6,7 +6,7 @@
#pragma once
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/uuid.h"
#include "core/hle/service/cmif_types.h"
@@ -56,10 +56,10 @@ private:
}
};
::Common::unordered_map<AppKey, bool, AppKeyHash> app_auto_transfer_{};
::Common::unordered_map<Common::UUID, bool> global_auto_upload_{};
::Common::unordered_map<Common::UUID, bool> global_auto_download_{};
::Common::unordered_map<AppKey, u8, AppKeyHash> autonomy_task_status_{};
ankerl::unordered_dense::map<AppKey, bool, AppKeyHash> app_auto_transfer_{};
ankerl::unordered_dense::map<Common::UUID, bool> global_auto_upload_{};
ankerl::unordered_dense::map<Common::UUID, bool> global_auto_download_{};
ankerl::unordered_dense::map<AppKey, u8, AppKeyHash> autonomy_task_status_{};
};
} // namespace Service::OLSC
+3 -3
View File
@@ -8,7 +8,7 @@
#include <cstddef>
#include <mutex>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/common_types.h"
#include "core/hle/service/hle_ipc.h"
@@ -99,8 +99,8 @@ private:
void ReportUnimplementedFunction(HLERequestContext& ctx, const FunctionInfoBase* info);
protected:
::Common::unordered_map<u32, FunctionInfoBase> handlers;
::Common::unordered_map<u32, FunctionInfoBase> handlers_tipc;
ankerl::unordered_dense::map<u32, FunctionInfoBase> handlers;
ankerl::unordered_dense::map<u32, FunctionInfoBase> handlers_tipc;
/// Used to gain exclusive access to the service members, e.g. from CoreTiming thread.
std::mutex lock_service;
/// System context that the service operates under.
+3 -3
View File
@@ -10,7 +10,7 @@
#include <memory>
#include <mutex>
#include <string>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <concepts>
#include "core/hle/kernel/k_port.h"
@@ -100,8 +100,8 @@ private:
/// Map of registered services, retrieved using GetServicePort.
mutable std::mutex lock;
::Common::unordered_map<std::string, SessionRequestHandlerFactory> registered_services;
::Common::unordered_map<std::string, Kernel::KClientPort*> service_ports;
ankerl::unordered_dense::map<std::string, SessionRequestHandlerFactory> registered_services;
ankerl::unordered_dense::map<std::string, Kernel::KClientPort*> service_ports;
/// Kernel context
Kernel::KernelCore& kernel;
+2 -2
View File
@@ -7,7 +7,7 @@
#pragma once
#include <memory>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/common_types.h"
#include "common/polyfill_thread.h"
@@ -49,7 +49,7 @@ private:
private:
Core::System& m_system;
Container& m_container;
::Common::unordered_map<u64, VsyncManager> m_vsync_managers;
ankerl::unordered_dense::map<u64, VsyncManager> m_vsync_managers;
std::shared_ptr<Core::Timing::EventType> m_event;
Common::Event m_signal;
std::jthread m_thread;
+3 -3
View File
@@ -8,7 +8,7 @@
#include <mutex>
#include <sstream>
#include <string>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <fmt/format.h>
#include <nlohmann/json.hpp>
@@ -21,8 +21,8 @@
namespace Core::LaunchTimestampCache {
namespace {
using CacheMap = ::Common::unordered_map<u64, s64>;
using CountMap = ::Common::unordered_map<u64, u64>;
using CacheMap = ankerl::unordered_dense::map<u64, s64>;
using CountMap = ankerl::unordered_dense::map<u64, u64>;
std::mutex g_mutex;
CacheMap g_cache;
+1
View File
@@ -120,6 +120,7 @@ if (NOT Boost_FOUND)
endif()
find_package(fmt 8 CONFIG)
find_package(unordered_dense REQUIRED)
if ("arm64" IN_LIST ARCHITECTURE OR DYNARMIC_TESTS)
find_package(oaknut 2.0.1 CONFIG)
@@ -8,6 +8,7 @@ if (NOT @BUILD_SHARED_LIBS@)
find_dependency(Boost 1.57)
find_dependency(fmt 9)
find_dependency(mcl 0.1.12 EXACT)
find_dependency(unordered_dense)
if ("arm64" IN_LIST ARCHITECTURE)
find_dependency(oaknut 2.0.1)
+1
View File
@@ -387,6 +387,7 @@ set_target_properties(dynarmic PROPERTIES
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
target_link_libraries(dynarmic PRIVATE unordered_dense::unordered_dense)
target_link_libraries(dynarmic PUBLIC fmt::fmt common)
if (BOOST_NO_HEADERS)
@@ -75,7 +75,7 @@ CodePtr AddressSpace::GetOrEmit(IR::LocationDescriptor descriptor) {
return block_info.entry_point;
}
void AddressSpace::InvalidateBasicBlocks(const ::Common::unordered_set<IR::LocationDescriptor>& descriptors) {
void AddressSpace::InvalidateBasicBlocks(const ankerl::unordered_dense::set<IR::LocationDescriptor>& descriptors) {
UnprotectCodeMemory();
for (const auto& descriptor : descriptors) {
@@ -14,8 +14,7 @@
#include "common/common_types.h"
#include <oaknut/code_block.hpp>
#include <oaknut/oaknut.hpp>
#include "common/container/unordered_map.h"
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include "dynarmic/backend/arm64/emit_arm64.h"
#include "dynarmic/backend/arm64/fastmem.h"
@@ -42,7 +41,7 @@ public:
CodePtr GetOrEmit(IR::LocationDescriptor descriptor);
void InvalidateBasicBlocks(const ::Common::unordered_set<IR::LocationDescriptor>& descriptors);
void InvalidateBasicBlocks(const ankerl::unordered_dense::set<IR::LocationDescriptor>& descriptors);
void ClearCache();
protected:
@@ -77,9 +76,9 @@ protected:
// A IR::LocationDescriptor will have one current CodePtr.
// However, there can be multiple other CodePtrs which are older, previously invalidated blocks.
std::map<CodePtr, IR::LocationDescriptor> reverse_block_entries;
::Common::unordered_map<IR::LocationDescriptor, CodePtr> block_entries;
::Common::unordered_map<CodePtr, EmittedBlockInfo> block_infos;
::Common::unordered_map<IR::LocationDescriptor, ::Common::unordered_set<CodePtr>> block_references;
ankerl::unordered_dense::map<IR::LocationDescriptor, CodePtr> block_entries;
ankerl::unordered_dense::map<CodePtr, EmittedBlockInfo> block_infos;
ankerl::unordered_dense::map<IR::LocationDescriptor, ankerl::unordered_dense::set<CodePtr>> block_references;
ExceptionHandler exception_handler;
FastmemManager fastmem_manager;
@@ -14,7 +14,7 @@
#include <vector>
#include "common/common_types.h"
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "dynarmic/backend/arm64/fastmem.h"
#include "dynarmic/interface/A32/coprocessor.h"
@@ -105,8 +105,8 @@ struct EmittedBlockInfo {
CodePtr entry_point;
std::size_t size;
std::vector<Relocation> relocations;
::Common::unordered_map<IR::LocationDescriptor, std::vector<BlockRelocation>> block_relocations;
::Common::unordered_map<std::ptrdiff_t, FastmemPatchInfo> fastmem_patch_info;
ankerl::unordered_dense::map<IR::LocationDescriptor, std::vector<BlockRelocation>> block_relocations;
ankerl::unordered_dense::map<std::ptrdiff_t, FastmemPatchInfo> fastmem_patch_info;
};
struct EmitConfig {
@@ -10,7 +10,7 @@
#include <cstddef>
#include <tuple>
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include "dynarmic/mcl/bit.hpp"
#include "common/common_types.h"
@@ -59,7 +59,7 @@ public:
private:
ExceptionHandler& exception_handler;
::Common::unordered_set<DoNotFastmemMarker, DoNotFastmemMarkerHash> do_not_fastmem;
ankerl::unordered_dense::set<DoNotFastmemMarker, DoNotFastmemMarkerHash> do_not_fastmem;
};
} // namespace Dynarmic::Backend::Arm64
@@ -18,8 +18,7 @@
#include "common/common_types.h"
#include "dynarmic/mcl/is_instance_of_template.hpp"
#include <oaknut/oaknut.hpp>
#include "common/container/unordered_map.h"
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include "dynarmic/backend/arm64/stack_layout.h"
#include "dynarmic/ir/cond.h"
@@ -337,7 +336,7 @@ private:
std::array<HostLocInfo, SpillCount> spills;
mutable std::size_t alloc_candidate_index = 0;
::Common::unordered_set<const IR::Inst*> defined_insts;
ankerl::unordered_dense::set<const IR::Inst*> defined_insts;
};
template<typename T>
@@ -11,13 +11,13 @@
#include <boost/icl/interval_map.hpp>
#include <boost/icl/interval_set.hpp>
#include "common/common_types.h"
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
namespace Dynarmic::Backend {
template<typename P>
void BlockRangeInformation<P>::AddRange(boost::icl::discrete_interval<P> range, IR::LocationDescriptor location) {
block_ranges.add(std::make_pair(range, ::Common::unordered_set<IR::LocationDescriptor>{location}));
block_ranges.add(std::make_pair(range, ankerl::unordered_dense::set<IR::LocationDescriptor>{location}));
}
template<typename P>
@@ -26,8 +26,8 @@ void BlockRangeInformation<P>::ClearCache() {
}
template<typename P>
::Common::unordered_set<IR::LocationDescriptor> BlockRangeInformation<P>::InvalidateRanges(const boost::icl::interval_set<P>& ranges) {
::Common::unordered_set<IR::LocationDescriptor> erase_locations;
ankerl::unordered_dense::set<IR::LocationDescriptor> BlockRangeInformation<P>::InvalidateRanges(const boost::icl::interval_set<P>& ranges) {
ankerl::unordered_dense::set<IR::LocationDescriptor> erase_locations;
for (auto invalidate_interval : ranges) {
auto pair = block_ranges.equal_range(invalidate_interval);
for (auto it = pair.first; it != pair.second; ++it)
@@ -12,8 +12,7 @@
#include <boost/icl/interval_map.hpp>
#include <boost/icl/interval_set.hpp>
#include "common/container/unordered_map.h"
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include "dynarmic/ir/location_descriptor.h"
@@ -24,8 +23,8 @@ class BlockRangeInformation {
public:
void AddRange(boost::icl::discrete_interval<P> range, IR::LocationDescriptor location);
void ClearCache();
::Common::unordered_set<IR::LocationDescriptor> InvalidateRanges(const boost::icl::interval_set<P>& ranges);
boost::icl::interval_map<P, ::Common::unordered_set<IR::LocationDescriptor>> block_ranges;
ankerl::unordered_dense::set<IR::LocationDescriptor> InvalidateRanges(const boost::icl::interval_set<P>& ranges);
boost::icl::interval_map<P, ankerl::unordered_dense::set<IR::LocationDescriptor>> block_ranges;
};
} // namespace Dynarmic::Backend
@@ -17,7 +17,7 @@
#include <optional>
#include <shared_mutex>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <fmt/format.h>
#include <sys/mman.h>
@@ -55,7 +55,7 @@ class SigHandler {
});
}
::Common::unordered_map<u64, CodeBlockInfo> code_block_infos;
ankerl::unordered_dense::map<u64, CodeBlockInfo> code_block_infos;
std::shared_mutex code_block_infos_mutex;
struct sigaction old_sa_segv;
struct sigaction old_sa_bus;
@@ -4,7 +4,7 @@
#pragma once
#include "dynarmic/backend/loongarch64/lagoon_cpp.h"
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "dynarmic/backend/loongarch64/code_block.h"
#include "dynarmic/backend/loongarch64/emit_loongarch64.h"
@@ -53,8 +53,8 @@ private:
const A32::UserConfig conf;
CodeBlock cb;
::Common::unordered_map<u64, CodePtr> block_entries;
::Common::unordered_map<u64, EmittedBlockInfo> block_infos;
ankerl::unordered_dense::map<u64, CodePtr> block_entries;
ankerl::unordered_dense::map<u64, EmittedBlockInfo> block_infos;
public:
struct PreludeInfo {
@@ -9,7 +9,7 @@
#include <vector>
#include "dynarmic/backend/loongarch64/lagoon_cpp.h"
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/assert.h"
#include "common/common_types.h"
@@ -9,7 +9,7 @@
#pragma once
#include <biscuit/assembler.hpp>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "dynarmic/backend/riscv64/code_block.h"
#include "dynarmic/backend/riscv64/emit_riscv64.h"
@@ -74,8 +74,8 @@ private:
CodeBlock cb;
biscuit::Assembler as;
::Common::unordered_map<u64, CodePtr> block_entries;
::Common::unordered_map<u64, EmittedBlockInfo> block_infos;
ankerl::unordered_dense::map<u64, CodePtr> block_entries;
ankerl::unordered_dense::map<u64, EmittedBlockInfo> block_infos;
struct PreludeInfo {
CodePtr end_of_prelude;
@@ -19,7 +19,7 @@
#include "common/assert.h"
#include "common/common_types.h"
#include "dynarmic/mcl/is_instance_of_template.hpp"
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "dynarmic/backend/riscv64/stack_layout.h"
#include "dynarmic/ir/cond.h"
@@ -13,8 +13,7 @@
#include <set>
#include <tuple>
#include "common/container/unordered_map.h"
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include "dynarmic/backend/block_range_information.h"
#include "dynarmic/backend/x64/a32_jitstate.h"
@@ -127,11 +126,11 @@ public:
RegAlloc reg_alloc; //reusable reg alloc
BlockRangeInformation<u32> block_ranges;
std::array<FastDispatchEntry, fast_dispatch_table_size> fast_dispatch_table;
::Common::unordered_map<u64, FastmemPatchInfo> fastmem_patch_info;
::Common::unordered_map<std::tuple<bool, size_t, int, int>, void (*)()> read_fallbacks;
::Common::unordered_map<std::tuple<bool, size_t, int, int>, void (*)()> write_fallbacks;
::Common::unordered_map<std::tuple<bool, size_t, int, int>, void (*)()> exclusive_write_fallbacks;
::Common::unordered_set<DoNotFastmemMarker> do_not_fastmem;
ankerl::unordered_dense::map<u64, FastmemPatchInfo> fastmem_patch_info;
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> read_fallbacks;
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> write_fallbacks;
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> exclusive_write_fallbacks;
ankerl::unordered_dense::set<DoNotFastmemMarker> do_not_fastmem;
boost::container::stable_vector<Xbyak::Label> shared_labels;
void (*memory_read_128)() = nullptr; // Dummy
void (*memory_write_128)() = nullptr; // Dummy
@@ -12,8 +12,7 @@
#include <map>
#include <optional>
#include <tuple>
#include "common/container/unordered_map.h"
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include <boost/container/static_vector.hpp>
#include "dynarmic/backend/block_range_information.h"
@@ -123,11 +122,11 @@ public:
RegAlloc reg_alloc; //reusable reg alloc
BlockRangeInformation<u64> block_ranges;
std::array<FastDispatchEntry, fast_dispatch_table_size> fast_dispatch_table;
::Common::unordered_map<u64, FastmemPatchInfo> fastmem_patch_info;
::Common::unordered_map<std::tuple<bool, size_t, int, int>, void (*)()> read_fallbacks;
::Common::unordered_map<std::tuple<bool, size_t, int, int>, void (*)()> write_fallbacks;
::Common::unordered_map<std::tuple<bool, size_t, int, int>, void (*)()> exclusive_write_fallbacks;
::Common::unordered_set<DoNotFastmemMarker> do_not_fastmem;
ankerl::unordered_dense::map<u64, FastmemPatchInfo> fastmem_patch_info;
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> read_fallbacks;
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> write_fallbacks;
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> exclusive_write_fallbacks;
ankerl::unordered_dense::set<DoNotFastmemMarker> do_not_fastmem;
boost::container::stable_vector<Xbyak::Label> shared_labels;
const void* terminal_handler_pop_rsb_hint = nullptr;
const void* terminal_handler_fast_dispatch_hint = nullptr;
@@ -14,7 +14,7 @@
#include <utility>
#include "common/common_types.h"
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "dynarmic/backend/x64/xbyak.h"
namespace Dynarmic::Backend::X64 {
@@ -43,7 +43,7 @@ private:
}
};
::Common::unordered_map<ConstantT, void*, ConstantHash> constant_info;
ankerl::unordered_dense::map<ConstantT, void*, ConstantHash> constant_info;
std::span<ConstantT> pool;
std::size_t insertion_point;
};
@@ -14,8 +14,7 @@
#include <boost/variant/detail/apply_visitor_binary.hpp>
#include "dynarmic/mcl/bit.hpp"
#include "common/common_types.h"
#include "common/container/unordered_map.h"
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include "dynarmic/backend/x64/block_of_code.h"
#include "dynarmic/backend/x64/nzcv_util.h"
@@ -397,7 +396,7 @@ void EmitX64::ClearCache() {
PerfMapClear();
}
void EmitX64::InvalidateBasicBlocks(const ::Common::unordered_set<IR::LocationDescriptor>& locations) {
void EmitX64::InvalidateBasicBlocks(const ankerl::unordered_dense::set<IR::LocationDescriptor>& locations) {
code.EnableWriting();
for (const auto& descriptor : locations) {
if (auto const it = block_descriptors.find(descriptor); it != block_descriptors.end()) {
@@ -16,8 +16,7 @@
#include <type_traits>
#include <vector>
#include "common/container/unordered_map.h"
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include <boost/container/stable_vector.hpp>
#include <boost/container/small_vector.hpp>
@@ -89,7 +88,7 @@ public:
virtual void ClearCache();
/// Invalidates a selection of basic blocks.
void InvalidateBasicBlocks(const ::Common::unordered_set<IR::LocationDescriptor>& locations);
void InvalidateBasicBlocks(const ankerl::unordered_dense::set<IR::LocationDescriptor>& locations);
//protected:
// Microinstruction emitters
@@ -132,8 +131,8 @@ public:
// State
BlockOfCode& code;
ExceptionHandler exception_handler;
::Common::unordered_map<IR::LocationDescriptor, BlockDescriptor> block_descriptors;
::Common::unordered_map<IR::LocationDescriptor, PatchInformation> patch_information;
ankerl::unordered_dense::map<IR::LocationDescriptor, BlockDescriptor> block_descriptors;
ankerl::unordered_dense::map<IR::LocationDescriptor, PatchInformation> patch_information;
// We need materialized protected members
friend class A64EmitX64;
@@ -4,11 +4,10 @@
#pragma once
// You must ensure this matches with src/common/x64/xbyak.h on root dir
#include "common/container/unordered_map.h"
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include <boost/unordered_map.hpp>
#define XBYAK_STD_UNORDERED_SET ::Common::unordered_set
#define XBYAK_STD_UNORDERED_MAP ::Common::unordered_map
#define XBYAK_STD_UNORDERED_SET ankerl::unordered_dense::set
#define XBYAK_STD_UNORDERED_MAP ankerl::unordered_dense::map
#define XBYAK_STD_UNORDERED_MULTIMAP boost::unordered_multimap
#include <xbyak/xbyak.h>
#include <xbyak/xbyak_util.h>
+2 -2
View File
@@ -11,7 +11,7 @@
#include <map>
#include <bit>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "boost/container/small_vector.hpp"
#include "dynarmic/frontend/A32/a32_ir_emitter.h"
#include "dynarmic/frontend/A32/a32_location_descriptor.h"
@@ -1433,7 +1433,7 @@ static void VerificationPass(const IR::Block& block) {
ASSERT(IR::AreTypesCompatible(t1, t2));
}
}
::Common::unordered_map<IR::Inst*, size_t> actual_uses;
ankerl::unordered_dense::map<IR::Inst*, size_t> actual_uses;
for (auto const& inst : block.instructions) {
for (size_t i = 0; i < inst.NumArgs(); i++)
if (IR::Value const arg = inst.GetArg(i); !arg.IsImmediate())
+2 -2
View File
@@ -8,7 +8,7 @@
#include <array>
#include <exception>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <catch2/catch_test_macros.hpp>
#include "common/common_types.h"
@@ -23,7 +23,7 @@ namespace {
class MyEnvironment final : public A64::UserCallbacks {
public:
u64 ticks_left = 0;
::Common::unordered_map<u64, u8> memory{};
ankerl::unordered_dense::map<u64, u8> memory{};
u8 MemoryRead8(u64 vaddr) override {
return memory[vaddr];
+2 -2
View File
@@ -8,7 +8,7 @@
#pragma once
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/assert.h"
#include "common/common_types.h"
#include "dynarmic/interface/A64/a64.h"
@@ -17,7 +17,7 @@ using Vector = Dynarmic::A64::Vector;
class A64TestEnv : public Dynarmic::A64::UserCallbacks {
public:
::Common::unordered_map<u64, u8> modified_memory;
ankerl::unordered_dense::map<u64, u8> modified_memory;
std::vector<u32> code_mem;
u64 ticks_left = 0;
u64 code_mem_start_address = 0;
+5 -5
View File
@@ -24,7 +24,7 @@ add_executable(dynarmic_tests
A64/real_world.cpp
A64/testenv.h
)
target_link_libraries(dynarmic_tests PRIVATE merry::oaknut)
target_link_libraries(dynarmic_tests PRIVATE merry::oaknut unordered_dense::unordered_dense)
if (DYNARMIC_TESTS_USE_UNICORN)
target_link_libraries(dynarmic_tests PRIVATE Unicorn::Unicorn)
@@ -72,7 +72,7 @@ add_executable(dynarmic_print_info
print_info.cpp
)
create_target_directory_groups(dynarmic_print_info)
target_link_libraries(dynarmic_print_info PRIVATE dynarmic fmt::fmt)
target_link_libraries(dynarmic_print_info PRIVATE dynarmic fmt::fmt unordered_dense::unordered_dense)
if (BOOST_NO_HEADERS)
target_link_libraries(dynarmic_print_info PRIVATE Boost::variant Boost::icl Boost::pool)
else()
@@ -93,7 +93,7 @@ add_executable(dynarmic_test_generator
create_target_directory_groups(dynarmic_test_generator)
target_link_libraries(dynarmic_test_generator PRIVATE dynarmic fmt::fmt)
target_link_libraries(dynarmic_test_generator PRIVATE dynarmic fmt::fmt unordered_dense::unordered_dense)
if (BOOST_NO_HEADERS)
target_link_libraries(dynarmic_test_generator PRIVATE Boost::variant Boost::icl Boost::pool)
else()
@@ -110,7 +110,7 @@ add_executable(dynarmic_test_reader
test_reader.cpp
)
create_target_directory_groups(dynarmic_test_reader)
target_link_libraries(dynarmic_test_reader PRIVATE dynarmic fmt::fmt)
target_link_libraries(dynarmic_test_reader PRIVATE dynarmic fmt::fmt unordered_dense::unordered_dense)
if (BOOST_NO_HEADERS)
target_link_libraries(dynarmic_test_reader PRIVATE Boost::variant Boost::icl Boost::pool)
else()
@@ -123,7 +123,7 @@ target_compile_definitions(dynarmic_test_reader PRIVATE FMT_USE_USER_DEFINED_LIT
#
create_target_directory_groups(dynarmic_tests)
target_link_libraries(dynarmic_tests PRIVATE dynarmic Catch2::Catch2WithMain fmt::fmt)
target_link_libraries(dynarmic_tests PRIVATE dynarmic Catch2::Catch2WithMain fmt::fmt unordered_dense::unordered_dense)
if (BOOST_NO_HEADERS)
target_link_libraries(dynarmic_tests PRIVATE Boost::variant Boost::icl Boost::pool)
else()
+2 -2
View File
@@ -11,7 +11,7 @@
#include <memory>
#include <mutex>
#include <optional>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/common_funcs.h"
#include "common/common_types.h"
@@ -185,7 +185,7 @@ private:
mutable std::mutex mutex;
mutable std::mutex callback_mutex;
::Common::unordered_map<int, ConsoleUpdateCallback> callback_list;
ankerl::unordered_dense::map<int, ConsoleUpdateCallback> callback_list;
int last_callback_key = 0;
// Stores the current status of all console input
+2 -2
View File
@@ -14,7 +14,7 @@
#include <vector>
#include <atomic>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/common_types.h"
#include "common/input.h"
@@ -636,7 +636,7 @@ private:
ControllerMotionDevices virtual_motion_devices;
mutable std::mutex callback_mutex;
::Common::unordered_map<int, ControllerUpdateCallback> callback_list;
ankerl::unordered_dense::map<int, ControllerUpdateCallback> callback_list;
int last_callback_key = 0;
// Stores the current status of all controller input
+2 -2
View File
@@ -10,7 +10,7 @@
#include <functional>
#include <memory>
#include <mutex>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <vector>
#include "common/common_types.h"
@@ -205,7 +205,7 @@ private:
mutable std::mutex mutex;
mutable std::mutex callback_mutex;
::Common::unordered_map<int, InterfaceUpdateCallback> callback_list;
ankerl::unordered_dense::map<int, InterfaceUpdateCallback> callback_list;
int last_callback_key = 0;
// Stores the current status of all external device input
+1 -1
View File
@@ -90,7 +90,7 @@ public:
Common::Input::ButtonNames GetUIName(const Common::ParamPackage& params) const override;
private:
::Common::unordered_map<PadIdentifier, jobject> input_devices;
ankerl::unordered_dense::map<PadIdentifier, jobject> input_devices;
/// Returns the correct identifier corresponding to the player index
PadIdentifier GetIdentifier(const std::string& guid, size_t port) const;
+1 -1
View File
@@ -732,7 +732,7 @@ SDLDriver::~SDLDriver() {
std::vector<Common::ParamPackage> SDLDriver::GetInputDevices() const {
std::vector<Common::ParamPackage> devices;
::Common::unordered_map<int, std::shared_ptr<SDLJoystick>> joycon_pairs;
ankerl::unordered_dense::map<int, std::shared_ptr<SDLJoystick>> joycon_pairs;
for (const auto& [key, value] : joystick_map) {
for (const auto& joystick : value) {
if (!joystick->GetSDLJoystick()) {
+2 -2
View File
@@ -9,7 +9,7 @@
#include <atomic>
#include <mutex>
#include <thread>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <SDL3/SDL.h>
@@ -117,7 +117,7 @@ private:
Common::SPSCQueue<VibrationRequest> vibration_queue;
/// Map of GUID of a list of corresponding virtual Joysticks
::Common::unordered_map<Common::UUID, std::vector<std::shared_ptr<SDLJoystick>>> joystick_map;
ankerl::unordered_dense::map<Common::UUID, std::vector<std::shared_ptr<SDLJoystick>>> joystick_map;
std::mutex joystick_map_mutex;
bool start_thread = false;
+7 -7
View File
@@ -8,7 +8,7 @@
#include <functional>
#include <mutex>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/common_types.h"
#include "common/input.h"
@@ -270,10 +270,10 @@ protected:
private:
struct ControllerData {
::Common::unordered_map<int, bool> buttons;
::Common::unordered_map<int, u8> hat_buttons;
::Common::unordered_map<int, float> axes;
::Common::unordered_map<int, BasicMotion> motions;
ankerl::unordered_dense::map<int, bool> buttons;
ankerl::unordered_dense::map<int, u8> hat_buttons;
ankerl::unordered_dense::map<int, float> axes;
ankerl::unordered_dense::map<int, BasicMotion> motions;
Common::Input::BatteryLevel battery{};
Common::Input::BodyColorStatus color{};
Common::Input::CameraStatus camera{};
@@ -301,8 +301,8 @@ private:
bool configuring{false};
const std::string input_engine;
int last_callback_key = 0;
::Common::unordered_map<PadIdentifier, ControllerData> controller_list;
::Common::unordered_map<int, InputIdentifier> callback_list;
ankerl::unordered_dense::map<PadIdentifier, ControllerData> controller_list;
ankerl::unordered_dense::map<int, InputIdentifier> callback_list;
MappingCallback mapping_callback;
};
+4 -4
View File
@@ -8,7 +8,7 @@
#include <memory>
#include <string>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <vector>
namespace Common {
@@ -56,9 +56,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 = ::Common::unordered_map<Settings::NativeAnalog::Values, Common::ParamPackage>;
using ButtonMapping = ::Common::unordered_map<Settings::NativeButton::Values, Common::ParamPackage>;
using MotionMapping = ::Common::unordered_map<Settings::NativeMotion::Values, Common::ParamPackage>;
using AnalogMapping = ankerl::unordered_dense::map<Settings::NativeAnalog::Values, Common::ParamPackage>;
using ButtonMapping = ankerl::unordered_dense::map<Settings::NativeButton::Values, Common::ParamPackage>;
using MotionMapping = ankerl::unordered_dense::map<Settings::NativeMotion::Values, Common::ParamPackage>;
class InputSubsystem {
public:
+1
View File
@@ -217,6 +217,7 @@ add_library(shader_recompiler STATIC
frontend/maxwell/translate_program.h
host_translate_info.h
ir_opt/collect_shader_info_pass.cpp
ir_opt/compaction_fallback_pass.cpp
ir_opt/conditional_barrier_pass.cpp
ir_opt/constant_propagation_pass.cpp
ir_opt/dead_code_elimination_pass.cpp
@@ -217,6 +217,10 @@ Id EmitShuffleIndex(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id cla
Id EmitShuffleUp(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp,
Id segmentation_mask) {
if (!StageSupportsSubgroups(ctx)) {
SetInBoundsFlag(inst, ctx.false_value);
return value;
}
const Id thread_id{EmitLaneId(ctx)};
const Id max_thread_id{GetMaxThreadId(ctx, thread_id, clamp, segmentation_mask)};
Id src_thread_id{ctx.OpISub(ctx.U32[1], thread_id, index)};
@@ -232,6 +236,10 @@ Id EmitShuffleUp(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp,
Id EmitShuffleDown(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp,
Id segmentation_mask) {
if (!StageSupportsSubgroups(ctx)) {
SetInBoundsFlag(inst, ctx.false_value);
return value;
}
const Id thread_id{EmitLaneId(ctx)};
const Id max_thread_id{GetMaxThreadId(ctx, thread_id, clamp, segmentation_mask)};
Id src_thread_id{ctx.OpIAdd(ctx.U32[1], thread_id, index)};
@@ -247,6 +255,10 @@ Id EmitShuffleDown(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clam
Id EmitShuffleButterfly(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp,
Id segmentation_mask) {
if (!StageSupportsSubgroups(ctx)) {
SetInBoundsFlag(inst, ctx.false_value);
return value;
}
const Id thread_id{EmitLaneId(ctx)};
const Id max_thread_id{GetMaxThreadId(ctx, thread_id, clamp, segmentation_mask)};
Id src_thread_id{ctx.OpBitwiseXor(ctx.U32[1], thread_id, index)};
@@ -9,7 +9,7 @@
#include <array>
#include <sirit/sirit.h>
#include "common/container/unordered_set.h"
#include <ankerl/unordered_dense.h>
#include "shader_recompiler/backend/bindings.h"
#include "shader_recompiler/frontend/ir/program.h"
@@ -370,7 +370,7 @@ public:
Id load_const_func_u32x4{};
// Sirit::Id doesn't play nice with *::set<>
::Common::unordered_set<u32> non_uniform_ids;
ankerl::unordered_dense::set<u32> non_uniform_ids;
bool uses_nonuniform_sampled_image{};
bool uses_nonuniform_storage_image{};
+4 -4
View File
@@ -7,7 +7,7 @@
#pragma once
#include <array>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include "common/common_types.h"
#include "shader_recompiler/program_header.h"
@@ -126,9 +126,9 @@ protected:
u32 start_address{};
bool is_proprietary_driver{};
public:
::Common::unordered_map<CbufWordKey, u32, CbufWordKeyHash> cbuf_word_cache;
::Common::unordered_map<HandleKey, u32, HandleKeyHash> handle_cache;
::Common::unordered_map<const IR::Inst*, ConstBufferAddr> track_cache;
ankerl::unordered_dense::map<CbufWordKey, u32, CbufWordKeyHash> cbuf_word_cache;
ankerl::unordered_dense::map<HandleKey, u32, HandleKeyHash> handle_cache;
ankerl::unordered_dense::map<const IR::Inst*, ConstBufferAddr> track_cache;
};
} // namespace Shader
@@ -7,7 +7,7 @@
#include <algorithm>
#include <memory>
#include <string>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <utility>
#include <vector>
@@ -390,7 +390,7 @@ private:
std::optional<Node> return_label) {
Statement* const false_stmt{pool.Create(Identity{}, IR::Condition{false}, &root_stmt)};
Tree& root{root_stmt.children};
::Common::unordered_map<Flow::Block*, Node> local_labels;
ankerl::unordered_dense::map<Flow::Block*, Node> local_labels;
local_labels.reserve(function.blocks.size());
for (Flow::Block& block : function.blocks) {
@@ -299,6 +299,7 @@ IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Blo
Optimization::PositionPass(env, program);
Optimization::GlobalMemoryToStorageBufferPass(program, normalized_host_info);
Optimization::CompactionFallbackPass(program, normalized_host_info);
Optimization::TexturePass(env, program, normalized_host_info);
if (Settings::values.resolution_info.active || Settings::values.rescale_hack.GetValue()) {
@@ -38,6 +38,7 @@ struct HostTranslateInfo {
///< passthrough shaders
bool support_conditional_barrier{}; ///< True when the device supports barriers in conditional
///< control flow
bool support_subgroup_in_geometry_stage{};
void ApplyDescriptorLimitPolicy() noexcept {
if (min_ssbo_alignment == 0) {
@@ -0,0 +1,69 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include "shader_recompiler/frontend/ir/ir_emitter.h"
#include "shader_recompiler/host_translate_info.h"
#include "shader_recompiler/ir_opt/passes.h"
namespace Shader::Optimization {
namespace {
constexpr int MAX_BALLOT_SEARCH_DEPTH = 8;
bool DependsOnSubgroupBallot(const IR::Value& value, int depth) {
if (depth > MAX_BALLOT_SEARCH_DEPTH || value.IsImmediate()) {
return false;
}
IR::Inst* const producer{value.Inst()};
if (producer->GetOpcode() == IR::Opcode::SubgroupBallot) {
return true;
}
if (producer->GetOpcode() == IR::Opcode::Phi) {
return false;
}
const size_t num_args{producer->NumArgs()};
for (size_t index = 0; index < num_args; ++index) {
if (DependsOnSubgroupBallot(producer->Arg(index), depth + 1)) {
return true;
}
}
return false;
}
void RewriteAtomic(IR::Block& block, IR::Inst& inst) {
const auto insert_point{IR::Block::InstructionList::s_iterator_to(inst)};
IR::IREmitter ir{block, insert_point};
const IR::U32 amount{inst.Arg(2)};
const IR::U32 primitive_id{ir.GetAttributeU32(IR::Attribute::PrimitiveId)};
const IR::U32 new_index{ir.IMul(primitive_id, amount)};
const IR::U32 new_atomic_value{ir.IAdd(new_index, amount)};
const IR::Value umax_result{&*block.PrependNewInst(
insert_point, IR::Opcode::StorageAtomicUMax32,
{inst.Arg(0), inst.Arg(1), new_atomic_value})};
static_cast<void>(umax_result);
inst.ReplaceUsesWith(new_index);
}
} // Anonymous namespace
void CompactionFallbackPass(IR::Program& program, const HostTranslateInfo& host_info) {
if (program.stage != Stage::Geometry || host_info.support_subgroup_in_geometry_stage) {
return;
}
for (IR::Block* const block : program.post_order_blocks) {
for (IR::Inst& inst : block->Instructions()) {
if (inst.GetOpcode() != IR::Opcode::StorageAtomicIAdd32) {
continue;
}
if (!DependsOnSubgroupBallot(inst.Arg(2), 0)) {
continue;
}
RewriteAtomic(*block, inst);
}
}
}
} // namespace Shader::Optimization
+1
View File
@@ -13,6 +13,7 @@ struct HostTranslateInfo;
namespace Shader::Optimization {
void CollectShaderInfoPass(Environment& env, IR::Program& program);
void CompactionFallbackPass(IR::Program& program, const HostTranslateInfo& host_info);
void ConditionalBarrierPass(IR::Program& program);
void ConstantPropagationPass(Environment& env, IR::Program& program);
void DeadCodeEliminationPass(IR::Program& program);
@@ -19,7 +19,7 @@
#include <deque>
#include <map>
#include <span>
#include "common/container/unordered_map.h"
#include <ankerl/unordered_dense.h>
#include <variant>
#include <vector>

Some files were not shown because too many files have changed in this diff Show More