config: Add sample_count renderer option

Option is only enabled when the renderer is set to Vulkan, for now.
This commit is contained in:
Wunkolo 2026-04-18 20:41:43 -07:00
parent 379649dbce
commit faf61b898a
8 changed files with 89 additions and 7 deletions

View file

@ -150,6 +150,7 @@ void Config::ReadValues() {
ReadSetting("Renderer", Settings::values.use_hw_shader);
ReadSetting("Renderer", Settings::values.use_shader_jit);
ReadSetting("Renderer", Settings::values.resolution_factor);
ReadSetting("Renderer", Settings::values.sample_count);
ReadSetting("Renderer", Settings::values.use_disk_shader_cache);
ReadSetting("Renderer", Settings::values.use_vsync);
ReadSetting("Renderer", Settings::values.texture_filter);

View file

@ -716,6 +716,7 @@ void QtConfig::ReadRendererValues() {
ReadGlobalSetting(Settings::values.use_vsync);
ReadGlobalSetting(Settings::values.use_display_refresh_rate_detection);
ReadGlobalSetting(Settings::values.resolution_factor);
ReadGlobalSetting(Settings::values.sample_count);
ReadGlobalSetting(Settings::values.use_integer_scaling);
ReadGlobalSetting(Settings::values.frame_limit);
ReadGlobalSetting(Settings::values.turbo_limit);
@ -1265,6 +1266,7 @@ void QtConfig::SaveRendererValues() {
WriteGlobalSetting(Settings::values.use_vsync);
WriteGlobalSetting(Settings::values.use_display_refresh_rate_detection);
WriteGlobalSetting(Settings::values.resolution_factor);
WriteGlobalSetting(Settings::values.sample_count);
WriteGlobalSetting(Settings::values.use_integer_scaling);
WriteGlobalSetting(Settings::values.frame_limit);
WriteGlobalSetting(Settings::values.turbo_limit);

View file

@ -21,6 +21,8 @@ ConfigureEnhancements::ConfigureEnhancements(QWidget* parent)
const auto graphics_api = Settings::values.graphics_api.GetValue();
const bool res_scale_enabled = graphics_api != Settings::GraphicsAPI::Software;
ui->resolution_factor_combobox->setEnabled(res_scale_enabled);
const bool msaa_enabled = graphics_api == Settings::GraphicsAPI::Vulkan;
ui->sample_count_combobox->setEnabled(msaa_enabled);
connect(ui->render_3d_combobox, qOverload<int>(&QComboBox::currentIndexChanged), this,
[this](int currentIndex) {
@ -44,6 +46,8 @@ void ConfigureEnhancements::SetConfiguration() {
if (!Settings::IsConfiguringGlobal()) {
ConfigurationShared::SetPerGameSetting(ui->resolution_factor_combobox,
&Settings::values.resolution_factor);
ConfigurationShared::SetPerGameSetting(ui->sample_count_combobox,
&Settings::values.sample_count);
ConfigurationShared::SetPerGameSetting(ui->texture_filter_combobox,
&Settings::values.texture_filter);
ConfigurationShared::SetHighlight(ui->widget_texture_filter,
@ -51,6 +55,8 @@ void ConfigureEnhancements::SetConfiguration() {
} else {
ui->resolution_factor_combobox->setCurrentIndex(
Settings::values.resolution_factor.GetValue());
ui->sample_count_combobox->setCurrentIndex(
static_cast<int>(Settings::values.sample_count.GetValue()));
ui->texture_filter_combobox->setCurrentIndex(
static_cast<int>(Settings::values.texture_filter.GetValue()));
}
@ -111,6 +117,8 @@ void ConfigureEnhancements::RetranslateUI() {
void ConfigureEnhancements::ApplyConfiguration() {
ConfigurationShared::ApplyPerGameSetting(&Settings::values.resolution_factor,
ui->resolution_factor_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.sample_count,
ui->sample_count_combobox);
Settings::values.render_3d =
static_cast<Settings::StereoRenderOption>(ui->render_3d_combobox->currentIndex());
Settings::values.swap_eyes_3d = ui->swap_eyes_3d->isChecked();
@ -149,6 +157,7 @@ void ConfigureEnhancements::SetupPerGameUI() {
// Block the global settings if a game is currently running that overrides them
if (Settings::IsConfiguringGlobal()) {
ui->widget_resolution->setEnabled(Settings::values.resolution_factor.UsingGlobal());
ui->widget_sample_count->setEnabled(Settings::values.sample_count.UsingGlobal());
ui->widget_texture_filter->setEnabled(Settings::values.texture_filter.UsingGlobal());
ui->toggle_linear_filter->setEnabled(Settings::values.filter_mode.UsingGlobal());
ui->use_integer_scaling->setEnabled(Settings::values.use_integer_scaling.UsingGlobal());
@ -189,6 +198,10 @@ void ConfigureEnhancements::SetupPerGameUI() {
ui->resolution_factor_combobox, ui->widget_resolution,
static_cast<int>(Settings::values.resolution_factor.GetValue(true)));
ConfigurationShared::SetColoredComboBox(
ui->sample_count_combobox, ui->widget_sample_count,
static_cast<int>(Settings::values.sample_count.GetValue(true)));
ConfigurationShared::SetColoredComboBox(
ui->texture_filter_combobox, ui->widget_texture_filter,
static_cast<int>(Settings::values.texture_filter.GetValue(true)));

View file

@ -111,15 +111,64 @@
</widget>
</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>
<widget class="QWidget" name="widget_sample_count" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<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="sample_count_label">
<property name="text">
<string>Sample count</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="sample_count_combobox">
<item>
<property name="text">
<string>Native (x1)</string>
</property>
</item>
<item>
<property name="text">
<string>x2</string>
</property>
</item>
<item>
<property name="text">
<string>x4</string>
</property>
</item>
<item>
<property name="text">
<string>x8</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</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>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toggle_linear_filter">
<property name="text">

View file

@ -97,6 +97,7 @@ void LogSettings() {
log_setting("Renderer_ShadersAccurateMul", values.shaders_accurate_mul.GetValue());
log_setting("Renderer_UseShaderJit", values.use_shader_jit.GetValue());
log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue());
log_setting("Renderer_SampleCount", values.sample_count.GetValue());
log_setting("Renderer_UseIntegerScaling", values.use_integer_scaling.GetValue());
log_setting("Renderer_FrameLimit", values.frame_limit.GetValue());
log_setting("Renderer_VSyncNew", values.use_vsync.GetValue());
@ -213,6 +214,7 @@ void RestoreGlobalState(bool is_powered_on) {
values.shaders_accurate_mul.SetGlobal(true);
values.use_vsync.SetGlobal(true);
values.resolution_factor.SetGlobal(true);
values.sample_count.SetGlobal(true);
values.use_integer_scaling.SetGlobal(true);
values.frame_limit.SetGlobal(true);
values.texture_filter.SetGlobal(true);

View file

@ -535,6 +535,7 @@ struct Values {
true, Keys::use_display_refresh_rate_detection};
Setting<bool> use_shader_jit{true, Keys::use_shader_jit};
SwitchableSetting<u32, true> resolution_factor{1, 0, 10, Keys::resolution_factor};
SwitchableSetting<u16, true> sample_count{0, 0, 3, "sample_count"};
SwitchableSetting<bool> use_integer_scaling{false, Keys::use_integer_scaling};
SwitchableSetting<double, true> frame_limit{100, 0, 1000, Keys::frame_limit};
SwitchableSetting<double, true> turbo_limit{200, 0, 1000, Keys::turbo_limit};

View file

@ -29,6 +29,17 @@ u32 RendererBase::GetResolutionScaleFactor() {
: render_window.GetFramebufferLayout().GetScalingRatio();
}
u8 RendererBase::GetSampleCount() const {
const auto graphics_api = Settings::values.graphics_api.GetValue();
// Enabled for vulkan only for now
if (graphics_api != Settings::GraphicsAPI::Vulkan) {
return 1;
}
return static_cast<u8>(1u << Settings::values.sample_count.GetValue());
}
void RendererBase::UpdateCurrentFramebufferLayout(bool is_portrait_mode) {
const auto update_layout = [is_portrait_mode](Frontend::EmuWindow& window) {
const Layout::FramebufferLayout& layout = window.GetFramebufferLayout();

View file

@ -67,6 +67,9 @@ public:
/// Returns the resolution scale factor relative to the native 3DS screen resolution
u32 GetResolutionScaleFactor();
/// Returns the MSAA sample count
u8 GetSampleCount() const;
/// Updates the framebuffer layout of the contained render window handle.
void UpdateCurrentFramebufferLayout(bool is_portrait_mode = {});