diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.h b/rpcs3/Emu/RSX/GL/GLGSRender.h index 92ba1c346b..a4e5b6dda1 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.h +++ b/rpcs3/Emu/RSX/GL/GLGSRender.h @@ -157,7 +157,6 @@ private: GLuint get_present_source(gl::present_surface_info* info, const rsx::avconf* avconfig); public: - void read_buffers(); void set_viewport(); void set_scissor(bool clip_viewport); diff --git a/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp b/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp index b3cf0148de..f03ee9d348 100644 --- a/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp +++ b/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp @@ -424,11 +424,7 @@ std::array, 2> GLGSRender::copy_depth_stencil_buffer_to_m return {}; } -void GLGSRender::read_buffers() -{ - // TODO -} - +// Render target helpers void gl::render_target::clear_memory(gl::command_context& cmd) { if (aspect() & gl::image_aspect::depth) @@ -445,8 +441,35 @@ void gl::render_target::clear_memory(gl::command_context& cmd) void gl::render_target::load_memory(gl::command_context& cmd) { - // TODO - clear_memory(cmd); + const u32 gcm_format = is_depth_surface() ? + get_compatible_gcm_format(format_info.gcm_depth_format).first : + get_compatible_gcm_format(format_info.gcm_color_format).first; + + rsx_subresource_layout subres{}; + subres.width_in_block = subres.width_in_texel = surface_width * samples_x; + subres.height_in_block = subres.height_in_texel = surface_height * samples_y; + subres.pitch_in_block = rsx_pitch / get_bpp(); + subres.depth = 1; + subres.data = { vm::get_super_ptr(base_addr), static_cast::index_type>(rsx_pitch * surface_height * samples_y) }; + + // TODO: MSAA support + if (g_cfg.video.resolution_scale_percent == 100 && spp == 1) [[likely]] + { + gl::upload_texture(id(), gcm_format, surface_width, surface_height, 1, 1, + false, rsx::texture_dimension_extended::texture_dimension_2d, { subres }); + } + else + { + auto tmp = std::make_unique(GL_TEXTURE_2D, subres.width_in_block, subres.height_in_block, 1, 1, static_cast(get_internal_format())); + gl::upload_texture(tmp->id(), gcm_format, surface_width, surface_height, 1, 1, + false, rsx::texture_dimension_extended::texture_dimension_2d, { subres }); + + gl::g_hw_blitter->scale_image(cmd, tmp.get(), this, + { 0, 0, subres.width_in_block, subres.height_in_block }, + { 0, 0, static_cast(width()), static_cast(height()) }, + !is_depth_surface(), + {}); + } } void gl::render_target::initialize_memory(gl::command_context& cmd, bool /*read_access*/)