diff options
| author | 2022-06-11 00:06:59 -0700 | |
|---|---|---|
| committer | 2022-06-11 00:06:59 -0700 | |
| commit | ae83d5c6d30b9835bd642abcf3f037191f70d001 (patch) | |
| tree | e7c0d0f69687834abdf434577b46f02f20c7f335 | |
| parent | Merge pull request #8405 from Docteh/dock_undock (diff) | |
| parent | configure_graphics: Remove unused include (diff) | |
| download | yuzu-ae83d5c6d30b9835bd642abcf3f037191f70d001.tar.gz yuzu-ae83d5c6d30b9835bd642abcf3f037191f70d001.tar.xz yuzu-ae83d5c6d30b9835bd642abcf3f037191f70d001.zip | |
Merge pull request #8393 from lat9nq/default-vulkan
general: Set renderer_backend's default to Vulkan
Diffstat (limited to '')
| -rw-r--r-- | src/common/settings.h | 2 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_library.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/yuzu/check_vulkan.cpp | 53 | ||||
| -rw-r--r-- | src/yuzu/check_vulkan.h | 6 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 36 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.ui | 91 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 24 | ||||
| -rw-r--r-- | src/yuzu/uisettings.h | 2 | ||||
| -rw-r--r-- | src/yuzu_cmd/default_ini.h | 2 |
12 files changed, 184 insertions, 48 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index a7bbfb0da..a507744a2 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -496,7 +496,7 @@ struct Values { | |||
| 496 | 496 | ||
| 497 | // Renderer | 497 | // Renderer |
| 498 | RangedSetting<RendererBackend> renderer_backend{ | 498 | RangedSetting<RendererBackend> renderer_backend{ |
| 499 | RendererBackend::OpenGL, RendererBackend::OpenGL, RendererBackend::Vulkan, "backend"}; | 499 | RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Vulkan, "backend"}; |
| 500 | BasicSetting<bool> renderer_debug{false, "debug"}; | 500 | BasicSetting<bool> renderer_debug{false, "debug"}; |
| 501 | BasicSetting<bool> renderer_shader_feedback{false, "shader_feedback"}; | 501 | BasicSetting<bool> renderer_shader_feedback{false, "shader_feedback"}; |
| 502 | BasicSetting<bool> enable_nsight_aftermath{false, "nsight_aftermath"}; | 502 | BasicSetting<bool> enable_nsight_aftermath{false, "nsight_aftermath"}; |
diff --git a/src/video_core/vulkan_common/vulkan_library.cpp b/src/video_core/vulkan_common/vulkan_library.cpp index a5dd33fb2..4eb3913ee 100644 --- a/src/video_core/vulkan_common/vulkan_library.cpp +++ b/src/video_core/vulkan_common/vulkan_library.cpp | |||
| @@ -5,11 +5,13 @@ | |||
| 5 | 5 | ||
| 6 | #include "common/dynamic_library.h" | 6 | #include "common/dynamic_library.h" |
| 7 | #include "common/fs/path_util.h" | 7 | #include "common/fs/path_util.h" |
| 8 | #include "common/logging/log.h" | ||
| 8 | #include "video_core/vulkan_common/vulkan_library.h" | 9 | #include "video_core/vulkan_common/vulkan_library.h" |
| 9 | 10 | ||
| 10 | namespace Vulkan { | 11 | namespace Vulkan { |
| 11 | 12 | ||
| 12 | Common::DynamicLibrary OpenLibrary() { | 13 | Common::DynamicLibrary OpenLibrary() { |
| 14 | LOG_DEBUG(Render_Vulkan, "Looking for a Vulkan library"); | ||
| 13 | Common::DynamicLibrary library; | 15 | Common::DynamicLibrary library; |
| 14 | #ifdef __APPLE__ | 16 | #ifdef __APPLE__ |
| 15 | // Check if a path to a specific Vulkan library has been specified. | 17 | // Check if a path to a specific Vulkan library has been specified. |
| @@ -22,9 +24,11 @@ Common::DynamicLibrary OpenLibrary() { | |||
| 22 | } | 24 | } |
| 23 | #else | 25 | #else |
| 24 | std::string filename = Common::DynamicLibrary::GetVersionedFilename("vulkan", 1); | 26 | std::string filename = Common::DynamicLibrary::GetVersionedFilename("vulkan", 1); |
| 27 | LOG_DEBUG(Render_Vulkan, "Trying Vulkan library: {}", filename); | ||
| 25 | if (!library.Open(filename.c_str())) { | 28 | if (!library.Open(filename.c_str())) { |
| 26 | // Android devices may not have libvulkan.so.1, only libvulkan.so. | 29 | // Android devices may not have libvulkan.so.1, only libvulkan.so. |
| 27 | filename = Common::DynamicLibrary::GetVersionedFilename("vulkan"); | 30 | filename = Common::DynamicLibrary::GetVersionedFilename("vulkan"); |
| 31 | LOG_DEBUG(Render_Vulkan, "Trying Vulkan library (second attempt): {}", filename); | ||
| 28 | void(library.Open(filename.c_str())); | 32 | void(library.Open(filename.c_str())); |
| 29 | } | 33 | } |
| 30 | #endif | 34 | #endif |
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 1c50295c1..9259ca15e 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt | |||
| @@ -30,6 +30,8 @@ add_executable(yuzu | |||
| 30 | applets/qt_web_browser_scripts.h | 30 | applets/qt_web_browser_scripts.h |
| 31 | bootmanager.cpp | 31 | bootmanager.cpp |
| 32 | bootmanager.h | 32 | bootmanager.h |
| 33 | check_vulkan.cpp | ||
| 34 | check_vulkan.h | ||
| 33 | compatdb.ui | 35 | compatdb.ui |
| 34 | compatibility_list.cpp | 36 | compatibility_list.cpp |
| 35 | compatibility_list.h | 37 | compatibility_list.h |
diff --git a/src/yuzu/check_vulkan.cpp b/src/yuzu/check_vulkan.cpp new file mode 100644 index 000000000..e6d66ab34 --- /dev/null +++ b/src/yuzu/check_vulkan.cpp | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "video_core/vulkan_common/vulkan_wrapper.h" | ||
| 5 | |||
| 6 | #include <filesystem> | ||
| 7 | #include <fstream> | ||
| 8 | #include "common/fs/fs.h" | ||
| 9 | #include "common/fs/path_util.h" | ||
| 10 | #include "common/logging/log.h" | ||
| 11 | #include "video_core/vulkan_common/vulkan_instance.h" | ||
| 12 | #include "video_core/vulkan_common/vulkan_library.h" | ||
| 13 | #include "yuzu/check_vulkan.h" | ||
| 14 | #include "yuzu/uisettings.h" | ||
| 15 | |||
| 16 | constexpr char TEMP_FILE_NAME[] = "vulkan_check"; | ||
| 17 | |||
| 18 | bool CheckVulkan() { | ||
| 19 | if (UISettings::values.has_broken_vulkan) { | ||
| 20 | return true; | ||
| 21 | } | ||
| 22 | |||
| 23 | LOG_DEBUG(Frontend, "Checking presence of Vulkan"); | ||
| 24 | |||
| 25 | const auto fs_config_loc = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir); | ||
| 26 | const auto temp_file_loc = fs_config_loc / TEMP_FILE_NAME; | ||
| 27 | |||
| 28 | if (std::filesystem::exists(temp_file_loc)) { | ||
| 29 | LOG_WARNING(Frontend, "Detected recovery from previous failed Vulkan initialization"); | ||
| 30 | |||
| 31 | UISettings::values.has_broken_vulkan = true; | ||
| 32 | std::filesystem::remove(temp_file_loc); | ||
| 33 | return false; | ||
| 34 | } | ||
| 35 | |||
| 36 | std::ofstream temp_file_handle(temp_file_loc); | ||
| 37 | temp_file_handle.close(); | ||
| 38 | |||
| 39 | try { | ||
| 40 | Vulkan::vk::InstanceDispatch dld; | ||
| 41 | const Common::DynamicLibrary library = Vulkan::OpenLibrary(); | ||
| 42 | const Vulkan::vk::Instance instance = | ||
| 43 | Vulkan::CreateInstance(library, dld, VK_API_VERSION_1_0); | ||
| 44 | |||
| 45 | } catch (const Vulkan::vk::Exception& exception) { | ||
| 46 | LOG_ERROR(Frontend, "Failed to initialize Vulkan: {}", exception.what()); | ||
| 47 | // Don't set has_broken_vulkan to true here: we care when loading Vulkan crashes the | ||
| 48 | // application, not when we can handle it. | ||
| 49 | } | ||
| 50 | |||
| 51 | std::filesystem::remove(temp_file_loc); | ||
| 52 | return true; | ||
| 53 | } | ||
diff --git a/src/yuzu/check_vulkan.h b/src/yuzu/check_vulkan.h new file mode 100644 index 000000000..e4ea93582 --- /dev/null +++ b/src/yuzu/check_vulkan.h | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | bool CheckVulkan(); | ||
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index fffbfab02..9df4752be 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -682,6 +682,12 @@ void Config::ReadRendererValues() { | |||
| 682 | ReadGlobalSetting(Settings::values.bg_green); | 682 | ReadGlobalSetting(Settings::values.bg_green); |
| 683 | ReadGlobalSetting(Settings::values.bg_blue); | 683 | ReadGlobalSetting(Settings::values.bg_blue); |
| 684 | 684 | ||
| 685 | if (!global && UISettings::values.has_broken_vulkan && | ||
| 686 | Settings::values.renderer_backend.GetValue() == Settings::RendererBackend::Vulkan && | ||
| 687 | !Settings::values.renderer_backend.UsingGlobal()) { | ||
| 688 | Settings::values.renderer_backend.SetGlobal(true); | ||
| 689 | } | ||
| 690 | |||
| 685 | if (global) { | 691 | if (global) { |
| 686 | ReadBasicSetting(Settings::values.renderer_debug); | 692 | ReadBasicSetting(Settings::values.renderer_debug); |
| 687 | ReadBasicSetting(Settings::values.renderer_shader_feedback); | 693 | ReadBasicSetting(Settings::values.renderer_shader_feedback); |
| @@ -801,6 +807,7 @@ void Config::ReadUIValues() { | |||
| 801 | ReadBasicSetting(UISettings::values.pause_when_in_background); | 807 | ReadBasicSetting(UISettings::values.pause_when_in_background); |
| 802 | ReadBasicSetting(UISettings::values.mute_when_in_background); | 808 | ReadBasicSetting(UISettings::values.mute_when_in_background); |
| 803 | ReadBasicSetting(UISettings::values.hide_mouse); | 809 | ReadBasicSetting(UISettings::values.hide_mouse); |
| 810 | ReadBasicSetting(UISettings::values.has_broken_vulkan); | ||
| 804 | ReadBasicSetting(UISettings::values.disable_web_applet); | 811 | ReadBasicSetting(UISettings::values.disable_web_applet); |
| 805 | 812 | ||
| 806 | qt_config->endGroup(); | 813 | qt_config->endGroup(); |
| @@ -1348,6 +1355,7 @@ void Config::SaveUIValues() { | |||
| 1348 | WriteBasicSetting(UISettings::values.pause_when_in_background); | 1355 | WriteBasicSetting(UISettings::values.pause_when_in_background); |
| 1349 | WriteBasicSetting(UISettings::values.mute_when_in_background); | 1356 | WriteBasicSetting(UISettings::values.mute_when_in_background); |
| 1350 | WriteBasicSetting(UISettings::values.hide_mouse); | 1357 | WriteBasicSetting(UISettings::values.hide_mouse); |
| 1358 | WriteBasicSetting(UISettings::values.has_broken_vulkan); | ||
| 1351 | WriteBasicSetting(UISettings::values.disable_web_applet); | 1359 | WriteBasicSetting(UISettings::values.disable_web_applet); |
| 1352 | 1360 | ||
| 1353 | qt_config->endGroup(); | 1361 | qt_config->endGroup(); |
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 2f1435b10..85f34dc35 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include "video_core/vulkan_common/vulkan_library.h" | 17 | #include "video_core/vulkan_common/vulkan_library.h" |
| 18 | #include "yuzu/configuration/configuration_shared.h" | 18 | #include "yuzu/configuration/configuration_shared.h" |
| 19 | #include "yuzu/configuration/configure_graphics.h" | 19 | #include "yuzu/configuration/configure_graphics.h" |
| 20 | #include "yuzu/uisettings.h" | ||
| 20 | 21 | ||
| 21 | ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* parent) | 22 | ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* parent) |
| 22 | : QWidget(parent), ui{std::make_unique<Ui::ConfigureGraphics>()}, system{system_} { | 23 | : QWidget(parent), ui{std::make_unique<Ui::ConfigureGraphics>()}, system{system_} { |
| @@ -57,6 +58,24 @@ ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* paren | |||
| 57 | UpdateBackgroundColorButton(new_bg_color); | 58 | UpdateBackgroundColorButton(new_bg_color); |
| 58 | }); | 59 | }); |
| 59 | 60 | ||
| 61 | connect(ui->button_check_vulkan, &QAbstractButton::clicked, this, [this] { | ||
| 62 | UISettings::values.has_broken_vulkan = false; | ||
| 63 | |||
| 64 | if (RetrieveVulkanDevices()) { | ||
| 65 | ui->api->setEnabled(true); | ||
| 66 | ui->button_check_vulkan->hide(); | ||
| 67 | |||
| 68 | for (const auto& device : vulkan_devices) { | ||
| 69 | ui->device->addItem(device); | ||
| 70 | } | ||
| 71 | } else { | ||
| 72 | UISettings::values.has_broken_vulkan = true; | ||
| 73 | } | ||
| 74 | }); | ||
| 75 | |||
| 76 | ui->api->setEnabled(!UISettings::values.has_broken_vulkan.GetValue()); | ||
| 77 | ui->button_check_vulkan->setVisible(UISettings::values.has_broken_vulkan.GetValue()); | ||
| 78 | |||
| 60 | ui->bg_label->setVisible(Settings::IsConfiguringGlobal()); | 79 | ui->bg_label->setVisible(Settings::IsConfiguringGlobal()); |
| 61 | ui->bg_combobox->setVisible(!Settings::IsConfiguringGlobal()); | 80 | ui->bg_combobox->setVisible(!Settings::IsConfiguringGlobal()); |
| 62 | } | 81 | } |
| @@ -296,7 +315,7 @@ void ConfigureGraphics::UpdateAPILayout() { | |||
| 296 | vulkan_device = Settings::values.vulkan_device.GetValue(true); | 315 | vulkan_device = Settings::values.vulkan_device.GetValue(true); |
| 297 | shader_backend = Settings::values.shader_backend.GetValue(true); | 316 | shader_backend = Settings::values.shader_backend.GetValue(true); |
| 298 | ui->device_widget->setEnabled(false); | 317 | ui->device_widget->setEnabled(false); |
| 299 | ui->backend_widget->setEnabled(false); | 318 | ui->backend_widget->setEnabled(UISettings::values.has_broken_vulkan.GetValue()); |
| 300 | } else { | 319 | } else { |
| 301 | vulkan_device = Settings::values.vulkan_device.GetValue(); | 320 | vulkan_device = Settings::values.vulkan_device.GetValue(); |
| 302 | shader_backend = Settings::values.shader_backend.GetValue(); | 321 | shader_backend = Settings::values.shader_backend.GetValue(); |
| @@ -318,7 +337,11 @@ void ConfigureGraphics::UpdateAPILayout() { | |||
| 318 | } | 337 | } |
| 319 | } | 338 | } |
| 320 | 339 | ||
| 321 | void ConfigureGraphics::RetrieveVulkanDevices() try { | 340 | bool ConfigureGraphics::RetrieveVulkanDevices() try { |
| 341 | if (UISettings::values.has_broken_vulkan) { | ||
| 342 | return false; | ||
| 343 | } | ||
| 344 | |||
| 322 | using namespace Vulkan; | 345 | using namespace Vulkan; |
| 323 | 346 | ||
| 324 | vk::InstanceDispatch dld; | 347 | vk::InstanceDispatch dld; |
| @@ -333,8 +356,10 @@ void ConfigureGraphics::RetrieveVulkanDevices() try { | |||
| 333 | vulkan_devices.push_back(QString::fromStdString(name)); | 356 | vulkan_devices.push_back(QString::fromStdString(name)); |
| 334 | } | 357 | } |
| 335 | 358 | ||
| 359 | return true; | ||
| 336 | } catch (const Vulkan::vk::Exception& exception) { | 360 | } catch (const Vulkan::vk::Exception& exception) { |
| 337 | LOG_ERROR(Frontend, "Failed to enumerate devices with error: {}", exception.what()); | 361 | LOG_ERROR(Frontend, "Failed to enumerate devices with error: {}", exception.what()); |
| 362 | return false; | ||
| 338 | } | 363 | } |
| 339 | 364 | ||
| 340 | Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const { | 365 | Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const { |
| @@ -415,4 +440,11 @@ void ConfigureGraphics::SetupPerGameUI() { | |||
| 415 | ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true))); | 440 | ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true))); |
| 416 | ConfigurationShared::InsertGlobalItem( | 441 | ConfigurationShared::InsertGlobalItem( |
| 417 | ui->nvdec_emulation, static_cast<int>(Settings::values.nvdec_emulation.GetValue(true))); | 442 | ui->nvdec_emulation, static_cast<int>(Settings::values.nvdec_emulation.GetValue(true))); |
| 443 | |||
| 444 | if (UISettings::values.has_broken_vulkan) { | ||
| 445 | ui->backend_widget->setEnabled(true); | ||
| 446 | ConfigurationShared::SetColoredComboBox( | ||
| 447 | ui->backend, ui->backend_widget, | ||
| 448 | static_cast<int>(Settings::values.shader_backend.GetValue(true))); | ||
| 449 | } | ||
| 418 | } | 450 | } |
diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index 1b101c940..8438f0187 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h | |||
| @@ -41,7 +41,7 @@ private: | |||
| 41 | void UpdateDeviceSelection(int device); | 41 | void UpdateDeviceSelection(int device); |
| 42 | void UpdateShaderBackendSelection(int backend); | 42 | void UpdateShaderBackendSelection(int backend); |
| 43 | 43 | ||
| 44 | void RetrieveVulkanDevices(); | 44 | bool RetrieveVulkanDevices(); |
| 45 | 45 | ||
| 46 | void SetupPerGameUI(); | 46 | void SetupPerGameUI(); |
| 47 | 47 | ||
diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index 74f0e0b79..2f94c94bc 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui | |||
| @@ -6,8 +6,8 @@ | |||
| 6 | <rect> | 6 | <rect> |
| 7 | <x>0</x> | 7 | <x>0</x> |
| 8 | <y>0</y> | 8 | <y>0</y> |
| 9 | <width>437</width> | 9 | <width>471</width> |
| 10 | <height>482</height> | 10 | <height>759</height> |
| 11 | </rect> | 11 | </rect> |
| 12 | </property> | 12 | </property> |
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| @@ -171,11 +171,11 @@ | |||
| 171 | </widget> | 171 | </widget> |
| 172 | </item> | 172 | </item> |
| 173 | <item> | 173 | <item> |
| 174 | <widget class="QCheckBox" name="accelerate_astc"> | 174 | <widget class="QCheckBox" name="accelerate_astc"> |
| 175 | <property name="text"> | 175 | <property name="text"> |
| 176 | <string>Accelerate ASTC texture decoding</string> | 176 | <string>Accelerate ASTC texture decoding</string> |
| 177 | </property> | 177 | </property> |
| 178 | </widget> | 178 | </widget> |
| 179 | </item> | 179 | </item> |
| 180 | <item> | 180 | <item> |
| 181 | <widget class="QWidget" name="nvdec_emulation_widget" native="true"> | 181 | <widget class="QWidget" name="nvdec_emulation_widget" native="true"> |
| @@ -438,43 +438,43 @@ | |||
| 438 | </widget> | 438 | </widget> |
| 439 | </item> | 439 | </item> |
| 440 | <item> | 440 | <item> |
| 441 | <widget class="QWidget" name="anti_aliasing_layout" native="true"> | 441 | <widget class="QWidget" name="anti_aliasing_layout" native="true"> |
| 442 | <layout class="QHBoxLayout" name="horizontalLayout_7"> | 442 | <layout class="QHBoxLayout" name="horizontalLayout_7"> |
| 443 | <property name="leftMargin"> | 443 | <property name="leftMargin"> |
| 444 | <number>0</number> | 444 | <number>0</number> |
| 445 | </property> | 445 | </property> |
| 446 | <property name="topMargin"> | 446 | <property name="topMargin"> |
| 447 | <number>0</number> | 447 | <number>0</number> |
| 448 | </property> | 448 | </property> |
| 449 | <property name="rightMargin"> | 449 | <property name="rightMargin"> |
| 450 | <number>0</number> | 450 | <number>0</number> |
| 451 | </property> | ||
| 452 | <property name="bottomMargin"> | ||
| 453 | <number>0</number> | ||
| 454 | </property> | ||
| 455 | <item> | ||
| 456 | <widget class="QLabel" name="anti_aliasing_label"> | ||
| 457 | <property name="text"> | ||
| 458 | <string>Anti-Aliasing Method:</string> | ||
| 459 | </property> | ||
| 460 | </widget> | ||
| 461 | </item> | ||
| 462 | <item> | ||
| 463 | <widget class="QComboBox" name="anti_aliasing_combobox"> | ||
| 464 | <item> | ||
| 465 | <property name="text"> | ||
| 466 | <string>None</string> | ||
| 451 | </property> | 467 | </property> |
| 452 | <property name="bottomMargin"> | 468 | </item> |
| 453 | <number>0</number> | 469 | <item> |
| 470 | <property name="text"> | ||
| 471 | <string>FXAA</string> | ||
| 454 | </property> | 472 | </property> |
| 455 | <item> | 473 | </item> |
| 456 | <widget class="QLabel" name="anti_aliasing_label"> | 474 | </widget> |
| 457 | <property name="text"> | 475 | </item> |
| 458 | <string>Anti-Aliasing Method:</string> | 476 | </layout> |
| 459 | </property> | 477 | </widget> |
| 460 | </widget> | ||
| 461 | </item> | ||
| 462 | <item> | ||
| 463 | <widget class="QComboBox" name="anti_aliasing_combobox"> | ||
| 464 | <item> | ||
| 465 | <property name="text"> | ||
| 466 | <string>None</string> | ||
| 467 | </property> | ||
| 468 | </item> | ||
| 469 | <item> | ||
| 470 | <property name="text"> | ||
| 471 | <string>FXAA</string> | ||
| 472 | </property> | ||
| 473 | </item> | ||
| 474 | </widget> | ||
| 475 | </item> | ||
| 476 | </layout> | ||
| 477 | </widget> | ||
| 478 | </item> | 478 | </item> |
| 479 | <item> | 479 | <item> |
| 480 | <widget class="QWidget" name="bg_layout" native="true"> | 480 | <widget class="QWidget" name="bg_layout" native="true"> |
| @@ -574,6 +574,13 @@ | |||
| 574 | </property> | 574 | </property> |
| 575 | </spacer> | 575 | </spacer> |
| 576 | </item> | 576 | </item> |
| 577 | <item> | ||
| 578 | <widget class="QPushButton" name="button_check_vulkan"> | ||
| 579 | <property name="text"> | ||
| 580 | <string>Check for Working Vulkan</string> | ||
| 581 | </property> | ||
| 582 | </widget> | ||
| 583 | </item> | ||
| 577 | </layout> | 584 | </layout> |
| 578 | </widget> | 585 | </widget> |
| 579 | <resources/> | 586 | <resources/> |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index cbfcba9ef..4d7634184 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -115,6 +115,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual | |||
| 115 | #include "video_core/shader_notify.h" | 115 | #include "video_core/shader_notify.h" |
| 116 | #include "yuzu/about_dialog.h" | 116 | #include "yuzu/about_dialog.h" |
| 117 | #include "yuzu/bootmanager.h" | 117 | #include "yuzu/bootmanager.h" |
| 118 | #include "yuzu/check_vulkan.h" | ||
| 118 | #include "yuzu/compatdb.h" | 119 | #include "yuzu/compatdb.h" |
| 119 | #include "yuzu/compatibility_list.h" | 120 | #include "yuzu/compatibility_list.h" |
| 120 | #include "yuzu/configuration/config.h" | 121 | #include "yuzu/configuration/config.h" |
| @@ -322,6 +323,23 @@ GMainWindow::GMainWindow() | |||
| 322 | 323 | ||
| 323 | MigrateConfigFiles(); | 324 | MigrateConfigFiles(); |
| 324 | 325 | ||
| 326 | if (!CheckVulkan()) { | ||
| 327 | config->Save(); | ||
| 328 | |||
| 329 | QMessageBox::warning( | ||
| 330 | this, tr("Broken Vulkan Installation Detected"), | ||
| 331 | tr("Vulkan initialization failed on the previous boot.<br><br>Click <a " | ||
| 332 | "href='https://yuzu-emu.org/wiki/faq/" | ||
| 333 | "#yuzu-starts-with-the-error-broken-vulkan-installation-detected'>here for " | ||
| 334 | "instructions to fix the issue</a>.")); | ||
| 335 | } | ||
| 336 | if (UISettings::values.has_broken_vulkan) { | ||
| 337 | Settings::values.renderer_backend = Settings::RendererBackend::OpenGL; | ||
| 338 | |||
| 339 | renderer_status_button->setDisabled(true); | ||
| 340 | renderer_status_button->setChecked(false); | ||
| 341 | } | ||
| 342 | |||
| 325 | #if defined(HAVE_SDL2) && !defined(_WIN32) | 343 | #if defined(HAVE_SDL2) && !defined(_WIN32) |
| 326 | SDL_InitSubSystem(SDL_INIT_VIDEO); | 344 | SDL_InitSubSystem(SDL_INIT_VIDEO); |
| 327 | // SDL disables the screen saver by default, and setting the hint | 345 | // SDL disables the screen saver by default, and setting the hint |
| @@ -1591,7 +1609,7 @@ void GMainWindow::ShutdownGame() { | |||
| 1591 | emu_speed_label->setVisible(false); | 1609 | emu_speed_label->setVisible(false); |
| 1592 | game_fps_label->setVisible(false); | 1610 | game_fps_label->setVisible(false); |
| 1593 | emu_frametime_label->setVisible(false); | 1611 | emu_frametime_label->setVisible(false); |
| 1594 | renderer_status_button->setEnabled(true); | 1612 | renderer_status_button->setEnabled(!UISettings::values.has_broken_vulkan); |
| 1595 | 1613 | ||
| 1596 | game_path.clear(); | 1614 | game_path.clear(); |
| 1597 | 1615 | ||
| @@ -2801,6 +2819,10 @@ void GMainWindow::OnConfigure() { | |||
| 2801 | mouse_hide_timer.start(); | 2819 | mouse_hide_timer.start(); |
| 2802 | } | 2820 | } |
| 2803 | 2821 | ||
| 2822 | if (!UISettings::values.has_broken_vulkan) { | ||
| 2823 | renderer_status_button->setEnabled(!emulation_running); | ||
| 2824 | } | ||
| 2825 | |||
| 2804 | UpdateStatusButtons(); | 2826 | UpdateStatusButtons(); |
| 2805 | controller_dialog->refreshConfiguration(); | 2827 | controller_dialog->refreshConfiguration(); |
| 2806 | } | 2828 | } |
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 15ba9ea17..c64d87ace 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h | |||
| @@ -77,6 +77,8 @@ 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 | ||
| 81 | Settings::BasicSetting<bool> has_broken_vulkan{false, "has_broken_vulkan"}; | ||
| 80 | 82 | ||
| 81 | 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"}; |
| 82 | 84 | ||
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index f34d6b728..39063e32b 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h | |||
| @@ -218,7 +218,7 @@ cpuopt_unsafe_ignore_global_monitor = | |||
| 218 | 218 | ||
| 219 | [Renderer] | 219 | [Renderer] |
| 220 | # Which backend API to use. | 220 | # Which backend API to use. |
| 221 | # 0 (default): OpenGL, 1: Vulkan | 221 | # 0: OpenGL, 1 (default): Vulkan |
| 222 | backend = | 222 | backend = |
| 223 | 223 | ||
| 224 | # Enable graphics API debugging mode. | 224 | # Enable graphics API debugging mode. |