diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-09-10 19:41:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-10 19:41:10 +0200 |
commit | eb9e84738025f681ac01c8ea16595b52834732d4 (patch) | |
tree | 92d91c48c42f4b9bc18fd5fea0a9bf5ed529ff04 | |
parent | Merge pull request #11436 from liamwhite/bad-format (diff) | |
parent | yuzu-qt: Use Null when OpenGL is not compiled (diff) | |
download | yuzu-eb9e84738025f681ac01c8ea16595b52834732d4.tar yuzu-eb9e84738025f681ac01c8ea16595b52834732d4.tar.gz yuzu-eb9e84738025f681ac01c8ea16595b52834732d4.tar.bz2 yuzu-eb9e84738025f681ac01c8ea16595b52834732d4.tar.lz yuzu-eb9e84738025f681ac01c8ea16595b52834732d4.tar.xz yuzu-eb9e84738025f681ac01c8ea16595b52834732d4.tar.zst yuzu-eb9e84738025f681ac01c8ea16595b52834732d4.zip |
Diffstat (limited to '')
-rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 28 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 11 |
2 files changed, 26 insertions, 13 deletions
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 8622dc184..fd6bebf0f 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -193,14 +193,10 @@ void ConfigureGraphics::PopulateVSyncModeSelection() { : vsync_mode_combobox_enum_map[current_index]; int index{}; const int device{vulkan_device_combobox->currentIndex()}; //< current selected Vulkan device - if (device == -1) { - // Invalid device - return; - } const auto& present_modes = //< relevant vector of present modes for the selected device or API - backend == Settings::RendererBackend::Vulkan ? device_present_modes[device] - : default_present_modes; + backend == Settings::RendererBackend::Vulkan && device > -1 ? device_present_modes[device] + : default_present_modes; vsync_mode_combobox->clear(); vsync_mode_combobox_enum_map.clear(); @@ -497,11 +493,19 @@ void ConfigureGraphics::RetrieveVulkanDevices() { } Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const { - if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) { - return Settings::values.renderer_backend.GetValue(true); + const auto selected_backend = [&]() { + if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) { + return Settings::values.renderer_backend.GetValue(true); + } + return static_cast<Settings::RendererBackend>( + combobox_translations.at(Settings::EnumMetadata<Settings::RendererBackend>::Index()) + .at(api_combobox->currentIndex()) + .first); + }(); + + if (selected_backend == Settings::RendererBackend::Vulkan && + UISettings::values.has_broken_vulkan) { + return Settings::RendererBackend::OpenGL; } - return static_cast<Settings::RendererBackend>( - combobox_translations.at(Settings::EnumMetadata<Settings::RendererBackend>::Index()) - .at(api_combobox->currentIndex()) - .first); + return selected_backend; } diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 21df742cb..9cea60c32 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -442,8 +442,13 @@ GMainWindow::GMainWindow(std::unique_ptr<Config> config_, bool has_broken_vulkan "#yuzu-starts-with-the-error-broken-vulkan-installation-detected'>" "here for instructions to fix the issue</a>.")); +#ifdef HAS_OPENGL Settings::values.renderer_backend = Settings::RendererBackend::OpenGL; +#else + Settings::values.renderer_backend = Settings::RendererBackend::Null; +#endif + UpdateAPIText(); renderer_status_button->setDisabled(true); renderer_status_button->setChecked(false); } else { @@ -3844,10 +3849,14 @@ void GMainWindow::OnToggleAdaptingFilter() { void GMainWindow::OnToggleGraphicsAPI() { auto api = Settings::values.renderer_backend.GetValue(); - if (api == Settings::RendererBackend::OpenGL) { + if (api != Settings::RendererBackend::Vulkan) { api = Settings::RendererBackend::Vulkan; } else { +#ifdef HAS_OPENGL api = Settings::RendererBackend::OpenGL; +#else + api = Settings::RendererBackend::Null; +#endif } Settings::values.renderer_backend.SetValue(api); renderer_status_button->setChecked(api == Settings::RendererBackend::Vulkan); |