From f209e976f4887f399250c558ac725bc5723eec38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Locatti?= Date: Sat, 19 Nov 2022 21:04:04 -0300 Subject: FSR Sharpening Slider part 1 - only a global slider --- src/common/settings.cpp | 1 + src/common/settings.h | 1 + src/video_core/renderer_vulkan/vk_fsr.cpp | 6 +- src/yuzu/configuration/config.cpp | 5 ++ src/yuzu/configuration/configure_graphics.cpp | 12 +++ src/yuzu/configuration/configure_graphics.h | 2 + src/yuzu/configuration/configure_graphics.ui | 105 ++++++++++++++++++++++++++ src/yuzu_cmd/config.cpp | 1 + 8 files changed, 132 insertions(+), 1 deletion(-) diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 8173462cb..926268ffc 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -48,6 +48,7 @@ void LogSettings() { log_setting("CPU_Accuracy", values.cpu_accuracy.GetValue()); log_setting("Renderer_UseResolutionScaling", values.resolution_setup.GetValue()); log_setting("Renderer_ScalingFilter", values.scaling_filter.GetValue()); + log_setting("Renderer_FSRSlider", values.fsr_sharpening_slider.GetValue()); log_setting("Renderer_AntiAliasing", values.anti_aliasing.GetValue()); log_setting("Renderer_UseSpeedLimit", values.use_speed_limit.GetValue()); log_setting("Renderer_SpeedLimit", values.speed_limit.GetValue()); diff --git a/src/common/settings.h b/src/common/settings.h index 0eb98939c..31d195548 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -421,6 +421,7 @@ struct Values { ResolutionScalingInfo resolution_info{}; SwitchableSetting resolution_setup{ResolutionSetup::Res1X, "resolution_setup"}; SwitchableSetting scaling_filter{ScalingFilter::Bilinear, "scaling_filter"}; + SwitchableSetting fsr_sharpening_slider{25, 0, 200, "fsr_sharpening_slider"}; SwitchableSetting anti_aliasing{AntiAliasing::None, "anti_aliasing"}; // *nix platforms may have issues with the borderless windowed fullscreen mode. // Default to exclusive fullscreen on these platforms for now. diff --git a/src/video_core/renderer_vulkan/vk_fsr.cpp b/src/video_core/renderer_vulkan/vk_fsr.cpp index dd450169e..33daa8c1c 100644 --- a/src/video_core/renderer_vulkan/vk_fsr.cpp +++ b/src/video_core/renderer_vulkan/vk_fsr.cpp @@ -5,6 +5,7 @@ #include "common/bit_cast.h" #include "common/common_types.h" #include "common/div_ceil.h" +#include "common/settings.h" #include "video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp16_comp_spv.h" #include "video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp32_comp_spv.h" @@ -227,7 +228,10 @@ VkImageView FSR::Draw(Scheduler& scheduler, size_t image_index, VkImageView imag cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_COMPUTE, *rcas_pipeline); - FsrRcasCon(push_constants.data(), 0.25f); + const float sharpening = + static_cast(Settings::values.fsr_sharpening_slider.GetValue()) / 100.0f; + + FsrRcasCon(push_constants.data(), sharpening); cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_COMPUTE_BIT, push_constants); { diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 343f3b8e5..0c93df428 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -672,6 +672,7 @@ void Config::ReadRendererValues() { ReadGlobalSetting(Settings::values.aspect_ratio); ReadGlobalSetting(Settings::values.resolution_setup); ReadGlobalSetting(Settings::values.scaling_filter); + ReadGlobalSetting(Settings::values.fsr_sharpening_slider); ReadGlobalSetting(Settings::values.anti_aliasing); ReadGlobalSetting(Settings::values.max_anisotropy); ReadGlobalSetting(Settings::values.use_speed_limit); @@ -1282,6 +1283,10 @@ void Config::SaveRendererValues() { static_cast(Settings::values.scaling_filter.GetValue(global)), static_cast(Settings::values.scaling_filter.GetDefault()), Settings::values.scaling_filter.UsingGlobal()); + WriteSetting(QString::fromStdString(Settings::values.fsr_sharpening_slider.GetLabel()), + static_cast(Settings::values.fsr_sharpening_slider.GetValue(global)), + static_cast(Settings::values.fsr_sharpening_slider.GetDefault()), + Settings::values.fsr_sharpening_slider.UsingGlobal()); WriteSetting(QString::fromStdString(Settings::values.anti_aliasing.GetLabel()), static_cast(Settings::values.anti_aliasing.GetValue(global)), static_cast(Settings::values.anti_aliasing.GetDefault()), diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index bd69d04a6..3a40872ab 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -63,6 +63,9 @@ ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* paren ui->api_widget->isEnabled()); ui->bg_label->setVisible(Settings::IsConfiguringGlobal()); ui->bg_combobox->setVisible(!Settings::IsConfiguringGlobal()); + + connect(ui->fsr_sharpening_slider, &QSlider::valueChanged, this, + &ConfigureGraphics::SetFSRIndicatorText); } void ConfigureGraphics::UpdateDeviceSelection(int device) { @@ -110,6 +113,7 @@ void ConfigureGraphics::SetConfiguration() { static_cast(Settings::values.resolution_setup.GetValue())); ui->scaling_filter_combobox->setCurrentIndex( static_cast(Settings::values.scaling_filter.GetValue())); + ui->fsr_sharpening_slider->setValue(Settings::values.fsr_sharpening_slider.GetValue()); ui->anti_aliasing_combobox->setCurrentIndex( static_cast(Settings::values.anti_aliasing.GetValue())); } else { @@ -155,6 +159,12 @@ void ConfigureGraphics::SetConfiguration() { Settings::values.bg_green.GetValue(), Settings::values.bg_blue.GetValue())); UpdateAPILayout(); + SetFSRIndicatorText(ui->fsr_sharpening_slider->sliderPosition()); +} + +void ConfigureGraphics::SetFSRIndicatorText(int percentage) { + ui->fsr_sharpening_value->setText( + tr("%1%", "FSR sharpening percentage (e.g. 50%)").arg(100 - (percentage / 2))); } void ConfigureGraphics::ApplyConfiguration() { @@ -210,6 +220,7 @@ void ConfigureGraphics::ApplyConfiguration() { if (Settings::values.anti_aliasing.UsingGlobal()) { Settings::values.anti_aliasing.SetValue(anti_aliasing); } + Settings::values.fsr_sharpening_slider.SetValue(ui->fsr_sharpening_slider->value()); } else { if (ui->resolution_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { Settings::values.resolution_setup.SetGlobal(true); @@ -380,6 +391,7 @@ void ConfigureGraphics::SetupPerGameUI() { ui->aspect_ratio_combobox->setEnabled(Settings::values.aspect_ratio.UsingGlobal()); ui->resolution_combobox->setEnabled(Settings::values.resolution_setup.UsingGlobal()); ui->scaling_filter_combobox->setEnabled(Settings::values.scaling_filter.UsingGlobal()); + ui->fsr_sharpening_slider->setEnabled(Settings::values.fsr_sharpening_slider.UsingGlobal()); ui->anti_aliasing_combobox->setEnabled(Settings::values.anti_aliasing.UsingGlobal()); ui->use_asynchronous_gpu_emulation->setEnabled( Settings::values.use_asynchronous_gpu_emulation.UsingGlobal()); diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index 70034eb1b..d98d6624e 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h @@ -42,6 +42,8 @@ private: void RetrieveVulkanDevices(); + void SetFSRIndicatorText(int percentage); + void SetupPerGameUI(); Settings::RendererBackend GetCurrentGraphicsBackend() const; diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index fdbb33372..de8b2f44e 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui @@ -152,6 +152,12 @@ + + + 16777215 + 16777215 + + Graphics Settings @@ -481,6 +487,105 @@ + + + + true + + + + 0 + 0 + + + + + 6 + + + QLayout::SetDefaultConstraint + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + FSR Sharpening: + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + 200 + + + 25 + + + Qt::Horizontal + + + true + + + + + + + + 0 + 0 + + + + + 32 + 0 + + + + 100% + + + Qt::AlignCenter + + + + + fsr_sharpening_value + fsr_sharpening_label + fsr_sharpening_slider + + diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 66dd0dc15..d6bea9aa8 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -299,6 +299,7 @@ void Config::ReadValues() { ReadSetting("Renderer", Settings::values.resolution_setup); ReadSetting("Renderer", Settings::values.scaling_filter); + ReadSetting("Renderer", Settings::values.fsr_sharpening_slider); ReadSetting("Renderer", Settings::values.anti_aliasing); ReadSetting("Renderer", Settings::values.fullscreen_mode); ReadSetting("Renderer", Settings::values.aspect_ratio); -- cgit v1.2.3 From b670c350e48f6c974064f3019c171d2b6dbb2d9a Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Fri, 25 Nov 2022 22:42:24 -0500 Subject: settings: Reset FSR sharpening global state with the others --- src/common/settings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 926268ffc..d8ffe34c3 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -182,6 +182,7 @@ void RestoreGlobalState(bool is_powered_on) { values.cpuopt_unsafe_ignore_global_monitor.SetGlobal(true); // Renderer + values.fsr_sharpening_slider.SetGlobal(true); values.renderer_backend.SetGlobal(true); values.vulkan_device.SetGlobal(true); values.aspect_ratio.SetGlobal(true); -- cgit v1.2.3 From 19a640286c89fdf95c5e90dd9132a124d69281f3 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Fri, 25 Nov 2022 22:42:54 -0500 Subject: configure_graphics: Implement custom FSR Sharpening setting --- src/yuzu/configuration/configure_graphics.cpp | 26 ++++ src/yuzu/configuration/configure_graphics.ui | 163 ++++++++++++++++---------- 2 files changed, 128 insertions(+), 61 deletions(-) diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 3a40872ab..f1385e972 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -66,6 +66,8 @@ ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* paren connect(ui->fsr_sharpening_slider, &QSlider::valueChanged, this, &ConfigureGraphics::SetFSRIndicatorText); + ui->fsr_sharpening_combobox->setVisible(!Settings::IsConfiguringGlobal()); + ui->fsr_sharpening_label->setVisible(Settings::IsConfiguringGlobal()); } void ConfigureGraphics::UpdateDeviceSelection(int device) { @@ -151,6 +153,15 @@ void ConfigureGraphics::SetConfiguration() { ConfigurationShared::SetHighlight(ui->anti_aliasing_label, !Settings::values.anti_aliasing.UsingGlobal()); + ui->fsr_sharpening_combobox->setCurrentIndex( + Settings::values.fsr_sharpening_slider.UsingGlobal() ? 0 : 1); + ui->fsr_sharpening_slider->setEnabled( + !Settings::values.fsr_sharpening_slider.UsingGlobal()); + ui->fsr_sharpening_value->setEnabled(!Settings::values.fsr_sharpening_slider.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->fsr_sharpening_layout, + !Settings::values.fsr_sharpening_slider.UsingGlobal()); + ui->fsr_sharpening_slider->setValue(Settings::values.fsr_sharpening_slider.GetValue()); + ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1); ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal()); ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal()); @@ -280,6 +291,13 @@ void ConfigureGraphics::ApplyConfiguration() { Settings::values.bg_green.SetValue(static_cast(bg_color.green())); Settings::values.bg_blue.SetValue(static_cast(bg_color.blue())); } + + if (ui->fsr_sharpening_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { + Settings::values.fsr_sharpening_slider.SetGlobal(true); + } else { + Settings::values.fsr_sharpening_slider.SetGlobal(false); + Settings::values.fsr_sharpening_slider.SetValue(ui->fsr_sharpening_slider->value()); + } } } @@ -399,6 +417,7 @@ void ConfigureGraphics::SetupPerGameUI() { ui->accelerate_astc->setEnabled(Settings::values.accelerate_astc.UsingGlobal()); ui->use_disk_shader_cache->setEnabled(Settings::values.use_disk_shader_cache.UsingGlobal()); ui->bg_button->setEnabled(Settings::values.bg_red.UsingGlobal()); + ui->fsr_slider_layout->setEnabled(Settings::values.fsr_sharpening_slider.UsingGlobal()); return; } @@ -408,6 +427,13 @@ void ConfigureGraphics::SetupPerGameUI() { ConfigurationShared::SetHighlight(ui->bg_layout, index == 1); }); + connect(ui->fsr_sharpening_combobox, qOverload(&QComboBox::activated), this, + [this](int index) { + ui->fsr_sharpening_slider->setEnabled(index == 1); + ui->fsr_sharpening_value->setEnabled(index == 1); + ConfigurationShared::SetHighlight(ui->fsr_sharpening_layout, index == 1); + }); + ConfigurationShared::SetColoredTristate( ui->use_disk_shader_cache, Settings::values.use_disk_shader_cache, use_disk_shader_cache); ConfigurationShared::SetColoredTristate(ui->accelerate_astc, Settings::values.accelerate_astc, diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index de8b2f44e..1f8c84394 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui @@ -517,73 +517,114 @@ 0 - - - - - 0 - 0 - - - - FSR Sharpening: - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - 200 - - - 25 - - - Qt::Horizontal - - - true - - + + + + + + 0 + 0 + + + + + Use global FSR Sharpening + + + + + Set FSR Sharpening + + + + + + + + + 0 + 0 + + + + FSR Sharpening: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - 0 - 0 - - - - - 32 - 0 - - - - 100% + + + 6 - - Qt::AlignCenter - - + + + + + 0 + 0 + + + + + 0 + 0 + + + + 200 + + + 25 + + + Qt::Horizontal + + + true + + + + + + + + 0 + 0 + + + + + 32 + 0 + + + + 100% + + + Qt::AlignCenter + + + + - fsr_sharpening_value - fsr_sharpening_label - fsr_sharpening_slider -- cgit v1.2.3 From 972bd6cb5427d5c05d9482aa1f0bc76bea6715af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Locatti?= <42481638+goldenx86@users.noreply.github.com> Date: Sat, 26 Nov 2022 02:14:10 -0300 Subject: Sharpness instead of Sharpening --- src/yuzu/configuration/configure_graphics.ui | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index 1f8c84394..37271f956 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui @@ -529,12 +529,12 @@ - Use global FSR Sharpening + Use global FSR Sharpness - Set FSR Sharpening + Set FSR Sharpness @@ -548,7 +548,7 @@ - FSR Sharpening: + FSR Sharpness: -- cgit v1.2.3