1
0
Fork 0
forked from suyu/suyu

qt: add cpu_backend configuration

This commit is contained in:
amazingfate 2023-11-26 20:25:18 -05:00 committed by Liam
parent 15f35b8657
commit a76a8fb5fe
9 changed files with 59 additions and 6 deletions

View file

@ -260,6 +260,11 @@ if (UNIX)
add_definitions(-DYUZU_UNIX=1) add_definitions(-DYUZU_UNIX=1)
endif() 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 # Configure C++ standard
# =========================== # ===========================

View file

@ -199,7 +199,7 @@ if(ARCHITECTURE_x86_64)
target_link_libraries(common PRIVATE xbyak::xbyak) target_link_libraries(common PRIVATE xbyak::xbyak)
endif() endif()
if (ARCHITECTURE_arm64 AND (ANDROID OR LINUX)) if (HAS_NCE)
target_sources(common target_sources(common
PRIVATE PRIVATE
arm64/native_clock.cpp arm64/native_clock.cpp

View file

@ -182,7 +182,7 @@ struct Values {
// Cpu // Cpu
SwitchableSetting<CpuBackend, true> cpu_backend{ SwitchableSetting<CpuBackend, true> cpu_backend{
linkage, CpuBackend::Dynarmic, CpuBackend::Dynarmic, linkage, CpuBackend::Dynarmic, CpuBackend::Dynarmic,
#ifdef ARCHITECTURE_arm64 #ifdef HAS_NCE
CpuBackend::Nce, CpuBackend::Nce,
#else #else
CpuBackend::Dynarmic, CpuBackend::Dynarmic,

View file

@ -10,7 +10,7 @@
#include "common/x64/rdtsc.h" #include "common/x64/rdtsc.h"
#endif #endif
#if defined(ARCHITECTURE_arm64) && defined(__linux__) #ifdef HAS_NCE
#include "common/arm64/native_clock.h" #include "common/arm64/native_clock.h"
#endif #endif
@ -68,7 +68,7 @@ std::unique_ptr<WallClock> CreateOptimalClock() {
// - Is not more precise than 1 GHz (1ns resolution) // - Is not more precise than 1 GHz (1ns resolution)
return std::make_unique<StandardWallClock>(); return std::make_unique<StandardWallClock>();
} }
#elif defined(ARCHITECTURE_arm64) && defined(__linux__) #elif defined(HAS_NCE)
return std::make_unique<Arm64::NativeClock>(); return std::make_unique<Arm64::NativeClock>();
#else #else
return std::make_unique<StandardWallClock>(); return std::make_unique<StandardWallClock>();

View file

@ -926,8 +926,7 @@ if (ENABLE_WEB_SERVICE)
target_link_libraries(core PRIVATE web_service) target_link_libraries(core PRIVATE web_service)
endif() endif()
if (ARCHITECTURE_arm64 AND (ANDROID OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")) if (HAS_NCE)
target_compile_definitions(core PRIVATE -DHAS_NCE)
enable_language(C ASM) enable_language(C ASM)
set(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp") set(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp")

View file

@ -27,6 +27,13 @@ ConfigureCpu::ConfigureCpu(const Core::System& system_,
connect(accuracy_combobox, qOverload<int>(&QComboBox::currentIndexChanged), this, connect(accuracy_combobox, qOverload<int>(&QComboBox::currentIndexChanged), this,
&ConfigureCpu::UpdateGroup); &ConfigureCpu::UpdateGroup);
connect(backend_combobox, qOverload<int>(&QComboBox::currentIndexChanged), this,
&ConfigureCpu::UpdateGroup);
#ifdef HAS_NCE
ui->backend_group->setVisible(true);
#endif
} }
ConfigureCpu::~ConfigureCpu() = default; ConfigureCpu::~ConfigureCpu() = default;
@ -34,6 +41,7 @@ ConfigureCpu::~ConfigureCpu() = default;
void ConfigureCpu::SetConfiguration() {} void ConfigureCpu::SetConfiguration() {}
void ConfigureCpu::Setup(const ConfigurationShared::Builder& builder) { void ConfigureCpu::Setup(const ConfigurationShared::Builder& builder) {
auto* accuracy_layout = ui->widget_accuracy->layout(); auto* accuracy_layout = ui->widget_accuracy->layout();
auto* backend_layout = ui->widget_backend->layout();
auto* unsafe_layout = ui->unsafe_widget->layout(); auto* unsafe_layout = ui->unsafe_widget->layout();
std::map<u32, QWidget*> unsafe_hold{}; 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 // Keep track of cpu_accuracy combobox to display/hide the unsafe settings
accuracy_layout->addWidget(widget); accuracy_layout->addWidget(widget);
accuracy_combobox = widget->combobox; accuracy_combobox = widget->combobox;
} else if (setting->Id() == Settings::values.cpu_backend.Id()) {
backend_layout->addWidget(widget);
backend_combobox = widget->combobox;
} else { } else {
// Presently, all other settings here are unsafe checkboxes // Presently, all other settings here are unsafe checkboxes
unsafe_hold.insert({setting->Id(), widget}); unsafe_hold.insert({setting->Id(), widget});
@ -73,6 +84,7 @@ void ConfigureCpu::Setup(const ConfigurationShared::Builder& builder) {
} }
UpdateGroup(accuracy_combobox->currentIndex()); UpdateGroup(accuracy_combobox->currentIndex());
UpdateGroup(backend_combobox->currentIndex());
} }
void ConfigureCpu::UpdateGroup(int index) { void ConfigureCpu::UpdateGroup(int index) {

View file

@ -49,4 +49,5 @@ private:
std::vector<std::function<void(bool)>> apply_funcs{}; std::vector<std::function<void(bool)>> apply_funcs{};
QComboBox* accuracy_combobox; QComboBox* accuracy_combobox;
QComboBox* backend_combobox;
}; };

View file

@ -59,6 +59,36 @@
</layout> </layout>
</widget> </widget>
</item> </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> <item>
<widget class="QGroupBox" name="unsafe_group"> <widget class="QGroupBox" name="unsafe_group">
<property name="title"> <property name="title">

View file

@ -44,6 +44,7 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) {
// Cpu // Cpu
INSERT(Settings, cpu_accuracy, tr("Accuracy:"), QStringLiteral()); INSERT(Settings, cpu_accuracy, tr("Accuracy:"), QStringLiteral());
INSERT(Settings, cpu_backend, tr("Backend:"), QStringLiteral());
// Cpu Debug // Cpu Debug
@ -240,6 +241,11 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) {
PAIR(CpuAccuracy, Unsafe, tr("Unsafe")), PAIR(CpuAccuracy, Unsafe, tr("Unsafe")),
PAIR(CpuAccuracy, Paranoid, tr("Paranoid (disables most optimizations)")), 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(), translations->insert({Settings::EnumMetadata<Settings::FullscreenMode>::Index(),
{ {
PAIR(FullscreenMode, Borderless, tr("Borderless Windowed")), PAIR(FullscreenMode, Borderless, tr("Borderless Windowed")),