From 8366736b67d6febe278b6599badf4e945599bc30 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 20 Jun 2023 23:29:07 -0400 Subject: [PATCH] settings,opengl,yuzu-qt: Fix AA, Filter maximums The new enum macros don't support setting values directly. For LastAA and LastFilter, this means we need a simpler approach to loop around the toggle in the frontend... --- src/common/settings_enums.h | 4 ++-- src/video_core/renderer_opengl/renderer_opengl.cpp | 2 +- src/yuzu/main.cpp | 11 +++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index 71515257a..cc5c929cf 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h @@ -122,9 +122,9 @@ ENUM(NvdecEmulation, Off, Cpu, Gpu); ENUM(ResolutionSetup, Res1_2X, Res3_4X, Res1X, Res3_2X, Res2X, Res3X, Res4X, Res5X, Res6X, Res7X, Res8X); -ENUM(ScalingFilter, NearestNeighbor, Bilinear, Bicubic, Gaussian, ScaleForce, Fsr, LastFilter); +ENUM(ScalingFilter, NearestNeighbor, Bilinear, Bicubic, Gaussian, ScaleForce, Fsr, MaxEnum); -ENUM(AntiAliasing, None, Fxaa, Smaa, LastAA); +ENUM(AntiAliasing, None, Fxaa, Smaa, MaxEnum); ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 2a74c1d05..6b8d4e554 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -473,7 +473,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) { glBindTextureUnit(0, screen_info.display_texture); auto anti_aliasing = Settings::values.anti_aliasing.GetValue(); - if (anti_aliasing > Settings::AntiAliasing::LastAA) { + if (anti_aliasing >= Settings::AntiAliasing::MaxEnum) { LOG_ERROR(Render_OpenGL, "Invalid antialiasing option selected {}", anti_aliasing); anti_aliasing = Settings::AntiAliasing::None; Settings::values.anti_aliasing.SetValue(anti_aliasing); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 2922b3347..97ae9e49a 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -24,6 +24,7 @@ #include "applets/qt_software_keyboard.h" #include "applets/qt_web_browser.h" #include "common/nvidia_flags.h" +#include "common/settings_enums.h" #include "configuration/configure_input.h" #include "configuration/configure_per_game.h" #include "configuration/configure_tas.h" @@ -1095,10 +1096,9 @@ void GMainWindow::InitializeWidgets() { aa_status_button->setFocusPolicy(Qt::NoFocus); connect(aa_status_button, &QPushButton::clicked, [&] { auto aa_mode = Settings::values.anti_aliasing.GetValue(); - if (aa_mode == Settings::AntiAliasing::LastAA) { + aa_mode = static_cast(static_cast(aa_mode) + 1); + if (aa_mode == Settings::AntiAliasing::MaxEnum) { aa_mode = Settings::AntiAliasing::None; - } else { - aa_mode = static_cast(static_cast(aa_mode) + 1); } Settings::values.anti_aliasing.SetValue(aa_mode); aa_status_button->setChecked(true); @@ -3702,10 +3702,9 @@ void GMainWindow::OnIncreaseVolume() { void GMainWindow::OnToggleAdaptingFilter() { auto filter = Settings::values.scaling_filter.GetValue(); - if (filter == Settings::ScalingFilter::LastFilter) { + filter = static_cast(static_cast(filter) + 1); + if (filter == Settings::ScalingFilter::MaxEnum) { filter = Settings::ScalingFilter::NearestNeighbor; - } else { - filter = static_cast(static_cast(filter) + 1); } Settings::values.scaling_filter.SetValue(filter); filter_status_button->setChecked(true);