gl: Rework the upscalers a bit and define the FSR interface

This commit is contained in:
kd-11 2024-02-25 02:51:10 +03:00 committed by kd-11
parent 27125c6f72
commit 1795d5bcc9
5 changed files with 84 additions and 6 deletions

View File

@ -0,0 +1,74 @@
#pragma once
#include "../glutils/buffer_object.h"
#include "../glutils/state_tracker.hpp"
#include "../GLCompute.h"
#include "upscaling.h"
namespace gl
{
namespace FidelityFX
{
class fsr_pass : public compute_task
{
protected:
gl::texture* m_input_image = nullptr;
gl::texture* m_output_image = nullptr;
gl::buffer m_ubo;
size2u m_input_size;
size2u m_output_size;
std::vector<u32> m_constants_buf;
void bind_resources() override;
virtual void configure(const gl::command_context& cmd) = 0;
public:
fsr_pass(const std::string& config_definitions, u32 push_constants_size);
virtual ~fsr_pass();
void run(gl::command_context& cmd, gl::texture* src, gl::texture* dst, const size2u& input_size, const size2u& output_size);
};
class easu_pass : public fsr_pass
{
void configure(const gl::command_context& cmd) override;
public:
easu_pass();
};
class rcas_pass : public fsr_pass
{
void configure(const gl::command_context& cmd) override;
public:
rcas_pass();
};
}
class fsr_upscale_pass : public upscaler
{
public:
fsr_upscale_pass() = default;
~fsr_upscale_pass();
gl::texture* scale_output(
gl::command_context& cmd, // State
gl::texture* src, // Source input
const areai& src_region, // Scaling request information
const areai& dst_region, // Ditto
gl::flags32_t mode // Mode
) override;
private:
std::unique_ptr<gl::viewable_image> m_output_left;
std::unique_ptr<gl::viewable_image> m_output_right;
std::unique_ptr<gl::viewable_image> m_intermediate_data;
gl::fbo m_flip_fbo;
void dispose_images();
void initialize_image(u32 output_w, u32 output_h, rsx::flags32_t mode);
};
}

View File

@ -19,9 +19,9 @@ namespace gl
}
}
gl::handle32_t scale_output(
gl::texture* scale_output(
gl::command_context& /*cmd*/, // State
gl::handle32_t src, // Source input
gl::texture* src, // Source input
const areai& src_region, // Scaling request information
const areai& dst_region, // Ditto
gl::flags32_t mode // Mode
@ -31,11 +31,11 @@ namespace gl
{
m_flip_fbo.recreate();
m_flip_fbo.bind();
m_flip_fbo.color = src;
m_flip_fbo.color = src->id();
m_flip_fbo.read_buffer(m_flip_fbo.color);
m_flip_fbo.draw_buffer(m_flip_fbo.color);
m_flip_fbo.blit(gl::screen, src_region, dst_region, gl::buffers::color, Filter);
return 0;
return nullptr;
}
// Upscaling source only is unsupported

View File

@ -25,9 +25,9 @@ namespace gl
{
virtual ~upscaler() {}
virtual gl::handle32_t scale_output(
virtual gl::texture* scale_output(
gl::command_context& cmd, // State
gl::handle32_t src, // Source input
gl::texture* src, // Source input
const areai& src_region, // Scaling request information
const areai& dst_region, // Ditto
gl::flags32_t mode // Mode

View File

@ -80,6 +80,7 @@
<ClInclude Include="Emu\RSX\GL\OpenGL.h" />
<ClInclude Include="Emu\RSX\GL\GLTexture.h" />
<ClInclude Include="Emu\RSX\GL\upscalers\bilinear_pass.hpp" />
<ClInclude Include="Emu\RSX\GL\upscalers\fsr_pass.h" />
<ClInclude Include="Emu\RSX\GL\upscalers\nearest_pass.hpp" />
<ClInclude Include="Emu\RSX\GL\upscalers\static_pass.hpp" />
<ClInclude Include="Emu\RSX\GL\upscalers\upscaling.h" />

View File

@ -115,6 +115,9 @@
<ClInclude Include="Emu\RSX\GL\upscalers\nearest_pass.hpp">
<Filter>upscalers</Filter>
</ClInclude>
<ClInclude Include="Emu\RSX\GL\upscalers\fsr_pass.h">
<Filter>upscalers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="glutils">