mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
gl: Remove upscaling 'dst' binding and clean up some awful code in GLPresent
This commit is contained in:
parent
12694dcf69
commit
27125c6f72
3 changed files with 12 additions and 19 deletions
|
@ -200,7 +200,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
|||
// Enable drawing to window backbuffer
|
||||
gl::screen.bind();
|
||||
|
||||
GLuint image_to_flip = GL_NONE, image_to_flip2 = GL_NONE;
|
||||
gl::texture *image_to_flip = nullptr, *image_to_flip2 = nullptr;
|
||||
|
||||
if (info.buffer < display_buffers_count && buffer_width && buffer_height)
|
||||
{
|
||||
|
@ -215,13 +215,12 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
|||
.eye = 0
|
||||
};
|
||||
|
||||
const auto image_to_flip_ = get_present_source(&present_info, avconfig);
|
||||
image_to_flip = image_to_flip_->id();
|
||||
image_to_flip = get_present_source(&present_info, avconfig);
|
||||
|
||||
if (avconfig.stereo_mode != stereo_render_mode_options::disabled) [[unlikely]]
|
||||
{
|
||||
const auto [unused, min_expected_height] = rsx::apply_resolution_scale<true>(RSX_SURFACE_DIMENSION_IGNORED, buffer_height + 30);
|
||||
if (image_to_flip_->height() < min_expected_height)
|
||||
if (image_to_flip->height() < min_expected_height)
|
||||
{
|
||||
// Get image for second eye
|
||||
const u32 image_offset = (buffer_height + 30) * buffer_pitch + display_buffers[info.buffer].offset;
|
||||
|
@ -230,13 +229,13 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
|||
present_info.address = rsx::get_address(image_offset, CELL_GCM_LOCATION_LOCAL);
|
||||
present_info.eye = 1;
|
||||
|
||||
image_to_flip2 = get_present_source(&present_info, avconfig)->id();
|
||||
image_to_flip2 = get_present_source(&present_info, avconfig);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Account for possible insets
|
||||
const auto [unused2, scaled_buffer_height] = rsx::apply_resolution_scale<true>(RSX_SURFACE_DIMENSION_IGNORED, buffer_height);
|
||||
buffer_height = std::min<u32>(image_to_flip_->height() - min_expected_height, scaled_buffer_height);
|
||||
buffer_height = std::min<u32>(image_to_flip->height() - min_expected_height, scaled_buffer_height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,14 +277,10 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
|||
if (g_user_asked_for_screenshot || (g_recording_mode != recording_mode::stopped && m_frame->can_consume_frame()))
|
||||
{
|
||||
std::vector<u8> sshot_frame(buffer_height * buffer_width * 4);
|
||||
glGetError();
|
||||
|
||||
gl::pixel_pack_settings pack_settings{};
|
||||
pack_settings.apply();
|
||||
|
||||
if (gl::get_driver_caps().ARB_dsa_supported)
|
||||
glGetTextureImage(image_to_flip, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer_height * buffer_width * 4, sshot_frame.data());
|
||||
else
|
||||
glGetTextureImageEXT(image_to_flip, GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, sshot_frame.data());
|
||||
image_to_flip->copy_to(sshot_frame.data(), gl::texture::format::rgba, gl::texture::type::ubyte, pack_settings);
|
||||
|
||||
if (GLenum err = glGetError(); err != GL_NO_ERROR)
|
||||
{
|
||||
|
@ -325,13 +320,13 @@ 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, gl::screen, screen_area, aspect_ratio.flipped_vertical(), gl::UPSCALE_AND_COMMIT);
|
||||
m_upscaler->scale_output(cmd, image_to_flip->id(), screen_area, aspect_ratio.flipped_vertical(), gl::UPSCALE_AND_COMMIT);
|
||||
}
|
||||
else
|
||||
{
|
||||
const f32 gamma = avconfig.gamma;
|
||||
const bool limited_range = !use_full_rgb_range_output;
|
||||
const rsx::simple_array<GLuint> images{ image_to_flip, image_to_flip2 };
|
||||
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;
|
||||
|
||||
// FIXME: Upscaling should optionally happen before this step.
|
||||
|
|
|
@ -20,9 +20,8 @@ namespace gl
|
|||
}
|
||||
|
||||
gl::handle32_t scale_output(
|
||||
const gl::command_context& /*cmd*/, // State
|
||||
gl::command_context& /*cmd*/, // State
|
||||
gl::handle32_t src, // Source input
|
||||
const gl::fbo& screen, // Present target. May be VK_NULL_HANDLE for some passes
|
||||
const areai& src_region, // Scaling request information
|
||||
const areai& dst_region, // Ditto
|
||||
gl::flags32_t mode // Mode
|
||||
|
@ -35,7 +34,7 @@ namespace gl
|
|||
m_flip_fbo.color = src;
|
||||
m_flip_fbo.read_buffer(m_flip_fbo.color);
|
||||
m_flip_fbo.draw_buffer(m_flip_fbo.color);
|
||||
m_flip_fbo.blit(screen, src_region, dst_region, gl::buffers::color, Filter);
|
||||
m_flip_fbo.blit(gl::screen, src_region, dst_region, gl::buffers::color, Filter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,8 @@ namespace gl
|
|||
virtual ~upscaler() {}
|
||||
|
||||
virtual gl::handle32_t scale_output(
|
||||
const gl::command_context& cmd, // State
|
||||
gl::command_context& cmd, // State
|
||||
gl::handle32_t src, // Source input
|
||||
const gl::fbo& screen, // Present target. May be VK_NULL_HANDLE for some passes
|
||||
const areai& src_region, // Scaling request information
|
||||
const areai& dst_region, // Ditto
|
||||
gl::flags32_t mode // Mode
|
||||
|
|
Loading…
Add table
Reference in a new issue