diff options
author | Levi <L3ehunin@gmail.com> | 2021-01-10 22:09:56 -0700 |
---|---|---|
committer | Levi <L3ehunin@gmail.com> | 2021-01-10 22:09:56 -0700 |
commit | 7a3c884e39fccfbb498b855080bffabc9ce2e7f1 (patch) | |
tree | 5056f9406dec188439cb0deb87603498243a9412 /src/yuzu/configuration/configure_graphics.cpp | |
parent | bc69cc151192326f9b8e18bbda831f1589ba27e0 (diff) | |
parent | 46cd71d1c773c29cce8b48e7e2b478bdf6d77085 (diff) |
Merge remote-tracking branch 'upstream/master' into int-flags
Diffstat (limited to 'src/yuzu/configuration/configure_graphics.cpp')
-rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 07d818548..b78a5dff0 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -4,22 +4,17 @@ #include <QColorDialog> #include <QComboBox> -#ifdef HAS_VULKAN #include <QVulkanInstance> -#endif #include "common/common_types.h" #include "common/logging/log.h" #include "core/core.h" #include "core/settings.h" #include "ui_configure_graphics.h" +#include "video_core/renderer_vulkan/renderer_vulkan.h" #include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configure_graphics.h" -#ifdef HAS_VULKAN -#include "video_core/renderer_vulkan/renderer_vulkan.h" -#endif - ConfigureGraphics::ConfigureGraphics(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureGraphics) { vulkan_device = Settings::values.vulkan_device.GetValue(); @@ -33,7 +28,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) connect(ui->api, qOverload<int>(&QComboBox::currentIndexChanged), this, [this] { UpdateDeviceComboBox(); - if (!Settings::configuring_global) { + if (!Settings::IsConfiguringGlobal()) { ConfigurationShared::SetHighlight( ui->api_layout, ui->api->currentIndex() != ConfigurationShared::USE_GLOBAL_INDEX); } @@ -49,8 +44,8 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) UpdateBackgroundColorButton(new_bg_color); }); - ui->bg_label->setVisible(Settings::configuring_global); - ui->bg_combobox->setVisible(!Settings::configuring_global); + ui->bg_label->setVisible(Settings::IsConfiguringGlobal()); + ui->bg_combobox->setVisible(!Settings::IsConfiguringGlobal()); } void ConfigureGraphics::UpdateDeviceSelection(int device) { @@ -70,11 +65,13 @@ void ConfigureGraphics::SetConfiguration() { ui->api->setEnabled(runtime_lock); ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock); ui->use_disk_shader_cache->setEnabled(runtime_lock); + ui->use_nvdec_emulation->setEnabled(runtime_lock); ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue()); ui->use_asynchronous_gpu_emulation->setChecked( Settings::values.use_asynchronous_gpu_emulation.GetValue()); + ui->use_nvdec_emulation->setChecked(Settings::values.use_nvdec_emulation.GetValue()); - if (Settings::configuring_global) { + if (Settings::IsConfiguringGlobal()) { ui->api->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend.GetValue())); ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); } else { @@ -98,7 +95,7 @@ void ConfigureGraphics::SetConfiguration() { } void ConfigureGraphics::ApplyConfiguration() { - if (Settings::configuring_global) { + if (Settings::IsConfiguringGlobal()) { // Guard if during game and set to game-specific value if (Settings::values.renderer_backend.UsingGlobal()) { Settings::values.renderer_backend.SetValue(GetCurrentGraphicsBackend()); @@ -116,6 +113,9 @@ void ConfigureGraphics::ApplyConfiguration() { Settings::values.use_asynchronous_gpu_emulation.SetValue( ui->use_asynchronous_gpu_emulation->isChecked()); } + if (Settings::values.use_nvdec_emulation.UsingGlobal()) { + Settings::values.use_nvdec_emulation.SetValue(ui->use_nvdec_emulation->isChecked()); + } if (Settings::values.bg_red.UsingGlobal()) { Settings::values.bg_red.SetValue(static_cast<float>(bg_color.redF())); Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF())); @@ -144,6 +144,8 @@ void ConfigureGraphics::ApplyConfiguration() { ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation, ui->use_asynchronous_gpu_emulation, use_asynchronous_gpu_emulation); + ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_nvdec_emulation, + ui->use_nvdec_emulation, use_nvdec_emulation); if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { Settings::values.bg_red.SetGlobal(true); @@ -187,7 +189,7 @@ void ConfigureGraphics::UpdateDeviceComboBox() { bool enabled = false; - if (!Settings::configuring_global && + if (!Settings::IsConfiguringGlobal() && ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { vulkan_device = Settings::values.vulkan_device.GetValue(); } @@ -205,22 +207,20 @@ void ConfigureGraphics::UpdateDeviceComboBox() { break; } // If in per-game config and use global is selected, don't enable. - enabled &= !(!Settings::configuring_global && + enabled &= !(!Settings::IsConfiguringGlobal() && ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX); ui->device->setEnabled(enabled && !Core::System::GetInstance().IsPoweredOn()); } void ConfigureGraphics::RetrieveVulkanDevices() { -#ifdef HAS_VULKAN vulkan_devices.clear(); - for (auto& name : Vulkan::RendererVulkan::EnumerateDevices()) { + for (const auto& name : Vulkan::RendererVulkan::EnumerateDevices()) { vulkan_devices.push_back(QString::fromStdString(name)); } -#endif } Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const { - if (Settings::configuring_global) { + if (Settings::IsConfiguringGlobal()) { return static_cast<Settings::RendererBackend>(ui->api->currentIndex()); } @@ -234,12 +234,13 @@ Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const { } void ConfigureGraphics::SetupPerGameUI() { - if (Settings::configuring_global) { + if (Settings::IsConfiguringGlobal()) { ui->api->setEnabled(Settings::values.renderer_backend.UsingGlobal()); ui->device->setEnabled(Settings::values.renderer_backend.UsingGlobal()); ui->aspect_ratio_combobox->setEnabled(Settings::values.aspect_ratio.UsingGlobal()); ui->use_asynchronous_gpu_emulation->setEnabled( Settings::values.use_asynchronous_gpu_emulation.UsingGlobal()); + ui->use_nvdec_emulation->setEnabled(Settings::values.use_nvdec_emulation.UsingGlobal()); ui->use_disk_shader_cache->setEnabled(Settings::values.use_disk_shader_cache.UsingGlobal()); ui->bg_button->setEnabled(Settings::values.bg_red.UsingGlobal()); @@ -253,6 +254,8 @@ void ConfigureGraphics::SetupPerGameUI() { ConfigurationShared::SetColoredTristate( ui->use_disk_shader_cache, Settings::values.use_disk_shader_cache, use_disk_shader_cache); + ConfigurationShared::SetColoredTristate( + ui->use_nvdec_emulation, Settings::values.use_nvdec_emulation, use_nvdec_emulation); ConfigurationShared::SetColoredTristate(ui->use_asynchronous_gpu_emulation, Settings::values.use_asynchronous_gpu_emulation, use_asynchronous_gpu_emulation); |