summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar lat9nq2022-05-29 22:26:27 -0400
committerGravatar lat9nq2022-05-30 10:58:18 -0400
commit500b01076e1a96b9c133ff663daad6f9dd8e4039 (patch)
treeb5305da5e8e97e3a42c641e36d644ea0a801b823
parentvulkan_library: Add debug logging (diff)
downloadyuzu-500b01076e1a96b9c133ff663daad6f9dd8e4039.tar.gz
yuzu-500b01076e1a96b9c133ff663daad6f9dd8e4039.tar.xz
yuzu-500b01076e1a96b9c133ff663daad6f9dd8e4039.zip
yuzu-qt: Make has_broken_vulkan only for crashes
Being able to catch and handle a Vulkan exception is not what this is for.
-rw-r--r--src/yuzu/check_vulkan.cpp8
-rw-r--r--src/yuzu/check_vulkan.h5
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp4
-rw-r--r--src/yuzu/main.cpp10
-rw-r--r--src/yuzu/uisettings.h1
5 files changed, 17 insertions, 11 deletions
diff --git a/src/yuzu/check_vulkan.cpp b/src/yuzu/check_vulkan.cpp
index 1b21efe69..e6d66ab34 100644
--- a/src/yuzu/check_vulkan.cpp
+++ b/src/yuzu/check_vulkan.cpp
@@ -1,6 +1,8 @@
1// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
1#include "video_core/vulkan_common/vulkan_wrapper.h" 4#include "video_core/vulkan_common/vulkan_wrapper.h"
2 5
3#include <exception>
4#include <filesystem> 6#include <filesystem>
5#include <fstream> 7#include <fstream>
6#include "common/fs/fs.h" 8#include "common/fs/fs.h"
@@ -42,8 +44,8 @@ bool CheckVulkan() {
42 44
43 } catch (const Vulkan::vk::Exception& exception) { 45 } catch (const Vulkan::vk::Exception& exception) {
44 LOG_ERROR(Frontend, "Failed to initialize Vulkan: {}", exception.what()); 46 LOG_ERROR(Frontend, "Failed to initialize Vulkan: {}", exception.what());
45 UISettings::values.has_broken_vulkan = true; 47 // Don't set has_broken_vulkan to true here: we care when loading Vulkan crashes the
46 return false; 48 // application, not when we can handle it.
47 } 49 }
48 50
49 std::filesystem::remove(temp_file_loc); 51 std::filesystem::remove(temp_file_loc);
diff --git a/src/yuzu/check_vulkan.h b/src/yuzu/check_vulkan.h
index 3b199d3bb..e4ea93582 100644
--- a/src/yuzu/check_vulkan.h
+++ b/src/yuzu/check_vulkan.h
@@ -1 +1,6 @@
1// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
1bool CheckVulkan(); 6bool CheckVulkan();
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index 482a6a8ab..70015a373 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -64,6 +64,7 @@ ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* paren
64 64
65 if (RetrieveVulkanDevices()) { 65 if (RetrieveVulkanDevices()) {
66 ui->api->setEnabled(true); 66 ui->api->setEnabled(true);
67 ui->button_check_vulkan->hide();
67 68
68 for (const auto& device : vulkan_devices) { 69 for (const auto& device : vulkan_devices) {
69 ui->device->addItem(device); 70 ui->device->addItem(device);
@@ -356,9 +357,6 @@ bool ConfigureGraphics::RetrieveVulkanDevices() try {
356 vulkan_devices.push_back(QString::fromStdString(name)); 357 vulkan_devices.push_back(QString::fromStdString(name));
357 } 358 }
358 359
359 UISettings::values.has_broken_vulkan = false;
360 ui->button_check_vulkan->setVisible(false);
361
362 return true; 360 return true;
363} catch (const Vulkan::vk::Exception& exception) { 361} catch (const Vulkan::vk::Exception& exception) {
364 LOG_ERROR(Frontend, "Failed to enumerate devices with error: {}", exception.what()); 362 LOG_ERROR(Frontend, "Failed to enumerate devices with error: {}", exception.what());
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()
299 MigrateConfigFiles(); 299 MigrateConfigFiles();
300 300
301 if (!CheckVulkan()) { 301 if (!CheckVulkan()) {
302 QMessageBox::warning( 302 QMessageBox::warning(this, tr("Broken Vulkan Installation Detected"), tr(""));
303 this, tr("Broken Vulkan Installation Detected"),
304 tr("Vulkan initialization failed on the previous boot. Please update your graphics "
305 "driver, then re-check your Vulkan installation by accessing the Graphics "
306 "configuration and clicking \"Check for Working Vulkan\"."));
307 } 303 }
308 if (UISettings::values.has_broken_vulkan) { 304 if (UISettings::values.has_broken_vulkan) {
309 Settings::values.renderer_backend = Settings::RendererBackend::OpenGL; 305 Settings::values.renderer_backend = Settings::RendererBackend::OpenGL;
@@ -2788,6 +2784,10 @@ void GMainWindow::OnConfigure() {
2788 mouse_hide_timer.start(); 2784 mouse_hide_timer.start();
2789 } 2785 }
2790 2786
2787 if (!UISettings::values.has_broken_vulkan) {
2788 renderer_status_button->setEnabled(!emulation_running);
2789 }
2790
2791 UpdateStatusButtons(); 2791 UpdateStatusButtons();
2792 controller_dialog->refreshConfiguration(); 2792 controller_dialog->refreshConfiguration();
2793} 2793}
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h
index 653b76883..c64d87ace 100644
--- a/src/yuzu/uisettings.h
+++ b/src/yuzu/uisettings.h
@@ -77,6 +77,7 @@ struct Values {
77 Settings::BasicSetting<bool> pause_when_in_background{false, "pauseWhenInBackground"}; 77 Settings::BasicSetting<bool> pause_when_in_background{false, "pauseWhenInBackground"};
78 Settings::BasicSetting<bool> mute_when_in_background{false, "muteWhenInBackground"}; 78 Settings::BasicSetting<bool> mute_when_in_background{false, "muteWhenInBackground"};
79 Settings::BasicSetting<bool> hide_mouse{true, "hideInactiveMouse"}; 79 Settings::BasicSetting<bool> hide_mouse{true, "hideInactiveMouse"};
80 // Set when Vulkan is known to crash the application
80 Settings::BasicSetting<bool> has_broken_vulkan{false, "has_broken_vulkan"}; 81 Settings::BasicSetting<bool> has_broken_vulkan{false, "has_broken_vulkan"};
81 82
82 Settings::BasicSetting<bool> select_user_on_boot{false, "select_user_on_boot"}; 83 Settings::BasicSetting<bool> select_user_on_boot{false, "select_user_on_boot"};