opengl linked antialiasing settings and scaling to gui

This commit is contained in:
KojoZero 2026-05-04 18:26:22 -07:00
parent f14d870ec9
commit 912c2d70e2
6 changed files with 90 additions and 9 deletions

View file

@ -717,6 +717,7 @@ void QtConfig::ReadRendererValues() {
ReadGlobalSetting(Settings::values.bg_blue);
ReadGlobalSetting(Settings::values.texture_filter);
ReadGlobalSetting(Settings::values.antialiasing_filter);
ReadGlobalSetting(Settings::values.texture_sampling);
ReadGlobalSetting(Settings::values.delay_game_render_thread_us);
@ -1261,6 +1262,7 @@ void QtConfig::SaveRendererValues() {
WriteGlobalSetting(Settings::values.bg_blue);
WriteGlobalSetting(Settings::values.texture_filter);
WriteGlobalSetting(Settings::values.antialiasing_filter);
WriteGlobalSetting(Settings::values.texture_sampling);
WriteGlobalSetting(Settings::values.delay_game_render_thread_us);

View file

@ -48,11 +48,17 @@ void ConfigureEnhancements::SetConfiguration() {
&Settings::values.texture_filter);
ConfigurationShared::SetHighlight(ui->widget_texture_filter,
!Settings::values.texture_filter.UsingGlobal());
ConfigurationShared::SetPerGameSetting(ui->antialiasing_filter_combobox,
&Settings::values.antialiasing_filter);
ConfigurationShared::SetHighlight(ui->widget_antialiasing_filter,
!Settings::values.antialiasing_filter.UsingGlobal());
} else {
ui->resolution_factor_combobox->setCurrentIndex(
Settings::values.resolution_factor.GetValue());
ui->texture_filter_combobox->setCurrentIndex(
static_cast<int>(Settings::values.texture_filter.GetValue()));
ui->antialiasing_filter_combobox->setCurrentIndex(
static_cast<int>(Settings::values.antialiasing_filter.GetValue()));
}
ui->render_3d_combobox->setCurrentIndex(
@ -132,6 +138,8 @@ void ConfigureEnhancements::ApplyConfiguration() {
ui->use_integer_scaling, use_integer_scaling);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.texture_filter,
ui->texture_filter_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.antialiasing_filter,
ui->antialiasing_filter_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.dump_textures,
ui->toggle_dump_textures, dump_textures);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.custom_textures,
@ -150,6 +158,7 @@ void ConfigureEnhancements::SetupPerGameUI() {
if (Settings::IsConfiguringGlobal()) {
ui->widget_resolution->setEnabled(Settings::values.resolution_factor.UsingGlobal());
ui->widget_texture_filter->setEnabled(Settings::values.texture_filter.UsingGlobal());
ui->widget_antialiasing_filter->setEnabled(Settings::values.antialiasing_filter.UsingGlobal());
ui->toggle_linear_filter->setEnabled(Settings::values.filter_mode.UsingGlobal());
ui->use_integer_scaling->setEnabled(Settings::values.use_integer_scaling.UsingGlobal());
ui->toggle_dump_textures->setEnabled(Settings::values.dump_textures.UsingGlobal());
@ -192,4 +201,8 @@ void ConfigureEnhancements::SetupPerGameUI() {
ConfigurationShared::SetColoredComboBox(
ui->texture_filter_combobox, ui->widget_texture_filter,
static_cast<int>(Settings::values.texture_filter.GetValue(true)));
ConfigurationShared::SetColoredComboBox(
ui->antialiasing_filter_combobox, ui->widget_antialiasing_filter,
static_cast<int>(Settings::values.antialiasing_filter.GetValue(true)));
}

View file

@ -112,12 +112,12 @@
</item>
<item>
<widget class="QCheckBox" name="use_integer_scaling">
<property name="text">
<string>Use Integer Scaling</string>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use Integer Scaling&lt;/p&gt;&lt;p&gt;Enforces that the larger screen in all layouts is an integer scale of the 240px height of the original 3DS screen.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Use Integer Scaling</string>
</property>
</widget>
</item>
<item>
@ -127,6 +127,50 @@
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_antialiasing_filter" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_10">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="antialiasing_filter_label">
<property name="text">
<string>Anti-Aliasing</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="antialiasing_filter_combobox">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>FXAA</string>
</property>
</item>
<item>
<property name="text">
<string>SMAA</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_shader" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
@ -329,12 +373,12 @@
</item>
<item>
<widget class="QCheckBox" name="disable_right_eye_render">
<property name="text">
<string>Disable Right Eye Rendering</string>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Disable Right Eye Rendering&lt;/p&gt;&lt;p&gt;Disables rendering the right eye image when not using stereoscopic mode. Greatly improves performance in some applications, but can cause flickering in others.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Disable Right Eye Rendering</string>
</property>
</widget>
</item>
<item>
@ -399,7 +443,7 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -416,6 +460,7 @@
<tabstop>toggle_linear_filter</tabstop>
<tabstop>shader_combobox</tabstop>
<tabstop>texture_filter_combobox</tabstop>
<tabstop>antialiasing_filter_combobox</tabstop>
<tabstop>render_3d_combobox</tabstop>
<tabstop>factor_3d</tabstop>
<tabstop>mono_rendering_eye</tabstop>

View file

@ -57,6 +57,18 @@ std::string_view GetTextureFilterName(TextureFilter filter) {
}
}
std::string_view GetAntialiasingFilterName(AntiAliasingFilter filter) {
switch (filter) {
case AntiAliasingFilter::None:
return "None";
case AntiAliasingFilter::FXAA:
return "FXAA";
case AntiAliasingFilter::SMAA:
return "SMAA";
default:
return "Invalid";
}
}
std::string_view GetTextureSamplingName(TextureSampling sampling) {
switch (sampling) {
case TextureSampling::GameControlled:
@ -103,6 +115,7 @@ void LogSettings() {
log_setting("Renderer_PostProcessingShader", values.pp_shader_name.GetValue());
log_setting("Renderer_FilterMode", values.filter_mode.GetValue());
log_setting("Renderer_TextureFilter", GetTextureFilterName(values.texture_filter.GetValue()));
log_setting("Renderer_AntialiasingFilter", GetAntialiasingFilterName(values.antialiasing_filter.GetValue()));
log_setting("Renderer_TextureSampling",
GetTextureSamplingName(values.texture_sampling.GetValue()));
log_setting("Renderer_DelayGameRenderThreasUs", values.delay_game_render_thread_us.GetValue());
@ -213,6 +226,7 @@ void RestoreGlobalState(bool is_powered_on) {
values.use_integer_scaling.SetGlobal(true);
values.frame_limit.SetGlobal(true);
values.texture_filter.SetGlobal(true);
values.antialiasing_filter.SetGlobal(true);
values.texture_sampling.SetGlobal(true);
values.delay_game_render_thread_us.SetGlobal(true);
values.layout_option.SetGlobal(true);

View file

@ -112,6 +112,12 @@ enum class TextureFilter : u32 {
MMPX = 5,
};
enum class AntiAliasingFilter : u32 {
None = 0,
FXAA = 1,
SMAA = 2,
};
enum class TextureSampling : u32 {
GameControlled = 0,
NearestNeighbor = 1,
@ -538,6 +544,7 @@ struct Values {
SwitchableSetting<double, true> frame_limit{100, 0, 1000, Keys::frame_limit};
SwitchableSetting<double, true> turbo_limit{200, 0, 1000, Keys::turbo_limit};
SwitchableSetting<TextureFilter> texture_filter{TextureFilter::NoFilter, Keys::texture_filter};
SwitchableSetting<AntiAliasingFilter> antialiasing_filter{AntiAliasingFilter::None, Keys::antialiasing_filter};
SwitchableSetting<TextureSampling> texture_sampling{TextureSampling::GameControlled,
Keys::texture_sampling};
SwitchableSetting<u16, true> delay_game_render_thread_us{0, 0, 16000,

View file

@ -444,7 +444,7 @@ void RendererOpenGL::InitOpenGLObjects() {
screen_info.display_texture = screen_info.texture.resource.handle;
}
AllocatePPTextures();
state.texture_units[0].texture_2d = 0;
state.Apply();
}
@ -653,7 +653,7 @@ void RendererOpenGL::DrawSingleScreen(const ScreenInfo& screen_info, float scree
} else {
scalingMode = 0;
}
int antialiasingMode = 2; //0 is none, 1 is FXAA, 2 is SMAA
int antialiasingMode = static_cast<int>(Settings::values.antialiasing_filter.GetValue()); //0 is none, 1 is FXAA, 2 is SMAA
if (orientation == Layout::DisplayOrientation::Landscape || orientation == Layout::DisplayOrientation::LandscapeFlipped) {
if (textureWidth > screenWidth){
isDownsampling = true;