mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-06 02:33:44 -04:00
config: Refactor sample_count to antialiasing setting
Intended to allow for other anti-aliasing methods to be introduced
This commit is contained in:
parent
0cb1680a20
commit
29954c1392
9 changed files with 48 additions and 26 deletions
|
|
@ -44,6 +44,7 @@ foreach(KEY IN ITEMS
|
||||||
"use_display_refresh_rate_detection"
|
"use_display_refresh_rate_detection"
|
||||||
"use_shader_jit"
|
"use_shader_jit"
|
||||||
"resolution_factor"
|
"resolution_factor"
|
||||||
|
"antialiasing"
|
||||||
"frame_limit"
|
"frame_limit"
|
||||||
"turbo_limit"
|
"turbo_limit"
|
||||||
"texture_filter"
|
"texture_filter"
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ void Config::ReadValues() {
|
||||||
ReadSetting("Renderer", Settings::values.use_hw_shader);
|
ReadSetting("Renderer", Settings::values.use_hw_shader);
|
||||||
ReadSetting("Renderer", Settings::values.use_shader_jit);
|
ReadSetting("Renderer", Settings::values.use_shader_jit);
|
||||||
ReadSetting("Renderer", Settings::values.resolution_factor);
|
ReadSetting("Renderer", Settings::values.resolution_factor);
|
||||||
ReadSetting("Renderer", Settings::values.sample_count);
|
ReadSetting("Renderer", Settings::values.antialiasing);
|
||||||
ReadSetting("Renderer", Settings::values.use_disk_shader_cache);
|
ReadSetting("Renderer", Settings::values.use_disk_shader_cache);
|
||||||
ReadSetting("Renderer", Settings::values.use_vsync);
|
ReadSetting("Renderer", Settings::values.use_vsync);
|
||||||
ReadSetting("Renderer", Settings::values.texture_filter);
|
ReadSetting("Renderer", Settings::values.texture_filter);
|
||||||
|
|
|
||||||
|
|
@ -716,7 +716,7 @@ void QtConfig::ReadRendererValues() {
|
||||||
ReadGlobalSetting(Settings::values.use_vsync);
|
ReadGlobalSetting(Settings::values.use_vsync);
|
||||||
ReadGlobalSetting(Settings::values.use_display_refresh_rate_detection);
|
ReadGlobalSetting(Settings::values.use_display_refresh_rate_detection);
|
||||||
ReadGlobalSetting(Settings::values.resolution_factor);
|
ReadGlobalSetting(Settings::values.resolution_factor);
|
||||||
ReadGlobalSetting(Settings::values.sample_count);
|
ReadGlobalSetting(Settings::values.antialiasing);
|
||||||
ReadGlobalSetting(Settings::values.use_integer_scaling);
|
ReadGlobalSetting(Settings::values.use_integer_scaling);
|
||||||
ReadGlobalSetting(Settings::values.frame_limit);
|
ReadGlobalSetting(Settings::values.frame_limit);
|
||||||
ReadGlobalSetting(Settings::values.turbo_limit);
|
ReadGlobalSetting(Settings::values.turbo_limit);
|
||||||
|
|
@ -1266,7 +1266,7 @@ void QtConfig::SaveRendererValues() {
|
||||||
WriteGlobalSetting(Settings::values.use_vsync);
|
WriteGlobalSetting(Settings::values.use_vsync);
|
||||||
WriteGlobalSetting(Settings::values.use_display_refresh_rate_detection);
|
WriteGlobalSetting(Settings::values.use_display_refresh_rate_detection);
|
||||||
WriteGlobalSetting(Settings::values.resolution_factor);
|
WriteGlobalSetting(Settings::values.resolution_factor);
|
||||||
WriteGlobalSetting(Settings::values.sample_count);
|
WriteGlobalSetting(Settings::values.antialiasing);
|
||||||
WriteGlobalSetting(Settings::values.use_integer_scaling);
|
WriteGlobalSetting(Settings::values.use_integer_scaling);
|
||||||
WriteGlobalSetting(Settings::values.frame_limit);
|
WriteGlobalSetting(Settings::values.frame_limit);
|
||||||
WriteGlobalSetting(Settings::values.turbo_limit);
|
WriteGlobalSetting(Settings::values.turbo_limit);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ ConfigureEnhancements::ConfigureEnhancements(QWidget* parent)
|
||||||
const bool res_scale_enabled = graphics_api != Settings::GraphicsAPI::Software;
|
const bool res_scale_enabled = graphics_api != Settings::GraphicsAPI::Software;
|
||||||
ui->resolution_factor_combobox->setEnabled(res_scale_enabled);
|
ui->resolution_factor_combobox->setEnabled(res_scale_enabled);
|
||||||
const bool msaa_enabled = graphics_api == Settings::GraphicsAPI::Vulkan;
|
const bool msaa_enabled = graphics_api == Settings::GraphicsAPI::Vulkan;
|
||||||
ui->sample_count_combobox->setEnabled(msaa_enabled);
|
ui->antialiasing_combobox->setEnabled(msaa_enabled);
|
||||||
|
|
||||||
connect(ui->render_3d_combobox, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
connect(ui->render_3d_combobox, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||||
[this](int currentIndex) {
|
[this](int currentIndex) {
|
||||||
|
|
@ -46,8 +46,8 @@ void ConfigureEnhancements::SetConfiguration() {
|
||||||
if (!Settings::IsConfiguringGlobal()) {
|
if (!Settings::IsConfiguringGlobal()) {
|
||||||
ConfigurationShared::SetPerGameSetting(ui->resolution_factor_combobox,
|
ConfigurationShared::SetPerGameSetting(ui->resolution_factor_combobox,
|
||||||
&Settings::values.resolution_factor);
|
&Settings::values.resolution_factor);
|
||||||
ConfigurationShared::SetPerGameSetting(ui->sample_count_combobox,
|
ConfigurationShared::SetPerGameSetting(ui->antialiasing_combobox,
|
||||||
&Settings::values.sample_count);
|
&Settings::values.antialiasing);
|
||||||
ConfigurationShared::SetPerGameSetting(ui->texture_filter_combobox,
|
ConfigurationShared::SetPerGameSetting(ui->texture_filter_combobox,
|
||||||
&Settings::values.texture_filter);
|
&Settings::values.texture_filter);
|
||||||
ConfigurationShared::SetHighlight(ui->widget_texture_filter,
|
ConfigurationShared::SetHighlight(ui->widget_texture_filter,
|
||||||
|
|
@ -55,8 +55,8 @@ void ConfigureEnhancements::SetConfiguration() {
|
||||||
} else {
|
} else {
|
||||||
ui->resolution_factor_combobox->setCurrentIndex(
|
ui->resolution_factor_combobox->setCurrentIndex(
|
||||||
Settings::values.resolution_factor.GetValue());
|
Settings::values.resolution_factor.GetValue());
|
||||||
ui->sample_count_combobox->setCurrentIndex(
|
ui->antialiasing_combobox->setCurrentIndex(
|
||||||
static_cast<int>(Settings::values.sample_count.GetValue()));
|
static_cast<int>(Settings::values.antialiasing.GetValue()));
|
||||||
ui->texture_filter_combobox->setCurrentIndex(
|
ui->texture_filter_combobox->setCurrentIndex(
|
||||||
static_cast<int>(Settings::values.texture_filter.GetValue()));
|
static_cast<int>(Settings::values.texture_filter.GetValue()));
|
||||||
}
|
}
|
||||||
|
|
@ -117,8 +117,8 @@ void ConfigureEnhancements::RetranslateUI() {
|
||||||
void ConfigureEnhancements::ApplyConfiguration() {
|
void ConfigureEnhancements::ApplyConfiguration() {
|
||||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.resolution_factor,
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.resolution_factor,
|
||||||
ui->resolution_factor_combobox);
|
ui->resolution_factor_combobox);
|
||||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.sample_count,
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.antialiasing,
|
||||||
ui->sample_count_combobox);
|
ui->antialiasing_combobox);
|
||||||
Settings::values.render_3d =
|
Settings::values.render_3d =
|
||||||
static_cast<Settings::StereoRenderOption>(ui->render_3d_combobox->currentIndex());
|
static_cast<Settings::StereoRenderOption>(ui->render_3d_combobox->currentIndex());
|
||||||
Settings::values.swap_eyes_3d = ui->swap_eyes_3d->isChecked();
|
Settings::values.swap_eyes_3d = ui->swap_eyes_3d->isChecked();
|
||||||
|
|
@ -157,7 +157,7 @@ void ConfigureEnhancements::SetupPerGameUI() {
|
||||||
// Block the global settings if a game is currently running that overrides them
|
// Block the global settings if a game is currently running that overrides them
|
||||||
if (Settings::IsConfiguringGlobal()) {
|
if (Settings::IsConfiguringGlobal()) {
|
||||||
ui->widget_resolution->setEnabled(Settings::values.resolution_factor.UsingGlobal());
|
ui->widget_resolution->setEnabled(Settings::values.resolution_factor.UsingGlobal());
|
||||||
ui->widget_sample_count->setEnabled(Settings::values.sample_count.UsingGlobal());
|
ui->widget_antialiasing->setEnabled(Settings::values.antialiasing.UsingGlobal());
|
||||||
ui->widget_texture_filter->setEnabled(Settings::values.texture_filter.UsingGlobal());
|
ui->widget_texture_filter->setEnabled(Settings::values.texture_filter.UsingGlobal());
|
||||||
ui->toggle_linear_filter->setEnabled(Settings::values.filter_mode.UsingGlobal());
|
ui->toggle_linear_filter->setEnabled(Settings::values.filter_mode.UsingGlobal());
|
||||||
ui->use_integer_scaling->setEnabled(Settings::values.use_integer_scaling.UsingGlobal());
|
ui->use_integer_scaling->setEnabled(Settings::values.use_integer_scaling.UsingGlobal());
|
||||||
|
|
@ -199,8 +199,8 @@ void ConfigureEnhancements::SetupPerGameUI() {
|
||||||
static_cast<int>(Settings::values.resolution_factor.GetValue(true)));
|
static_cast<int>(Settings::values.resolution_factor.GetValue(true)));
|
||||||
|
|
||||||
ConfigurationShared::SetColoredComboBox(
|
ConfigurationShared::SetColoredComboBox(
|
||||||
ui->sample_count_combobox, ui->widget_sample_count,
|
ui->antialiasing_combobox, ui->widget_antialiasing,
|
||||||
static_cast<int>(Settings::values.sample_count.GetValue(true)));
|
static_cast<int>(Settings::values.antialiasing.GetValue(true)));
|
||||||
|
|
||||||
ConfigurationShared::SetColoredComboBox(
|
ConfigurationShared::SetColoredComboBox(
|
||||||
ui->texture_filter_combobox, ui->widget_texture_filter,
|
ui->texture_filter_combobox, ui->widget_texture_filter,
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget_sample_count" native="true">
|
<widget class="QWidget" name="widget_antialiasing" native="true">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
|
|
@ -126,32 +126,32 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="sample_count_label">
|
<widget class="QLabel" name="antialiasing_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sample count</string>
|
<string>Anti-Aliasing</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="sample_count_combobox">
|
<widget class="QComboBox" name="antialiasing_combobox">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Native (x1)</string>
|
<string>None</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>x2</string>
|
<string>MSAAx2</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>x4</string>
|
<string>MSAAx4</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>x8</string>
|
<string>MSAAx8</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ void LogSettings() {
|
||||||
log_setting("Renderer_ShadersAccurateMul", values.shaders_accurate_mul.GetValue());
|
log_setting("Renderer_ShadersAccurateMul", values.shaders_accurate_mul.GetValue());
|
||||||
log_setting("Renderer_UseShaderJit", values.use_shader_jit.GetValue());
|
log_setting("Renderer_UseShaderJit", values.use_shader_jit.GetValue());
|
||||||
log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue());
|
log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue());
|
||||||
log_setting("Renderer_SampleCount", values.sample_count.GetValue());
|
log_setting("Renderer_SampleCount", values.antialiasing.GetValue());
|
||||||
log_setting("Renderer_UseIntegerScaling", values.use_integer_scaling.GetValue());
|
log_setting("Renderer_UseIntegerScaling", values.use_integer_scaling.GetValue());
|
||||||
log_setting("Renderer_FrameLimit", values.frame_limit.GetValue());
|
log_setting("Renderer_FrameLimit", values.frame_limit.GetValue());
|
||||||
log_setting("Renderer_VSyncNew", values.use_vsync.GetValue());
|
log_setting("Renderer_VSyncNew", values.use_vsync.GetValue());
|
||||||
|
|
@ -214,7 +214,7 @@ void RestoreGlobalState(bool is_powered_on) {
|
||||||
values.shaders_accurate_mul.SetGlobal(true);
|
values.shaders_accurate_mul.SetGlobal(true);
|
||||||
values.use_vsync.SetGlobal(true);
|
values.use_vsync.SetGlobal(true);
|
||||||
values.resolution_factor.SetGlobal(true);
|
values.resolution_factor.SetGlobal(true);
|
||||||
values.sample_count.SetGlobal(true);
|
values.antialiasing.SetGlobal(true);
|
||||||
values.use_integer_scaling.SetGlobal(true);
|
values.use_integer_scaling.SetGlobal(true);
|
||||||
values.frame_limit.SetGlobal(true);
|
values.frame_limit.SetGlobal(true);
|
||||||
values.texture_filter.SetGlobal(true);
|
values.texture_filter.SetGlobal(true);
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,26 @@ enum class AudioEmulation : u32 {
|
||||||
LLEMultithreaded = 2,
|
LLEMultithreaded = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class AntiAliasingMethod : u32 {
|
||||||
|
None = 0,
|
||||||
|
MSAAx2 = 1,
|
||||||
|
MSAAx4 = 2,
|
||||||
|
MSAAx8 = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline u8 GetAntiAliasingSampleCount(AntiAliasingMethod antialiasing_method) {
|
||||||
|
switch (antialiasing_method) {
|
||||||
|
case AntiAliasingMethod::MSAAx2:
|
||||||
|
return 2;
|
||||||
|
case AntiAliasingMethod::MSAAx4:
|
||||||
|
return 4;
|
||||||
|
case AntiAliasingMethod::MSAAx8:
|
||||||
|
return 8;
|
||||||
|
default:
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
enum class TextureFilter : u32 {
|
enum class TextureFilter : u32 {
|
||||||
NoFilter = 0,
|
NoFilter = 0,
|
||||||
Anime4K = 1,
|
Anime4K = 1,
|
||||||
|
|
@ -535,7 +555,7 @@ struct Values {
|
||||||
true, Keys::use_display_refresh_rate_detection};
|
true, Keys::use_display_refresh_rate_detection};
|
||||||
Setting<bool> use_shader_jit{true, Keys::use_shader_jit};
|
Setting<bool> use_shader_jit{true, Keys::use_shader_jit};
|
||||||
SwitchableSetting<u32, true> resolution_factor{1, 0, 10, Keys::resolution_factor};
|
SwitchableSetting<u32, true> resolution_factor{1, 0, 10, Keys::resolution_factor};
|
||||||
SwitchableSetting<u16, true> sample_count{0, 0, 3, "sample_count"};
|
SwitchableSetting<AntiAliasingMethod> antialiasing{AntiAliasingMethod::None, "antialiasing"};
|
||||||
SwitchableSetting<bool> use_integer_scaling{false, Keys::use_integer_scaling};
|
SwitchableSetting<bool> use_integer_scaling{false, Keys::use_integer_scaling};
|
||||||
SwitchableSetting<double, true> frame_limit{100, 0, 1000, Keys::frame_limit};
|
SwitchableSetting<double, true> frame_limit{100, 0, 1000, Keys::frame_limit};
|
||||||
SwitchableSetting<double, true> turbo_limit{200, 0, 1000, Keys::turbo_limit};
|
SwitchableSetting<double, true> turbo_limit{200, 0, 1000, Keys::turbo_limit};
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ u8 RendererBase::GetSampleCount() const {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return static_cast<u8>(1u << Settings::values.sample_count.GetValue());
|
return Settings::GetAntiAliasingSampleCount(Settings::values.antialiasing.GetValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererBase::UpdateCurrentFramebufferLayout(bool is_portrait_mode) {
|
void RendererBase::UpdateCurrentFramebufferLayout(bool is_portrait_mode) {
|
||||||
|
|
|
||||||
|
|
@ -778,7 +778,8 @@ bool RasterizerVulkan::AccelerateDisplay(const Pica::FramebufferConfig& config,
|
||||||
src_params.stride = pixel_stride;
|
src_params.stride = pixel_stride;
|
||||||
src_params.is_tiled = false;
|
src_params.is_tiled = false;
|
||||||
src_params.pixel_format = VideoCore::PixelFormatFromGPUPixelFormat(config.color_format);
|
src_params.pixel_format = VideoCore::PixelFormatFromGPUPixelFormat(config.color_format);
|
||||||
src_params.sample_count = (1u << Settings::values.sample_count.GetValue());
|
src_params.sample_count =
|
||||||
|
Settings::GetAntiAliasingSampleCount(Settings::values.antialiasing.GetValue());
|
||||||
src_params.UpdateParams();
|
src_params.UpdateParams();
|
||||||
|
|
||||||
const auto [src_surface_id, src_rect] =
|
const auto [src_surface_id, src_rect] =
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue