From 2deb17d8c06e7ab2d3a2b845784ec8fb62990566 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Sun, 17 Nov 2024 17:30:48 +0000 Subject: [PATCH] config: replace MSAA with AntiAliasing enum --- UnleashedRecomp/cfg/config.h | 2 +- UnleashedRecomp/cfg/config_detail.h | 16 ++++++++++++++++ UnleashedRecomp/cfg/config_locale.h | 12 +++++++++++- UnleashedRecomp/gpu/video.cpp | 2 +- UnleashedRecomp/ui/options_menu.cpp | 5 ++--- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/UnleashedRecomp/cfg/config.h b/UnleashedRecomp/cfg/config.h index 82ee9dd9..cff597d6 100644 --- a/UnleashedRecomp/cfg/config.h +++ b/UnleashedRecomp/cfg/config.h @@ -45,7 +45,7 @@ public: CONFIG_DEFINE_LOCALISED("Video", bool, TripleBuffering, true); CONFIG_DEFINE("Video", int32_t, FPS, 60); CONFIG_DEFINE_LOCALISED("Video", float, Brightness, 0.5f); - CONFIG_DEFINE_LOCALISED("Video", size_t, MSAA, 4); + CONFIG_DEFINE_ENUM_LOCALISED("Video", EAntiAliasing, AntiAliasing, EAntiAliasing::MSAA4x); CONFIG_DEFINE_LOCALISED("Video", size_t, AnisotropicFiltering, 16); CONFIG_DEFINE_ENUM_LOCALISED("Video", EShadowResolution, ShadowResolution, EShadowResolution::x4096); CONFIG_DEFINE_ENUM_LOCALISED("Video", EGITextureFiltering, GITextureFiltering, EGITextureFiltering::Bicubic); diff --git a/UnleashedRecomp/cfg/config_detail.h b/UnleashedRecomp/cfg/config_detail.h index dbb0c4f9..7cf75299 100644 --- a/UnleashedRecomp/cfg/config_detail.h +++ b/UnleashedRecomp/cfg/config_detail.h @@ -84,6 +84,22 @@ CONFIG_DEFINE_ENUM_TEMPLATE(EWindowState) { "Maximized", EWindowState::Maximised } }; +enum class EAntiAliasing : uint32_t +{ + None = 0, + MSAA2x = 2, + MSAA4x = 4, + MSAA8x = 8 +}; + +CONFIG_DEFINE_ENUM_TEMPLATE(EAntiAliasing) +{ + { "None", EAntiAliasing::None }, + { "2x MSAA", EAntiAliasing::MSAA2x }, + { "4x MSAA", EAntiAliasing::MSAA4x }, + { "8x MSAA", EAntiAliasing::MSAA8x } +}; + enum class EShadowResolution : int32_t { Original = -1, diff --git a/UnleashedRecomp/cfg/config_locale.h b/UnleashedRecomp/cfg/config_locale.h index 92369ca1..0db8a278 100644 --- a/UnleashedRecomp/cfg/config_locale.h +++ b/UnleashedRecomp/cfg/config_locale.h @@ -171,11 +171,21 @@ CONFIG_DEFINE_LOCALE(Brightness) { ELanguage::English, "Brightness" } }; -CONFIG_DEFINE_LOCALE(MSAA) +CONFIG_DEFINE_LOCALE(AntiAliasing) { { ELanguage::English, "Anti-Aliasing" } }; +CONFIG_DEFINE_ENUM_LOCALE(EAntiAliasing) +{ + { + ELanguage::English, + { + { EAntiAliasing::None, "NONE" }, + } + } +}; + CONFIG_DEFINE_LOCALE(AnisotropicFiltering) { { ELanguage::English, "Anisotropic Filtering" } diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index cc2c408f..6c05abd4 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -1843,7 +1843,7 @@ static GuestSurface* CreateSurface(uint32_t width, uint32_t height, uint32_t for desc.depth = 1; desc.mipLevels = 1; desc.arraySize = 1; - desc.multisampling.sampleCount = multiSample != 0 && Config::MSAA > 1 ? Config::MSAA : RenderSampleCount::COUNT_1; + desc.multisampling.sampleCount = multiSample != 0 && (int)Config::AntiAliasing.Value > 1 ? (int)Config::AntiAliasing.Value : RenderSampleCount::COUNT_1; desc.format = ConvertFormat(format); desc.flags = desc.format == RenderFormat::D32_FLOAT ? RenderTextureFlag::DEPTH_TARGET : RenderTextureFlag::RENDER_TARGET; diff --git a/UnleashedRecomp/ui/options_menu.cpp b/UnleashedRecomp/ui/options_menu.cpp index 61ff753a..82e7659b 100644 --- a/UnleashedRecomp/ui/options_menu.cpp +++ b/UnleashedRecomp/ui/options_menu.cpp @@ -392,15 +392,14 @@ static void DrawConfigOptions() DrawConfigOption(rowIndex++, Config::WerehogBattleMusic); break; case 3: // VIDEO - DrawConfigOption(rowIndex++, Config::WindowWidth); - DrawConfigOption(rowIndex++, Config::WindowHeight); + // TODO: expose WindowWidth/WindowHeight as WindowSize. DrawConfigOption(rowIndex++, Config::ResolutionScale); DrawConfigOption(rowIndex++, Config::Fullscreen); DrawConfigOption(rowIndex++, Config::VSync); DrawConfigOption(rowIndex++, Config::TripleBuffering); DrawConfigOption(rowIndex++, Config::FPS); DrawConfigOption(rowIndex++, Config::Brightness); - DrawConfigOption(rowIndex++, Config::MSAA); + DrawConfigOption(rowIndex++, Config::AntiAliasing); DrawConfigOption(rowIndex++, Config::ShadowResolution); DrawConfigOption(rowIndex++, Config::GITextureFiltering); DrawConfigOption(rowIndex++, Config::AlphaToCoverage);