From 92aaa86d4fd220fed7cc610ca97fae1a2c29ea61 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sat, 29 Jul 2023 23:29:53 +0100 Subject: [PATCH] Add option to force MSAA samples (#448) --- Bloxstrap/FastFlagManager.cs | 12 +++++++++++- Bloxstrap/UI/Elements/Menu/Pages/FastFlagsPage.xaml | 9 +++++++++ Bloxstrap/UI/ViewModels/Menu/FastFlagsViewModel.cs | 8 ++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Bloxstrap/FastFlagManager.cs b/Bloxstrap/FastFlagManager.cs index 421abbe..42335a3 100644 --- a/Bloxstrap/FastFlagManager.cs +++ b/Bloxstrap/FastFlagManager.cs @@ -23,6 +23,7 @@ namespace Bloxstrap { "Rendering.ManualFullscreen", "FFlagHandleAltEnterFullscreenManually" }, { "Rendering.TexturePack", "FStringPartTexturePackTable2022" }, { "Rendering.DisableScaling", "DFFlagDisableDPIScale" }, + { "Rendering.MSAA", "FIntDebugForceMSAASamples" }, { "Rendering.Mode.D3D11", "FFlagDebugGraphicsPreferD3D11" }, { "Rendering.Mode.D3D10", "FFlagDebugGraphicsPreferD3D11FL10" }, @@ -61,6 +62,15 @@ namespace Bloxstrap { "Future (Phase 3)", "Future" } }; + public static IReadOnlyDictionary MSAAModes => new Dictionary + { + { "Automatic", null }, + { "1x MSAA", "1" }, + { "2x MSAA", "2" }, + { "4x MSAA", "4" }, + { "8x MSAA", "8" } + }; + // this is one hell of a dictionary definition lmao // since these all set the same flags, wouldn't making this use bitwise operators be better? public static IReadOnlyDictionary> IGMenuVersions => new Dictionary> @@ -118,7 +128,7 @@ namespace Bloxstrap else { if (Prop.ContainsKey(key)) - App.Logger.WriteLine(LOG_IDENT, $"Setting of '{key}' from '{Prop[key]}' to '{value}' is pending"); + App.Logger.WriteLine(LOG_IDENT, $"Changing of '{key}' from '{Prop[key]}' to '{value}' is pending"); else App.Logger.WriteLine(LOG_IDENT, $"Setting of '{key}' to '{value}' is pending"); diff --git a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagsPage.xaml b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagsPage.xaml index 666e665..50c0501 100644 --- a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagsPage.xaml +++ b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagsPage.xaml @@ -171,6 +171,15 @@ + + + + + + + + + diff --git a/Bloxstrap/UI/ViewModels/Menu/FastFlagsViewModel.cs b/Bloxstrap/UI/ViewModels/Menu/FastFlagsViewModel.cs index 8b95d0c..28ba70d 100644 --- a/Bloxstrap/UI/ViewModels/Menu/FastFlagsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Menu/FastFlagsViewModel.cs @@ -127,6 +127,14 @@ namespace Bloxstrap.UI.ViewModels.Menu set => App.FastFlags.SetPresetEnum("Rendering.Lighting", LightingModes[value], "True"); } + public IReadOnlyDictionary MSAAModes => FastFlagManager.MSAAModes; + + public string SelectedMSAAMode + { + get => MSAAModes.First(x => x.Value == App.FastFlags.GetPreset("Rendering.MSAA")).Key ?? MSAAModes.First().Key; + set => App.FastFlags.SetPreset("Rendering.MSAA", MSAAModes[value]); + } + public bool GuiHidingEnabled { get => App.FastFlags.GetPreset("UI.Hide") == "32380007";