Merge pull request #1 from lat9nq/fsrSlider

configure_graphics: Implement custom setting for FSR Sharpening
This commit is contained in:
Matías Locatti 2022-11-26 00:51:08 -03:00 committed by GitHub
commit c8d84cb6cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 130 additions and 62 deletions

View file

@ -182,6 +182,7 @@ void RestoreGlobalState(bool is_powered_on) {
values.cpuopt_unsafe_ignore_global_monitor.SetGlobal(true); values.cpuopt_unsafe_ignore_global_monitor.SetGlobal(true);
// Renderer // Renderer
values.fsr_sharpening_slider.SetGlobal(true);
values.renderer_backend.SetGlobal(true); values.renderer_backend.SetGlobal(true);
values.vulkan_device.SetGlobal(true); values.vulkan_device.SetGlobal(true);
values.aspect_ratio.SetGlobal(true); values.aspect_ratio.SetGlobal(true);

View file

@ -66,6 +66,8 @@ ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* paren
connect(ui->fsr_sharpening_slider, &QSlider::valueChanged, this, connect(ui->fsr_sharpening_slider, &QSlider::valueChanged, this,
&ConfigureGraphics::SetFSRIndicatorText); &ConfigureGraphics::SetFSRIndicatorText);
ui->fsr_sharpening_combobox->setVisible(!Settings::IsConfiguringGlobal());
ui->fsr_sharpening_label->setVisible(Settings::IsConfiguringGlobal());
} }
void ConfigureGraphics::UpdateDeviceSelection(int device) { void ConfigureGraphics::UpdateDeviceSelection(int device) {
@ -151,6 +153,15 @@ void ConfigureGraphics::SetConfiguration() {
ConfigurationShared::SetHighlight(ui->anti_aliasing_label, ConfigurationShared::SetHighlight(ui->anti_aliasing_label,
!Settings::values.anti_aliasing.UsingGlobal()); !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_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1);
ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal()); ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal());
ConfigurationShared::SetHighlight(ui->bg_layout, !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<u8>(bg_color.green())); Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green()));
Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue())); 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());
}
} }
} }
@ -399,6 +417,7 @@ void ConfigureGraphics::SetupPerGameUI() {
ui->accelerate_astc->setEnabled(Settings::values.accelerate_astc.UsingGlobal()); ui->accelerate_astc->setEnabled(Settings::values.accelerate_astc.UsingGlobal());
ui->use_disk_shader_cache->setEnabled(Settings::values.use_disk_shader_cache.UsingGlobal()); ui->use_disk_shader_cache->setEnabled(Settings::values.use_disk_shader_cache.UsingGlobal());
ui->bg_button->setEnabled(Settings::values.bg_red.UsingGlobal()); ui->bg_button->setEnabled(Settings::values.bg_red.UsingGlobal());
ui->fsr_slider_layout->setEnabled(Settings::values.fsr_sharpening_slider.UsingGlobal());
return; return;
} }
@ -408,6 +427,13 @@ void ConfigureGraphics::SetupPerGameUI() {
ConfigurationShared::SetHighlight(ui->bg_layout, index == 1); 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( ConfigurationShared::SetColoredTristate(
ui->use_disk_shader_cache, Settings::values.use_disk_shader_cache, use_disk_shader_cache); ui->use_disk_shader_cache, Settings::values.use_disk_shader_cache, use_disk_shader_cache);
ConfigurationShared::SetColoredTristate(ui->accelerate_astc, Settings::values.accelerate_astc, ConfigurationShared::SetColoredTristate(ui->accelerate_astc, Settings::values.accelerate_astc,

View file

@ -517,73 +517,114 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item alignment="Qt::AlignLeft"> <item>
<widget class="QLabel" name="fsr_sharpening_label"> <layout class="QHBoxLayout" name="fsr_sharpening_label_group">
<property name="sizePolicy"> <item>
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <widget class="QComboBox" name="fsr_sharpening_combobox">
<horstretch>0</horstretch> <property name="sizePolicy">
<verstretch>0</verstretch> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
</sizepolicy> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
<property name="text"> </sizepolicy>
<string>FSR Sharpening:</string> </property>
</property> <item>
</widget> <property name="text">
<string>Use global FSR Sharpening</string>
</property>
</item>
<item>
<property name="text">
<string>Set FSR Sharpening</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 Sharpening:</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>
<item> <item>
<widget class="QSlider" name="fsr_sharpening_slider"> <layout class="QHBoxLayout" name="fsr_slider_layout">
<property name="sizePolicy"> <property name="spacing">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <number>6</number>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="baseSize"> <item>
<size> <widget class="QSlider" name="fsr_sharpening_slider">
<width>0</width> <property name="sizePolicy">
<height>0</height> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
</size> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
<property name="maximum"> </sizepolicy>
<number>200</number> </property>
</property> <property name="baseSize">
<property name="sliderPosition"> <size>
<number>25</number> <width>0</width>
</property> <height>0</height>
<property name="orientation"> </size>
<enum>Qt::Horizontal</enum> </property>
</property> <property name="maximum">
<property name="invertedAppearance"> <number>200</number>
<bool>true</bool> </property>
</property> <property name="sliderPosition">
</widget> <number>25</number>
</item> </property>
<item> <property name="orientation">
<widget class="QLabel" name="fsr_sharpening_value"> <enum>Qt::Horizontal</enum>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <property name="invertedAppearance">
<horstretch>0</horstretch> <bool>true</bool>
<verstretch>0</verstretch> </property>
</sizepolicy> </widget>
</property> </item>
<property name="minimumSize"> <item>
<size> <widget class="QLabel" name="fsr_sharpening_value">
<width>32</width> <property name="sizePolicy">
<height>0</height> <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
</size> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
<property name="text"> </sizepolicy>
<string>100%</string> </property>
</property> <property name="minimumSize">
<property name="alignment"> <size>
<set>Qt::AlignCenter</set> <width>32</width>
</property> <height>0</height>
</widget> </size>
</property>
<property name="text">
<string>100%</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
<zorder>fsr_sharpening_value</zorder>
<zorder>fsr_sharpening_label</zorder>
<zorder>fsr_sharpening_slider</zorder>
</widget> </widget>
</item> </item>
<item> <item>