mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 23:02:47 +01:00
configure_graphics: Fix handling of broken Vulkan
The VSync combobox wouldn't populate if there was no Vulkan device, which caused issues with trying to set VSync on other backends. This also adds another layer to GetCurrentGraphicsBackend to check for broken Vulkan and return OpenGL instead of Vulkan.
This commit is contained in:
parent
c24ed3ecaf
commit
ea46efd9a2
1 changed files with 16 additions and 12 deletions
|
@ -193,13 +193,9 @@ void ConfigureGraphics::PopulateVSyncModeSelection() {
|
||||||
: vsync_mode_combobox_enum_map[current_index];
|
: vsync_mode_combobox_enum_map[current_index];
|
||||||
int index{};
|
int index{};
|
||||||
const int device{vulkan_device_combobox->currentIndex()}; //< current selected Vulkan device
|
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
|
const auto& present_modes = //< relevant vector of present modes for the selected device or API
|
||||||
backend == Settings::RendererBackend::Vulkan ? device_present_modes[device]
|
backend == Settings::RendererBackend::Vulkan && device > -1 ? device_present_modes[device]
|
||||||
: default_present_modes;
|
: default_present_modes;
|
||||||
|
|
||||||
vsync_mode_combobox->clear();
|
vsync_mode_combobox->clear();
|
||||||
|
@ -497,6 +493,7 @@ void ConfigureGraphics::RetrieveVulkanDevices() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const {
|
Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const {
|
||||||
|
const auto selected_backend = [=]() {
|
||||||
if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) {
|
if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) {
|
||||||
return Settings::values.renderer_backend.GetValue(true);
|
return Settings::values.renderer_backend.GetValue(true);
|
||||||
}
|
}
|
||||||
|
@ -504,4 +501,11 @@ Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const {
|
||||||
combobox_translations.at(Settings::EnumMetadata<Settings::RendererBackend>::Index())
|
combobox_translations.at(Settings::EnumMetadata<Settings::RendererBackend>::Index())
|
||||||
.at(api_combobox->currentIndex())
|
.at(api_combobox->currentIndex())
|
||||||
.first);
|
.first);
|
||||||
|
}();
|
||||||
|
|
||||||
|
if (selected_backend == Settings::RendererBackend::Vulkan &&
|
||||||
|
UISettings::values.has_broken_vulkan) {
|
||||||
|
return Settings::RendererBackend::OpenGL;
|
||||||
|
}
|
||||||
|
return selected_backend;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue