|
@@ -26,19 +26,25 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
|
|
|
|
|
|
|
ui->setupUi(this);
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
|
|
+ ui->backend->addItem(QStringLiteral("GLSL"));
|
|
|
|
|
+ ui->backend->addItem(tr("GLASM (NVIDIA Only)"));
|
|
|
|
|
+ ui->backend->addItem(QStringLiteral("SPIR-V"));
|
|
|
|
|
+
|
|
|
SetupPerGameUI();
|
|
SetupPerGameUI();
|
|
|
|
|
|
|
|
SetConfiguration();
|
|
SetConfiguration();
|
|
|
|
|
|
|
|
connect(ui->api, qOverload<int>(&QComboBox::currentIndexChanged), this, [this] {
|
|
connect(ui->api, qOverload<int>(&QComboBox::currentIndexChanged), this, [this] {
|
|
|
- UpdateDeviceComboBox();
|
|
|
|
|
|
|
+ UpdateAPILayout();
|
|
|
if (!Settings::IsConfiguringGlobal()) {
|
|
if (!Settings::IsConfiguringGlobal()) {
|
|
|
ConfigurationShared::SetHighlight(
|
|
ConfigurationShared::SetHighlight(
|
|
|
- ui->api_layout, ui->api->currentIndex() != ConfigurationShared::USE_GLOBAL_INDEX);
|
|
|
|
|
|
|
+ ui->api_widget, ui->api->currentIndex() != ConfigurationShared::USE_GLOBAL_INDEX);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
connect(ui->device, qOverload<int>(&QComboBox::activated), this,
|
|
connect(ui->device, qOverload<int>(&QComboBox::activated), this,
|
|
|
[this](int device) { UpdateDeviceSelection(device); });
|
|
[this](int device) { UpdateDeviceSelection(device); });
|
|
|
|
|
+ connect(ui->backend, qOverload<int>(&QComboBox::activated), this,
|
|
|
|
|
+ [this](int backend) { UpdateShaderBackendSelection(backend); });
|
|
|
|
|
|
|
|
connect(ui->bg_button, &QPushButton::clicked, this, [this] {
|
|
connect(ui->bg_button, &QPushButton::clicked, this, [this] {
|
|
|
const QColor new_bg_color = QColorDialog::getColor(bg_color);
|
|
const QColor new_bg_color = QColorDialog::getColor(bg_color);
|
|
@@ -48,6 +54,10 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
|
|
UpdateBackgroundColorButton(new_bg_color);
|
|
UpdateBackgroundColorButton(new_bg_color);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ for (const auto& device : vulkan_devices) {
|
|
|
|
|
+ ui->device->addItem(device);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
ui->bg_label->setVisible(Settings::IsConfiguringGlobal());
|
|
ui->bg_label->setVisible(Settings::IsConfiguringGlobal());
|
|
|
ui->bg_combobox->setVisible(!Settings::IsConfiguringGlobal());
|
|
ui->bg_combobox->setVisible(!Settings::IsConfiguringGlobal());
|
|
|
}
|
|
}
|
|
@@ -61,12 +71,21 @@ void ConfigureGraphics::UpdateDeviceSelection(int device) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+void ConfigureGraphics::UpdateShaderBackendSelection(int backend) {
|
|
|
|
|
+ if (backend == -1) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (GetCurrentGraphicsBackend() == Settings::RendererBackend::OpenGL) {
|
|
|
|
|
+ shader_backend = static_cast<Settings::ShaderBackend>(backend);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
ConfigureGraphics::~ConfigureGraphics() = default;
|
|
ConfigureGraphics::~ConfigureGraphics() = default;
|
|
|
|
|
|
|
|
void ConfigureGraphics::SetConfiguration() {
|
|
void ConfigureGraphics::SetConfiguration() {
|
|
|
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
|
|
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
|
|
|
|
|
|
|
|
- ui->api->setEnabled(runtime_lock);
|
|
|
|
|
|
|
+ ui->api_widget->setEnabled(runtime_lock);
|
|
|
ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock);
|
|
ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock);
|
|
|
ui->use_disk_shader_cache->setEnabled(runtime_lock);
|
|
ui->use_disk_shader_cache->setEnabled(runtime_lock);
|
|
|
ui->use_nvdec_emulation->setEnabled(runtime_lock);
|
|
ui->use_nvdec_emulation->setEnabled(runtime_lock);
|
|
@@ -83,7 +102,7 @@ void ConfigureGraphics::SetConfiguration() {
|
|
|
ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue());
|
|
ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue());
|
|
|
} else {
|
|
} else {
|
|
|
ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend);
|
|
ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend);
|
|
|
- ConfigurationShared::SetHighlight(ui->api_layout,
|
|
|
|
|
|
|
+ ConfigurationShared::SetHighlight(ui->api_widget,
|
|
|
!Settings::values.renderer_backend.UsingGlobal());
|
|
!Settings::values.renderer_backend.UsingGlobal());
|
|
|
|
|
|
|
|
ConfigurationShared::SetPerGameSetting(ui->fullscreen_mode_combobox,
|
|
ConfigurationShared::SetPerGameSetting(ui->fullscreen_mode_combobox,
|
|
@@ -100,11 +119,10 @@ void ConfigureGraphics::SetConfiguration() {
|
|
|
ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal());
|
|
ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal());
|
|
|
ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal());
|
|
ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal());
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
UpdateBackgroundColorButton(QColor::fromRgb(Settings::values.bg_red.GetValue(),
|
|
UpdateBackgroundColorButton(QColor::fromRgb(Settings::values.bg_red.GetValue(),
|
|
|
Settings::values.bg_green.GetValue(),
|
|
Settings::values.bg_green.GetValue(),
|
|
|
Settings::values.bg_blue.GetValue()));
|
|
Settings::values.bg_blue.GetValue()));
|
|
|
- UpdateDeviceComboBox();
|
|
|
|
|
|
|
+ UpdateAPILayout();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void ConfigureGraphics::ApplyConfiguration() {
|
|
void ConfigureGraphics::ApplyConfiguration() {
|
|
@@ -128,6 +146,9 @@ void ConfigureGraphics::ApplyConfiguration() {
|
|
|
if (Settings::values.renderer_backend.UsingGlobal()) {
|
|
if (Settings::values.renderer_backend.UsingGlobal()) {
|
|
|
Settings::values.renderer_backend.SetValue(GetCurrentGraphicsBackend());
|
|
Settings::values.renderer_backend.SetValue(GetCurrentGraphicsBackend());
|
|
|
}
|
|
}
|
|
|
|
|
+ if (Settings::values.shader_backend.UsingGlobal()) {
|
|
|
|
|
+ Settings::values.shader_backend.SetValue(shader_backend);
|
|
|
|
|
+ }
|
|
|
if (Settings::values.vulkan_device.UsingGlobal()) {
|
|
if (Settings::values.vulkan_device.UsingGlobal()) {
|
|
|
Settings::values.vulkan_device.SetValue(vulkan_device);
|
|
Settings::values.vulkan_device.SetValue(vulkan_device);
|
|
|
}
|
|
}
|
|
@@ -139,15 +160,22 @@ void ConfigureGraphics::ApplyConfiguration() {
|
|
|
} else {
|
|
} else {
|
|
|
if (ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
|
|
if (ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
|
|
|
Settings::values.renderer_backend.SetGlobal(true);
|
|
Settings::values.renderer_backend.SetGlobal(true);
|
|
|
|
|
+ Settings::values.shader_backend.SetGlobal(true);
|
|
|
Settings::values.vulkan_device.SetGlobal(true);
|
|
Settings::values.vulkan_device.SetGlobal(true);
|
|
|
} else {
|
|
} else {
|
|
|
Settings::values.renderer_backend.SetGlobal(false);
|
|
Settings::values.renderer_backend.SetGlobal(false);
|
|
|
Settings::values.renderer_backend.SetValue(GetCurrentGraphicsBackend());
|
|
Settings::values.renderer_backend.SetValue(GetCurrentGraphicsBackend());
|
|
|
- if (GetCurrentGraphicsBackend() == Settings::RendererBackend::Vulkan) {
|
|
|
|
|
|
|
+ switch (GetCurrentGraphicsBackend()) {
|
|
|
|
|
+ case Settings::RendererBackend::OpenGL:
|
|
|
|
|
+ Settings::values.shader_backend.SetGlobal(false);
|
|
|
|
|
+ Settings::values.vulkan_device.SetGlobal(true);
|
|
|
|
|
+ Settings::values.shader_backend.SetValue(shader_backend);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case Settings::RendererBackend::Vulkan:
|
|
|
|
|
+ Settings::values.shader_backend.SetGlobal(true);
|
|
|
Settings::values.vulkan_device.SetGlobal(false);
|
|
Settings::values.vulkan_device.SetGlobal(false);
|
|
|
Settings::values.vulkan_device.SetValue(vulkan_device);
|
|
Settings::values.vulkan_device.SetValue(vulkan_device);
|
|
|
- } else {
|
|
|
|
|
- Settings::values.vulkan_device.SetGlobal(true);
|
|
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -188,32 +216,32 @@ void ConfigureGraphics::UpdateBackgroundColorButton(QColor color) {
|
|
|
ui->bg_button->setIcon(color_icon);
|
|
ui->bg_button->setIcon(color_icon);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void ConfigureGraphics::UpdateDeviceComboBox() {
|
|
|
|
|
- ui->device->clear();
|
|
|
|
|
-
|
|
|
|
|
- bool enabled = false;
|
|
|
|
|
-
|
|
|
|
|
|
|
+void ConfigureGraphics::UpdateAPILayout() {
|
|
|
if (!Settings::IsConfiguringGlobal() &&
|
|
if (!Settings::IsConfiguringGlobal() &&
|
|
|
ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
|
|
ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
|
|
|
|
|
+ vulkan_device = Settings::values.vulkan_device.GetValue(true);
|
|
|
|
|
+ shader_backend = Settings::values.shader_backend.GetValue(true);
|
|
|
|
|
+ ui->device_widget->setEnabled(false);
|
|
|
|
|
+ ui->backend_widget->setEnabled(false);
|
|
|
|
|
+ } else {
|
|
|
vulkan_device = Settings::values.vulkan_device.GetValue();
|
|
vulkan_device = Settings::values.vulkan_device.GetValue();
|
|
|
|
|
+ shader_backend = Settings::values.shader_backend.GetValue();
|
|
|
|
|
+ ui->device_widget->setEnabled(true);
|
|
|
|
|
+ ui->backend_widget->setEnabled(true);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
switch (GetCurrentGraphicsBackend()) {
|
|
switch (GetCurrentGraphicsBackend()) {
|
|
|
case Settings::RendererBackend::OpenGL:
|
|
case Settings::RendererBackend::OpenGL:
|
|
|
- ui->device->addItem(tr("OpenGL Graphics Device"));
|
|
|
|
|
- enabled = false;
|
|
|
|
|
|
|
+ ui->backend->setCurrentIndex(static_cast<u32>(shader_backend));
|
|
|
|
|
+ ui->device_widget->setVisible(false);
|
|
|
|
|
+ ui->backend_widget->setVisible(true);
|
|
|
break;
|
|
break;
|
|
|
case Settings::RendererBackend::Vulkan:
|
|
case Settings::RendererBackend::Vulkan:
|
|
|
- for (const auto& device : vulkan_devices) {
|
|
|
|
|
- ui->device->addItem(device);
|
|
|
|
|
- }
|
|
|
|
|
ui->device->setCurrentIndex(vulkan_device);
|
|
ui->device->setCurrentIndex(vulkan_device);
|
|
|
- enabled = !vulkan_devices.empty();
|
|
|
|
|
|
|
+ ui->device_widget->setVisible(true);
|
|
|
|
|
+ ui->backend_widget->setVisible(false);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- // If in per-game config and use global is selected, don't enable.
|
|
|
|
|
- enabled &= !(!Settings::IsConfiguringGlobal() &&
|
|
|
|
|
- ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX);
|
|
|
|
|
- ui->device->setEnabled(enabled && !Core::System::GetInstance().IsPoweredOn());
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void ConfigureGraphics::RetrieveVulkanDevices() try {
|
|
void ConfigureGraphics::RetrieveVulkanDevices() try {
|