gl: Allow selecting FSR1 upscaling from the settings

This commit is contained in:
kd-11 2024-02-25 14:34:58 +03:00 committed by kd-11
parent 188f5c7c3c
commit f748fe688c
3 changed files with 20 additions and 10 deletions

View file

@ -18,6 +18,8 @@
#pragma comment(lib, "opengl32.lib")
#endif
using namespace gl::upscaling_flags_;
namespace gl
{
using vertex_cache = rsx::vertex_cache::default_vertex_cache<rsx::vertex_cache::uploaded_range>;

View file

@ -1,6 +1,8 @@
#include "stdafx.h"
#include "GLGSRender.h"
#include "upscalers/bilinear_pass.hpp"
#include "upscalers/fsr_pass.h"
#include "upscalers/nearest_pass.hpp"
#include "Emu/Cell/Modules/cellVideoOut.h"
@ -309,8 +311,8 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
m_upscaler = std::make_unique<gl::nearest_upscale_pass>();
break;
case output_scaling_mode::fsr:
// Unimplemented
[[ fallthrough ]];
m_upscaler = std::make_unique<gl::fsr_upscale_pass>();
break;
case output_scaling_mode::bilinear:
default:
m_upscaler = std::make_unique<gl::bilinear_upscale_pass>();
@ -320,19 +322,26 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
if (use_full_rgb_range_output && rsx::fcmp(avconfig.gamma, 1.f) && avconfig.stereo_mode == stereo_render_mode_options::disabled)
{
// Blit source image to the screen
m_upscaler->scale_output(cmd, image_to_flip, screen_area, aspect_ratio.flipped_vertical(), gl::UPSCALE_AND_COMMIT);
m_upscaler->scale_output(cmd, image_to_flip, screen_area, aspect_ratio.flipped_vertical(), UPSCALE_AND_COMMIT | UPSCALE_DEFAULT_VIEW);
}
else
{
const f32 gamma = avconfig.gamma;
const bool limited_range = !use_full_rgb_range_output;
const rsx::simple_array<GLuint> images{ image_to_flip->id(), image_to_flip2->id() };
const auto filter = m_output_scaling == output_scaling_mode::nearest ? gl::filter::nearest : gl::filter::linear;
rsx::simple_array<gl::texture*> images{ image_to_flip, image_to_flip2 };
if (m_output_scaling == output_scaling_mode::fsr && avconfig.stereo_mode == stereo_render_mode_options::disabled) // 3D will be implemented later
{
for (unsigned i = 0; i < 2 && images[i]; ++i)
{
const rsx::flags32_t mode = (i == 0) ? UPSCALE_LEFT_VIEW : UPSCALE_RIGHT_VIEW;
images[i] = m_upscaler->scale_output(cmd, image_to_flip, screen_area, aspect_ratio.flipped_vertical(), mode);
}
}
// FIXME: Upscaling should optionally happen before this step.
// With linear and nearest scaling, it really doesn't matter here, but for FSR we cannot just bind the images and use a hardware filter.
gl::screen.bind();
m_video_output_pass.run(cmd, areau(aspect_ratio), images, gamma, limited_range, avconfig.stereo_mode, filter);
m_video_output_pass.run(cmd, areau(aspect_ratio), images.map(FN(x->id())), gamma, limited_range, avconfig.stereo_mode, filter);
}
}

View file

@ -865,11 +865,10 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
const auto apply_fsr_specific_options = [r_creator, this]()
{
const bool is_vulkan = (ui->renderBox->currentText() == r_creator->Vulkan.name);
const auto [text, value] = get_data(ui->outputScalingMode, ui->outputScalingMode->currentIndex());
const bool fsr_selected = static_cast<output_scaling_mode>(value) == output_scaling_mode::fsr;
ui->fsrSharpeningStrength->setEnabled(is_vulkan && fsr_selected);
ui->fsrSharpeningStrengthReset->setEnabled(is_vulkan && fsr_selected);
ui->fsrSharpeningStrength->setEnabled(fsr_selected);
ui->fsrSharpeningStrengthReset->setEnabled(fsr_selected);
};
// Handle connects to disable specific checkboxes that depend on GUI state.