From f22867efc5fc3b970a706f7997b997048c969a89 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Sat, 28 May 2022 02:33:23 -0400 Subject: 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. --- src/yuzu/main.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f4a9a7171..71802cfc2 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -115,6 +115,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #include "video_core/shader_notify.h" #include "yuzu/about_dialog.h" #include "yuzu/bootmanager.h" +#include "yuzu/check_vulkan.h" #include "yuzu/compatdb.h" #include "yuzu/compatibility_list.h" #include "yuzu/configuration/config.h" @@ -297,6 +298,20 @@ GMainWindow::GMainWindow() MigrateConfigFiles(); + if (!CheckVulkan()) { + QMessageBox::warning( + this, tr("Broken Vulkan Installation Detected"), + tr("Vulkan initialization failed on the previous boot. Please update your graphics " + "driver, then re-check your Vulkan installation by accessing the Graphics " + "configuration and clicking \"Check for Working Vulkan\".")); + } + if (UISettings::values.has_broken_vulkan) { + Settings::values.renderer_backend = Settings::RendererBackend::OpenGL; + + renderer_status_button->setDisabled(true); + renderer_status_button->setChecked(false); + } + #if defined(HAVE_SDL2) && !defined(_WIN32) SDL_InitSubSystem(SDL_INIT_VIDEO); // SDL disables the screen saver by default, and setting the hint @@ -1563,7 +1578,7 @@ void GMainWindow::ShutdownGame() { emu_speed_label->setVisible(false); game_fps_label->setVisible(false); emu_frametime_label->setVisible(false); - renderer_status_button->setEnabled(true); + renderer_status_button->setEnabled(!UISettings::values.has_broken_vulkan); game_path.clear(); -- cgit v1.2.3 From 500b01076e1a96b9c133ff663daad6f9dd8e4039 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Sun, 29 May 2022 22:26:27 -0400 Subject: yuzu-qt: Make has_broken_vulkan only for crashes Being able to catch and handle a Vulkan exception is not what this is for. --- src/yuzu/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 71802cfc2..ff1afa56e 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -299,11 +299,7 @@ GMainWindow::GMainWindow() MigrateConfigFiles(); if (!CheckVulkan()) { - QMessageBox::warning( - this, tr("Broken Vulkan Installation Detected"), - tr("Vulkan initialization failed on the previous boot. Please update your graphics " - "driver, then re-check your Vulkan installation by accessing the Graphics " - "configuration and clicking \"Check for Working Vulkan\".")); + QMessageBox::warning(this, tr("Broken Vulkan Installation Detected"), tr("")); } if (UISettings::values.has_broken_vulkan) { Settings::values.renderer_backend = Settings::RendererBackend::OpenGL; @@ -2788,6 +2784,10 @@ void GMainWindow::OnConfigure() { mouse_hide_timer.start(); } + if (!UISettings::values.has_broken_vulkan) { + renderer_status_button->setEnabled(!emulation_running); + } + UpdateStatusButtons(); controller_dialog->refreshConfiguration(); } -- cgit v1.2.3 From 2dafb27055f41554674e64449dfd597d2d214db7 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Sun, 29 May 2022 23:38:51 -0400 Subject: main: Save config on broken Vulkan detect Prevents possible issues if someone were to open yuzu repeatedly over and over again. --- src/yuzu/main.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index ff1afa56e..1fd9af942 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -299,6 +299,8 @@ GMainWindow::GMainWindow() MigrateConfigFiles(); if (!CheckVulkan()) { + config->Save(); + QMessageBox::warning(this, tr("Broken Vulkan Installation Detected"), tr("")); } if (UISettings::values.has_broken_vulkan) { -- cgit v1.2.3 From 422525e3fbb0b14f93a9ef5883bd3d3d5dae6ab3 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 30 May 2022 01:02:56 -0400 Subject: main: Insert warning text on broken Vulkan Co-authored-by: Schplee <24275329+Schplee@users.noreply.github.com> --- src/yuzu/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 1fd9af942..d55733932 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -301,7 +301,12 @@ GMainWindow::GMainWindow() if (!CheckVulkan()) { config->Save(); - QMessageBox::warning(this, tr("Broken Vulkan Installation Detected"), tr("")); + QMessageBox::warning( + this, tr("Broken Vulkan Installation Detected"), + tr("Vulkan initialization failed on the previous boot.

Click here for " + "instructions to fix the issue.")); } if (UISettings::values.has_broken_vulkan) { Settings::values.renderer_backend = Settings::RendererBackend::OpenGL; -- cgit v1.2.3