yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

Merge pull request #9276 from goldenx86/fsrSlider

FSR Sharpening Slider
This commit is contained in:
bunnei 2022-11-27 00:13:15 -08:00 committed by GitHub
commit 3ab8d9ac7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 200 additions and 1 deletions

View File

@ -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());
@ -181,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);

View File

@ -421,6 +421,7 @@ struct Values {
ResolutionScalingInfo resolution_info{};
SwitchableSetting<ResolutionSetup> resolution_setup{ResolutionSetup::Res1X, "resolution_setup"};
SwitchableSetting<ScalingFilter> scaling_filter{ScalingFilter::Bilinear, "scaling_filter"};
SwitchableSetting<int, true> fsr_sharpening_slider{25, 0, 200, "fsr_sharpening_slider"};
SwitchableSetting<AntiAliasing> 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.

View File

@ -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<float>(Settings::values.fsr_sharpening_slider.GetValue()) / 100.0f;
FsrRcasCon(push_constants.data(), sharpening);
cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_COMPUTE_BIT, push_constants);
{

View File

@ -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<u32>(Settings::values.scaling_filter.GetValue(global)),
static_cast<u32>(Settings::values.scaling_filter.GetDefault()),
Settings::values.scaling_filter.UsingGlobal());
WriteSetting(QString::fromStdString(Settings::values.fsr_sharpening_slider.GetLabel()),
static_cast<u32>(Settings::values.fsr_sharpening_slider.GetValue(global)),
static_cast<u32>(Settings::values.fsr_sharpening_slider.GetDefault()),
Settings::values.fsr_sharpening_slider.UsingGlobal());
WriteSetting(QString::fromStdString(Settings::values.anti_aliasing.GetLabel()),
static_cast<u32>(Settings::values.anti_aliasing.GetValue(global)),
static_cast<u32>(Settings::values.anti_aliasing.GetDefault()),

View File

@ -63,6 +63,11 @@ 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);
ui->fsr_sharpening_combobox->setVisible(!Settings::IsConfiguringGlobal());
ui->fsr_sharpening_label->setVisible(Settings::IsConfiguringGlobal());
}
void ConfigureGraphics::UpdateDeviceSelection(int device) {
@ -110,6 +115,7 @@ void ConfigureGraphics::SetConfiguration() {
static_cast<int>(Settings::values.resolution_setup.GetValue()));
ui->scaling_filter_combobox->setCurrentIndex(
static_cast<int>(Settings::values.scaling_filter.GetValue()));
ui->fsr_sharpening_slider->setValue(Settings::values.fsr_sharpening_slider.GetValue());
ui->anti_aliasing_combobox->setCurrentIndex(
static_cast<int>(Settings::values.anti_aliasing.GetValue()));
} else {
@ -147,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());
@ -155,6 +170,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 +231,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);
@ -269,6 +291,13 @@ void ConfigureGraphics::ApplyConfiguration() {
Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green()));
Settings::values.bg_blue.SetValue(static_cast<u8>(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());
}
}
}
@ -380,6 +409,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());
@ -387,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;
}
@ -396,6 +427,13 @@ void ConfigureGraphics::SetupPerGameUI() {
ConfigurationShared::SetHighlight(ui->bg_layout, index == 1);
});
connect(ui->fsr_sharpening_combobox, qOverload<int>(&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,

View File

@ -42,6 +42,8 @@ private:
void RetrieveVulkanDevices();
void SetFSRIndicatorText(int percentage);
void SetupPerGameUI();
Settings::RendererBackend GetCurrentGraphicsBackend() const;

View File

@ -152,6 +152,12 @@
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>Graphics Settings</string>
</property>
@ -481,6 +487,146 @@
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="fsr_sharpening_layout" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<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>
<layout class="QHBoxLayout" name="fsr_sharpening_label_group">
<item>
<widget class="QComboBox" name="fsr_sharpening_combobox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Use global FSR Sharpness</string>
</property>
</item>
<item>
<property name="text">
<string>Set FSR Sharpness</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="fsr_sharpening_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>FSR Sharpness:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="fsr_slider_layout">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QSlider" name="fsr_sharpening_slider">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="sliderPosition">
<number>25</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="invertedAppearance">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="fsr_sharpening_value">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>100%</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="bg_layout" native="true">
<property name="sizePolicy">

View File

@ -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);