aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/configuration/configure_graphics.cpp
diff options
context:
space:
mode:
authorlat9nq <lat9nq@gmail.com>2022-05-28 02:33:23 -0400
committerlat9nq <lat9nq@gmail.com>2022-05-30 10:57:59 -0400
commitf22867efc5fc3b970a706f7997b997048c969a89 (patch)
tree942633953e2c3d2c379d388e9b1c05b446f0027d /src/yuzu/configuration/configure_graphics.cpp
parent67fa7434147618c060b7186a272e8c3e0ab0c560 (diff)
yuzu-qt: Attempt to workaround broken Vulkan installations
This does a few things in order to make the default setting Vulkan workable. - When yuzu boots, it just opens the Vulkan library. - If it works, all good and we continue with Vulkan as the default. - If something breaks, a new file in the config directory will be left behind (this is deleted normally). - If Vulkan is not working, has_broken_vulkan is set to true. - The first time this happens, a warning is displayed to notify the user. - This forces use of OpenGL, and Vulkan cannot be selected. - The Shader Backend selector is made accessible for use in custom configurations. - To disable has_broken_vulkan, the user needs to press a button in Graphics Configuration to manually run the Vulkan device enumeration.
Diffstat (limited to 'src/yuzu/configuration/configure_graphics.cpp')
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index 2f1435b100..482a6a8ab5 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -5,6 +5,7 @@
// Include this early to include Vulkan headers how we want to
#include "video_core/vulkan_common/vulkan_wrapper.h"
+#include <exception>
#include <QColorDialog>
#include <QVulkanInstance>
@@ -17,6 +18,7 @@
#include "video_core/vulkan_common/vulkan_library.h"
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_graphics.h"
+#include "yuzu/uisettings.h"
ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* parent)
: QWidget(parent), ui{std::make_unique<Ui::ConfigureGraphics>()}, system{system_} {
@@ -57,6 +59,23 @@ ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* paren
UpdateBackgroundColorButton(new_bg_color);
});
+ connect(ui->button_check_vulkan, &QAbstractButton::clicked, this, [this] {
+ UISettings::values.has_broken_vulkan = false;
+
+ if (RetrieveVulkanDevices()) {
+ ui->api->setEnabled(true);
+
+ for (const auto& device : vulkan_devices) {
+ ui->device->addItem(device);
+ }
+ } else {
+ UISettings::values.has_broken_vulkan = true;
+ }
+ });
+
+ ui->api->setEnabled(!UISettings::values.has_broken_vulkan.GetValue());
+ ui->button_check_vulkan->setVisible(UISettings::values.has_broken_vulkan.GetValue());
+
ui->bg_label->setVisible(Settings::IsConfiguringGlobal());
ui->bg_combobox->setVisible(!Settings::IsConfiguringGlobal());
}
@@ -296,7 +315,7 @@ void ConfigureGraphics::UpdateAPILayout() {
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);
+ ui->backend_widget->setEnabled(UISettings::values.has_broken_vulkan.GetValue());
} else {
vulkan_device = Settings::values.vulkan_device.GetValue();
shader_backend = Settings::values.shader_backend.GetValue();
@@ -318,7 +337,11 @@ void ConfigureGraphics::UpdateAPILayout() {
}
}
-void ConfigureGraphics::RetrieveVulkanDevices() try {
+bool ConfigureGraphics::RetrieveVulkanDevices() try {
+ if (UISettings::values.has_broken_vulkan) {
+ return false;
+ }
+
using namespace Vulkan;
vk::InstanceDispatch dld;
@@ -333,8 +356,13 @@ void ConfigureGraphics::RetrieveVulkanDevices() try {
vulkan_devices.push_back(QString::fromStdString(name));
}
+ UISettings::values.has_broken_vulkan = false;
+ ui->button_check_vulkan->setVisible(false);
+
+ return true;
} catch (const Vulkan::vk::Exception& exception) {
LOG_ERROR(Frontend, "Failed to enumerate devices with error: {}", exception.what());
+ return false;
}
Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const {
@@ -415,4 +443,11 @@ void ConfigureGraphics::SetupPerGameUI() {
ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true)));
ConfigurationShared::InsertGlobalItem(
ui->nvdec_emulation, static_cast<int>(Settings::values.nvdec_emulation.GetValue(true)));
+
+ if (UISettings::values.has_broken_vulkan) {
+ ui->backend_widget->setEnabled(true);
+ ConfigurationShared::SetColoredComboBox(
+ ui->backend, ui->backend_widget,
+ static_cast<int>(Settings::values.shader_backend.GetValue(true)));
+ }
}