summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlat9nq <22451773+lat9nq@users.noreply.github.com>2023-06-15 23:45:33 +0200
committerlat9nq <22451773+lat9nq@users.noreply.github.com>2023-07-21 16:56:54 +0200
commit916c6cd1a0baab21cf2c029179290d73fd8dab89 (patch)
treecc73f1b79519a5ac1c13ddd9747f17c369ec0b6d
parentconfigure_graphcs: Fix setting shader/device in custom config (diff)
downloadyuzu-916c6cd1a0baab21cf2c029179290d73fd8dab89.tar
yuzu-916c6cd1a0baab21cf2c029179290d73fd8dab89.tar.gz
yuzu-916c6cd1a0baab21cf2c029179290d73fd8dab89.tar.bz2
yuzu-916c6cd1a0baab21cf2c029179290d73fd8dab89.tar.lz
yuzu-916c6cd1a0baab21cf2c029179290d73fd8dab89.tar.xz
yuzu-916c6cd1a0baab21cf2c029179290d73fd8dab89.tar.zst
yuzu-916c6cd1a0baab21cf2c029179290d73fd8dab89.zip
Diffstat (limited to '')
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp43
1 files changed, 16 insertions, 27 deletions
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index 673921649..62d74d12b 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -33,6 +33,7 @@
#include "common/dynamic_library.h"
#include "common/logging/log.h"
#include "common/settings.h"
+#include "common/settings_enums.h"
#include "core/core.h"
#include "ui_configure_graphics.h"
#include "yuzu/configuration/configuration_shared.h"
@@ -442,36 +443,24 @@ void ConfigureGraphics::UpdateBackgroundColorButton(QColor color) {
void ConfigureGraphics::UpdateAPILayout() {
bool runtime_lock = !system.IsPoweredOn();
- if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) {
- vulkan_device = Settings::values.vulkan_device.GetValue(true);
- shader_backend = Settings::values.shader_backend.GetValue(true);
- vulkan_device_widget->setEnabled(false);
- shader_backend_widget->setEnabled(false);
- } else {
- vulkan_device = Settings::values.vulkan_device.GetValue();
- shader_backend = Settings::values.shader_backend.GetValue();
- vulkan_device_widget->setEnabled(runtime_lock);
- shader_backend_widget->setEnabled(runtime_lock);
- }
+ bool need_global = !(Settings::IsConfiguringGlobal() || api_restore_global_button->isEnabled());
+ vulkan_device = Settings::values.vulkan_device.GetValue(need_global);
+ shader_backend = Settings::values.shader_backend.GetValue(need_global);
+ vulkan_device_widget->setEnabled(!need_global && runtime_lock);
+ shader_backend_widget->setEnabled(!need_global && runtime_lock);
+
+ const auto current_backend = GetCurrentGraphicsBackend();
+ const bool is_opengl = current_backend == Settings::RendererBackend::OpenGL;
+ const bool is_vulkan = current_backend == Settings::RendererBackend::Vulkan;
+
+ vulkan_device_widget->setVisible(is_vulkan);
+ shader_backend_widget->setVisible(is_opengl);
- switch (GetCurrentGraphicsBackend()) {
- case Settings::RendererBackend::OpenGL:
+ if (is_opengl) {
shader_backend_combobox->setCurrentIndex(
FindIndex(typeid(Settings::ShaderBackend), static_cast<int>(shader_backend)));
- vulkan_device_widget->setVisible(false);
- shader_backend_widget->setVisible(true);
- break;
- case Settings::RendererBackend::Vulkan:
- if (static_cast<int>(vulkan_device) < vulkan_device_combobox->count()) {
- vulkan_device_combobox->setCurrentIndex(vulkan_device);
- }
- vulkan_device_widget->setVisible(true);
- shader_backend_widget->setVisible(false);
- break;
- case Settings::RendererBackend::Null:
- vulkan_device_widget->setVisible(false);
- shader_backend_widget->setVisible(false);
- break;
+ } else if (is_vulkan && static_cast<int>(vulkan_device) < vulkan_device_combobox->count()) {
+ vulkan_device_combobox->setCurrentIndex(vulkan_device);
}
}