diff options
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/common/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/common/settings.h | 2 | ||||
-rw-r--r-- | src/common/wall_clock.cpp | 4 | ||||
-rw-r--r-- | src/core/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_cpu.cpp | 12 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_cpu.h | 1 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_cpu.ui | 30 | ||||
-rw-r--r-- | src/yuzu/configuration/shared_translation.cpp | 6 |
9 files changed, 59 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e5cac8fe9..325f39e1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,6 +260,11 @@ if (UNIX) add_definitions(-DYUZU_UNIX=1) endif() +if (ARCHITECTURE_arm64 AND (ANDROID OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")) + set(HAS_NCE 1) + add_definitions(-DHAS_NCE=1) +endif() + # Configure C++ standard # =========================== diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 98fd5f1e4..d38d5c6d1 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -199,7 +199,7 @@ if(ARCHITECTURE_x86_64) target_link_libraries(common PRIVATE xbyak::xbyak) endif() -if (ARCHITECTURE_arm64 AND (ANDROID OR LINUX)) +if (HAS_NCE) target_sources(common PRIVATE arm64/native_clock.cpp diff --git a/src/common/settings.h b/src/common/settings.h index fea639ee3..508615011 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -182,7 +182,7 @@ struct Values { // Cpu SwitchableSetting<CpuBackend, true> cpu_backend{ linkage, CpuBackend::Dynarmic, CpuBackend::Dynarmic, -#ifdef ARCHITECTURE_arm64 +#ifdef HAS_NCE CpuBackend::Nce, #else CpuBackend::Dynarmic, diff --git a/src/common/wall_clock.cpp b/src/common/wall_clock.cpp index caca9a123..012fdc1e0 100644 --- a/src/common/wall_clock.cpp +++ b/src/common/wall_clock.cpp @@ -10,7 +10,7 @@ #include "common/x64/rdtsc.h" #endif -#if defined(ARCHITECTURE_arm64) && defined(__linux__) +#ifdef HAS_NCE #include "common/arm64/native_clock.h" #endif @@ -68,7 +68,7 @@ std::unique_ptr<WallClock> CreateOptimalClock() { // - Is not more precise than 1 GHz (1ns resolution) return std::make_unique<StandardWallClock>(); } -#elif defined(ARCHITECTURE_arm64) && defined(__linux__) +#elif defined(HAS_NCE) return std::make_unique<Arm64::NativeClock>(); #else return std::make_unique<StandardWallClock>(); diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index e0bfb5b95..c3ab5ecf9 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -926,8 +926,7 @@ if (ENABLE_WEB_SERVICE) target_link_libraries(core PRIVATE web_service) endif() -if (ARCHITECTURE_arm64 AND (ANDROID OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")) - target_compile_definitions(core PRIVATE -DHAS_NCE) +if (HAS_NCE) enable_language(C ASM) set(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp") diff --git a/src/yuzu/configuration/configure_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp index a51359903..7e16cf17d 100644 --- a/src/yuzu/configuration/configure_cpu.cpp +++ b/src/yuzu/configuration/configure_cpu.cpp @@ -27,6 +27,13 @@ ConfigureCpu::ConfigureCpu(const Core::System& system_, connect(accuracy_combobox, qOverload<int>(&QComboBox::currentIndexChanged), this, &ConfigureCpu::UpdateGroup); + + connect(backend_combobox, qOverload<int>(&QComboBox::currentIndexChanged), this, + &ConfigureCpu::UpdateGroup); + +#ifdef HAS_NCE + ui->backend_group->setVisible(true); +#endif } ConfigureCpu::~ConfigureCpu() = default; @@ -34,6 +41,7 @@ ConfigureCpu::~ConfigureCpu() = default; void ConfigureCpu::SetConfiguration() {} void ConfigureCpu::Setup(const ConfigurationShared::Builder& builder) { auto* accuracy_layout = ui->widget_accuracy->layout(); + auto* backend_layout = ui->widget_backend->layout(); auto* unsafe_layout = ui->unsafe_widget->layout(); std::map<u32, QWidget*> unsafe_hold{}; @@ -62,6 +70,9 @@ void ConfigureCpu::Setup(const ConfigurationShared::Builder& builder) { // Keep track of cpu_accuracy combobox to display/hide the unsafe settings accuracy_layout->addWidget(widget); accuracy_combobox = widget->combobox; + } else if (setting->Id() == Settings::values.cpu_backend.Id()) { + backend_layout->addWidget(widget); + backend_combobox = widget->combobox; } else { // Presently, all other settings here are unsafe checkboxes unsafe_hold.insert({setting->Id(), widget}); @@ -73,6 +84,7 @@ void ConfigureCpu::Setup(const ConfigurationShared::Builder& builder) { } UpdateGroup(accuracy_combobox->currentIndex()); + UpdateGroup(backend_combobox->currentIndex()); } void ConfigureCpu::UpdateGroup(int index) { diff --git a/src/yuzu/configuration/configure_cpu.h b/src/yuzu/configuration/configure_cpu.h index 61a6de7aa..a102b4c1f 100644 --- a/src/yuzu/configuration/configure_cpu.h +++ b/src/yuzu/configuration/configure_cpu.h @@ -49,4 +49,5 @@ private: std::vector<std::function<void(bool)>> apply_funcs{}; QComboBox* accuracy_combobox; + QComboBox* backend_combobox; }; diff --git a/src/yuzu/configuration/configure_cpu.ui b/src/yuzu/configuration/configure_cpu.ui index f734e842e..13fd43605 100644 --- a/src/yuzu/configuration/configure_cpu.ui +++ b/src/yuzu/configuration/configure_cpu.ui @@ -60,6 +60,36 @@ </widget> </item> <item> + <widget class="QGroupBox" name="backend_group"> + <property name="title"> + <string>CPU Backend</string> + </property> + <layout class="QVBoxLayout"> + <item> + <widget class="QWidget" name="widget_backend" native="true"> + <layout class="QVBoxLayout" name="verticalLayout1"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + </layout> + </widget> + </item> + </layout> + <property name="visible"> + <bool>false</bool> + </property> + </widget> + </item> + <item> <widget class="QGroupBox" name="unsafe_group"> <property name="title"> <string>Unsafe CPU Optimization Settings</string> diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp index a7b5def32..daf0e1663 100644 --- a/src/yuzu/configuration/shared_translation.cpp +++ b/src/yuzu/configuration/shared_translation.cpp @@ -44,6 +44,7 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) { // Cpu INSERT(Settings, cpu_accuracy, tr("Accuracy:"), QStringLiteral()); + INSERT(Settings, cpu_backend, tr("Backend:"), QStringLiteral()); // Cpu Debug @@ -240,6 +241,11 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) { PAIR(CpuAccuracy, Unsafe, tr("Unsafe")), PAIR(CpuAccuracy, Paranoid, tr("Paranoid (disables most optimizations)")), }}); + translations->insert({Settings::EnumMetadata<Settings::CpuBackend>::Index(), + { + PAIR(CpuBackend, Dynarmic, tr("Dynarmic")), + PAIR(CpuBackend, Nce, tr("NCE")), + }}); translations->insert({Settings::EnumMetadata<Settings::FullscreenMode>::Index(), { PAIR(FullscreenMode, Borderless, tr("Borderless Windowed")), |