QtGUI: Add buttton to toggle the filter.

This commit is contained in:
FernandoS27 2021-10-21 02:05:16 +02:00 committed by Fernando Sahmkow
parent 9e065b9c7d
commit 2eff80b47f
5 changed files with 61 additions and 1 deletions

View file

@ -70,6 +70,7 @@ enum class ScalingFilter : u32 {
Gaussian = 3, Gaussian = 3,
ScaleForce = 4, ScaleForce = 4,
Fsr = 5, Fsr = 5,
LastFilter = Fsr,
}; };
struct ResolutionScalingInfo { struct ResolutionScalingInfo {

View file

@ -24,6 +24,7 @@
#include "video_core/host_shaders/opengl_present_frag.h" #include "video_core/host_shaders/opengl_present_frag.h"
#include "video_core/host_shaders/opengl_present_vert.h" #include "video_core/host_shaders/opengl_present_vert.h"
#include "video_core/host_shaders/present_bicubic_frag.h" #include "video_core/host_shaders/present_bicubic_frag.h"
#include "video_core/host_shaders/present_gaussian_frag.h"
#include "video_core/host_shaders/present_scaleforce_frag.h" #include "video_core/host_shaders/present_scaleforce_frag.h"
#include "video_core/renderer_opengl/gl_rasterizer.h" #include "video_core/renderer_opengl/gl_rasterizer.h"
#include "video_core/renderer_opengl/gl_shader_manager.h" #include "video_core/renderer_opengl/gl_shader_manager.h"

View file

@ -429,7 +429,7 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>FidelityFX Super Resolution [Vulkan Only]</string> <string>AMD's FidelityFX™️ Super Resolution [Vulkan Only]</string>
</property> </property>
</item> </item>
</widget> </widget>

View file

@ -774,6 +774,34 @@ void GMainWindow::InitializeWidgets() {
tas_label->setFocusPolicy(Qt::NoFocus); tas_label->setFocusPolicy(Qt::NoFocus);
statusBar()->insertPermanentWidget(0, tas_label); statusBar()->insertPermanentWidget(0, tas_label);
// Setup Filter button
filter_status_button = new QPushButton();
filter_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
filter_status_button->setFocusPolicy(Qt::NoFocus);
connect(filter_status_button, &QPushButton::clicked, [&] {
auto filter = Settings::values.scaling_filter.GetValue();
if (filter == Settings::ScalingFilter::LastFilter) {
filter = Settings::ScalingFilter::NearestNeighbor;
} else {
filter = static_cast<Settings::ScalingFilter>(static_cast<u32>(filter) + 1);
}
if (Settings::values.renderer_backend.GetValue() == Settings::RendererBackend::OpenGL &&
filter == Settings::ScalingFilter::Fsr) {
filter = Settings::ScalingFilter::NearestNeighbor;
}
Settings::values.scaling_filter.SetValue(filter);
filter_status_button->setChecked(true);
UpdateFilterText();
});
auto filter = Settings::values.scaling_filter.GetValue();
if (Settings::values.renderer_backend.GetValue() == Settings::RendererBackend::OpenGL &&
filter == Settings::ScalingFilter::Fsr) {
Settings::values.scaling_filter.SetValue(Settings::ScalingFilter::NearestNeighbor);
}
UpdateFilterText();
filter_status_button->setCheckable(true);
statusBar()->insertPermanentWidget(0, filter_status_button);
// Setup Dock button // Setup Dock button
dock_status_button = new QPushButton(); dock_status_button = new QPushButton();
dock_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); dock_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
@ -3033,11 +3061,39 @@ void GMainWindow::UpdateGPUAccuracyButton() {
} }
} }
void GMainWindow::UpdateFilterText() {
const auto filter = Settings::values.scaling_filter.GetValue();
switch (filter) {
case Settings::ScalingFilter::NearestNeighbor:
filter_status_button->setText(tr("NEAREST"));
break;
case Settings::ScalingFilter::Bilinear:
filter_status_button->setText(tr("BILINEAR"));
break;
case Settings::ScalingFilter::Bicubic:
filter_status_button->setText(tr("BICUBIC"));
break;
case Settings::ScalingFilter::Gaussian:
filter_status_button->setText(tr("GAUSSIAN"));
break;
case Settings::ScalingFilter::ScaleForce:
filter_status_button->setText(tr("SCALEFORCE"));
break;
case Settings::ScalingFilter::Fsr:
filter_status_button->setText(tr("AMD'S FIDELITYFX SR"));
break;
default:
filter_status_button->setText(tr("BILINEAR"));
break;
}
}
void GMainWindow::UpdateStatusButtons() { void GMainWindow::UpdateStatusButtons() {
dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue());
renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() == renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() ==
Settings::RendererBackend::Vulkan); Settings::RendererBackend::Vulkan);
UpdateGPUAccuracyButton(); UpdateGPUAccuracyButton();
UpdateFilterText();
} }
void GMainWindow::UpdateUISettings() { void GMainWindow::UpdateUISettings() {

View file

@ -302,6 +302,7 @@ private:
void MigrateConfigFiles(); void MigrateConfigFiles();
void UpdateWindowTitle(std::string_view title_name = {}, std::string_view title_version = {}, void UpdateWindowTitle(std::string_view title_name = {}, std::string_view title_version = {},
std::string_view gpu_vendor = {}); std::string_view gpu_vendor = {});
void UpdateFilterText();
void UpdateStatusBar(); void UpdateStatusBar();
void UpdateGPUAccuracyButton(); void UpdateGPUAccuracyButton();
void UpdateStatusButtons(); void UpdateStatusButtons();
@ -336,6 +337,7 @@ private:
QPushButton* gpu_accuracy_button = nullptr; QPushButton* gpu_accuracy_button = nullptr;
QPushButton* renderer_status_button = nullptr; QPushButton* renderer_status_button = nullptr;
QPushButton* dock_status_button = nullptr; QPushButton* dock_status_button = nullptr;
QPushButton* filter_status_button = nullptr;
QTimer status_bar_update_timer; QTimer status_bar_update_timer;
std::unique_ptr<Config> config; std::unique_ptr<Config> config;