yuzu-qt: Make has_broken_vulkan only for crashes

Being able to catch and handle a Vulkan exception is not what this is
for.
This commit is contained in:
lat9nq 2022-05-29 22:26:27 -04:00
parent b43ae9d5ed
commit 500b01076e
5 changed files with 17 additions and 11 deletions

View file

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "video_core/vulkan_common/vulkan_wrapper.h" #include "video_core/vulkan_common/vulkan_wrapper.h"
#include <exception>
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
#include "common/fs/fs.h" #include "common/fs/fs.h"
@ -42,8 +44,8 @@ bool CheckVulkan() {
} catch (const Vulkan::vk::Exception& exception) { } catch (const Vulkan::vk::Exception& exception) {
LOG_ERROR(Frontend, "Failed to initialize Vulkan: {}", exception.what()); LOG_ERROR(Frontend, "Failed to initialize Vulkan: {}", exception.what());
UISettings::values.has_broken_vulkan = true; // Don't set has_broken_vulkan to true here: we care when loading Vulkan crashes the
return false; // application, not when we can handle it.
} }
std::filesystem::remove(temp_file_loc); std::filesystem::remove(temp_file_loc);

View file

@ -1 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
bool CheckVulkan(); bool CheckVulkan();

View file

@ -64,6 +64,7 @@ ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* paren
if (RetrieveVulkanDevices()) { if (RetrieveVulkanDevices()) {
ui->api->setEnabled(true); ui->api->setEnabled(true);
ui->button_check_vulkan->hide();
for (const auto& device : vulkan_devices) { for (const auto& device : vulkan_devices) {
ui->device->addItem(device); ui->device->addItem(device);
@ -356,9 +357,6 @@ bool ConfigureGraphics::RetrieveVulkanDevices() try {
vulkan_devices.push_back(QString::fromStdString(name)); vulkan_devices.push_back(QString::fromStdString(name));
} }
UISettings::values.has_broken_vulkan = false;
ui->button_check_vulkan->setVisible(false);
return true; return true;
} catch (const Vulkan::vk::Exception& exception) { } catch (const Vulkan::vk::Exception& exception) {
LOG_ERROR(Frontend, "Failed to enumerate devices with error: {}", exception.what()); LOG_ERROR(Frontend, "Failed to enumerate devices with error: {}", exception.what());

View file

@ -299,11 +299,7 @@ GMainWindow::GMainWindow()
MigrateConfigFiles(); MigrateConfigFiles();
if (!CheckVulkan()) { if (!CheckVulkan()) {
QMessageBox::warning( QMessageBox::warning(this, tr("Broken Vulkan Installation Detected"), tr(""));
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) { if (UISettings::values.has_broken_vulkan) {
Settings::values.renderer_backend = Settings::RendererBackend::OpenGL; Settings::values.renderer_backend = Settings::RendererBackend::OpenGL;
@ -2788,6 +2784,10 @@ void GMainWindow::OnConfigure() {
mouse_hide_timer.start(); mouse_hide_timer.start();
} }
if (!UISettings::values.has_broken_vulkan) {
renderer_status_button->setEnabled(!emulation_running);
}
UpdateStatusButtons(); UpdateStatusButtons();
controller_dialog->refreshConfiguration(); controller_dialog->refreshConfiguration();
} }

View file

@ -77,6 +77,7 @@ struct Values {
Settings::BasicSetting<bool> pause_when_in_background{false, "pauseWhenInBackground"}; Settings::BasicSetting<bool> pause_when_in_background{false, "pauseWhenInBackground"};
Settings::BasicSetting<bool> mute_when_in_background{false, "muteWhenInBackground"}; Settings::BasicSetting<bool> mute_when_in_background{false, "muteWhenInBackground"};
Settings::BasicSetting<bool> hide_mouse{true, "hideInactiveMouse"}; Settings::BasicSetting<bool> hide_mouse{true, "hideInactiveMouse"};
// Set when Vulkan is known to crash the application
Settings::BasicSetting<bool> has_broken_vulkan{false, "has_broken_vulkan"}; Settings::BasicSetting<bool> has_broken_vulkan{false, "has_broken_vulkan"};
Settings::BasicSetting<bool> select_user_on_boot{false, "select_user_on_boot"}; Settings::BasicSetting<bool> select_user_on_boot{false, "select_user_on_boot"};