summaryrefslogtreecommitdiff
path: root/src/yuzu/configuration/configure_graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu/configuration/configure_graphics.cpp')
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp72
1 files changed, 54 insertions, 18 deletions
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index a94fbc89a..fd6bebf0f 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -24,6 +24,7 @@
#include <QtCore/qobjectdefs.h>
#include <qabstractbutton.h>
#include <qboxlayout.h>
+#include <qcombobox.h>
#include <qcoreevent.h>
#include <qglobal.h>
#include <qgridlayout.h>
@@ -77,13 +78,16 @@ static constexpr Settings::VSyncMode PresentModeToSetting(VkPresentModeKHR mode)
}
}
-ConfigureGraphics::ConfigureGraphics(const Core::System& system_,
- std::vector<VkDeviceInfo::Record>& records_,
- const std::function<void()>& expose_compute_option_,
- std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group_,
- const ConfigurationShared::Builder& builder, QWidget* parent)
+ConfigureGraphics::ConfigureGraphics(
+ const Core::System& system_, std::vector<VkDeviceInfo::Record>& records_,
+ const std::function<void()>& expose_compute_option_,
+ const std::function<void(Settings::AspectRatio, Settings::ResolutionSetup)>&
+ update_aspect_ratio_,
+ std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group_,
+ const ConfigurationShared::Builder& builder, QWidget* parent)
: ConfigurationShared::Tab(group_, parent), ui{std::make_unique<Ui::ConfigureGraphics>()},
- records{records_}, expose_compute_option{expose_compute_option_}, system{system_},
+ records{records_}, expose_compute_option{expose_compute_option_},
+ update_aspect_ratio{update_aspect_ratio_}, system{system_},
combobox_translations{builder.ComboboxTranslations()},
shader_mapping{
combobox_translations.at(Settings::EnumMetadata<Settings::ShaderBackend>::Index())} {
@@ -140,6 +144,26 @@ ConfigureGraphics::ConfigureGraphics(const Core::System& system_,
UpdateBackgroundColorButton(new_bg_color);
});
+ const auto& update_screenshot_info = [this, &builder]() {
+ const auto& combobox_enumerations = builder.ComboboxTranslations().at(
+ Settings::EnumMetadata<Settings::AspectRatio>::Index());
+ const auto index = aspect_ratio_combobox->currentIndex();
+ const auto ratio = static_cast<Settings::AspectRatio>(combobox_enumerations[index].first);
+
+ const auto& combobox_enumerations_resolution = builder.ComboboxTranslations().at(
+ Settings::EnumMetadata<Settings::ResolutionSetup>::Index());
+ const auto res_index = resolution_combobox->currentIndex();
+ const auto setup = static_cast<Settings::ResolutionSetup>(
+ combobox_enumerations_resolution[res_index].first);
+
+ update_aspect_ratio(ratio, setup);
+ };
+
+ connect(aspect_ratio_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ update_screenshot_info);
+ connect(resolution_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ update_screenshot_info);
+
api_combobox->setEnabled(!UISettings::values.has_broken_vulkan && api_combobox->isEnabled());
ui->api_widget->setEnabled(
(!UISettings::values.has_broken_vulkan || Settings::IsConfiguringGlobal()) &&
@@ -169,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();
@@ -280,6 +300,14 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) {
// Keep track of vsync_mode's combobox so we can populate it
vsync_mode_combobox = widget->combobox;
hold_graphics.emplace(setting->Id(), widget);
+ } else if (setting->Id() == Settings::values.aspect_ratio.Id()) {
+ // Keep track of the aspect ratio combobox to update other UI tabs that need it
+ aspect_ratio_combobox = widget->combobox;
+ hold_graphics.emplace(setting->Id(), widget);
+ } else if (setting->Id() == Settings::values.resolution_setup.Id()) {
+ // Keep track of the resolution combobox to update other UI tabs that need it
+ resolution_combobox = widget->combobox;
+ hold_graphics.emplace(setting->Id(), widget);
} else {
hold_graphics.emplace(setting->Id(), widget);
}
@@ -465,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;
}