Graphics Preferences: Anti-aliasing + FPS (#13538)

* Expose Antialiasing velues

Expose Antialiasing multipliers.
Default to 4 as current implementation but enables the user to disable it to improve performante or increase sampling to improve quality.

* FXAA

* Improve descriptions

* Require restart when MSAA setting changes

Detect changes to the OpenGL MSAA (multisample anti-aliasing) preference when opening Preferences and prompt the user to restart the application to apply the change. Adds a constant key for the MSAA setting, stores the previous value, checks for changes (similar to the existing FXAA handling), and shows a warning dialog explaining the restart will close the current project without saving. If the user accepts, recreate_GUI is invoked to apply the MSAA change immediately.

* Revert "Require restart when MSAA setting changes"

This reverts commit dde134d346c3849598c91d025d2faed1b51c8a22.

* Menu and FPS options

* Fix FPS limiter and remove VSYNC

* Grouped FPS settings and mode up rigth fps counter

---------

Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
Ian Bassi
2026-05-17 02:31:51 -03:00
committed by GitHub
parent b3fe733bf2
commit 873d0ed26e
12 changed files with 393 additions and 7 deletions

View File

@@ -114,7 +114,8 @@ wxBoxSizer *PreferencesDialog::create_item_combobox(wxString title, wxString too
if (!current_setting.empty()) {
auto compare = [current_setting](string possible_setting) { return current_setting == possible_setting; };
auto iterator = find_if(config_name_index.begin(), config_name_index.end(), compare);
current_index = iterator - config_name_index.begin();
if (iterator != config_name_index.end())
current_index = static_cast<unsigned int>(iterator - config_name_index.begin());
}
auto [sizer, combobox] = create_item_combobox_base(title, tooltip, param, vlist, current_index);
@@ -1526,6 +1527,64 @@ void PreferencesDialog::create_items()
g_sizer->AddSpacer(FromDIP(10));
sizer_page->Add(g_sizer, 0, wxEXPAND);
//////////////////////////
//// GRAPHICS TAB
/////////////////////////////////////
m_pref_tabs->AppendItem(_L("Graphics"));
f_sizers.push_back(new wxFlexGridSizer(1, 1, v_gap, 0));
g_sizer = f_sizers.back();
g_sizer->AddGrowableCol(0, 1);
//// GRAPHICS > Anti-aliasing
g_sizer->Add(create_item_title(_L("Anti-aliasing")), 1, wxEXPAND);
auto item_antialiasing = create_item_combobox(
_L("MSAA Multiplier"),
_L("Set the Multi-Sample Anti-Aliasing level.\n"
"Higher values result in smoother edges, but the impact on performance is exponential.\n"
"Lower values improve performance, at the cost of jagged edges.\n"
"If disabled, its recommended to enable FXAA to reduce jagged edges with minimal performance impact.\n\n"
"Requires application restart."),
SETTING_OPENGL_AA_SAMPLES,
{_L("Disabled"), "2x", "4x", "8x", "16x"},
{"0", "2", "4", "8", "16"}
);
g_sizer->Add(item_antialiasing);
auto item_fxaa = create_item_checkbox(
_L("FXAA post-processing"),
_L("Applies Fast Approximate Anti-Aliasing as a screen-space pass.\n"
"Useful for disabling or reducing the MSAA setting to improve performance.\n\n"
"Takes effect immediately."),
SETTING_OPENGL_FXAA_ENABLED
);
g_sizer->Add(item_fxaa);
//// GRAPHICS > FPS
g_sizer->Add(create_item_title(_L("FPS")), 1, wxEXPAND);
auto item_fps_cap = create_item_spinctrl(
_L("FPS cap"),
_L("(0 = unlimited)"),
_L("FPS"),
_L("Limits viewport frame rate to reduce GPU load and power usage.\n"
"Set to 0 for unlimited frame rate."),
SETTING_OPENGL_FPS_CAP,
0,
240
);
g_sizer->Add(item_fps_cap);
auto item_fps_overlay = create_item_checkbox(
_L("Show FPS overlay"),
_L("Displays current viewport FPS in the top-right corner."),
SETTING_OPENGL_SHOW_FPS_OVERLAY
);
g_sizer->Add(item_fps_overlay);
g_sizer->AddSpacer(FromDIP(10));
sizer_page->Add(g_sizer, 0, wxEXPAND);
//////////////////////////
//// ONLINE TAB
/////////////////////////////////////