diff --git a/rpcs3/Emu/RSX/GL/GLCompute.cpp b/rpcs3/Emu/RSX/GL/GLCompute.cpp index 351a9c2fb2..7194412a03 100644 --- a/rpcs3/Emu/RSX/GL/GLCompute.cpp +++ b/rpcs3/Emu/RSX/GL/GLCompute.cpp @@ -293,11 +293,11 @@ namespace gl m_src = fmt::replace_all(raw_data, repl_list); } - void cs_d24x8_to_ssbo::run(gl::command_context& cmd, gl::viewable_image* src, const gl::buffer* dst, u32 out_offset, const coordu& region, const gl::pixel_buffer_layout& /*layout*/, const gl::pixel_pack_settings& settings) + void cs_d24x8_to_ssbo::run(gl::command_context& cmd, gl::viewable_image* src, const gl::buffer* dst, u32 out_offset, const coordu& region, const gl::pixel_buffer_layout& layout) { - const auto row_pitch = settings.get_row_length() ? settings.get_row_length() : region.width; + const auto row_pitch = region.width; - m_program.uniforms["swap_bytes"] = settings.get_swap_bytes(); + m_program.uniforms["swap_bytes"] = layout.swap_bytes; m_program.uniforms["output_pitch"] = row_pitch; m_program.uniforms["region_offset"] = color2i(region.x, region.y); m_program.uniforms["region_size"] = color2i(region.width, region.height); @@ -332,11 +332,11 @@ namespace gl m_src = fmt::replace_all(raw_data, repl_list); } - void cs_rgba8_to_ssbo::run(gl::command_context& cmd, gl::viewable_image* src, const gl::buffer* dst, u32 out_offset, const coordu& region, const gl::pixel_buffer_layout& layout, const gl::pixel_pack_settings& settings) + void cs_rgba8_to_ssbo::run(gl::command_context& cmd, gl::viewable_image* src, const gl::buffer* dst, u32 out_offset, const coordu& region, const gl::pixel_buffer_layout& layout) { - const auto row_pitch = settings.get_row_length() ? settings.get_row_length() : region.width; + const auto row_pitch = region.width; - m_program.uniforms["swap_bytes"] = settings.get_swap_bytes(); + m_program.uniforms["swap_bytes"] = layout.swap_bytes; m_program.uniforms["output_pitch"] = row_pitch; m_program.uniforms["region_offset"] = color2i(region.x, region.y); m_program.uniforms["region_size"] = color2i(region.width, region.height); diff --git a/rpcs3/Emu/RSX/GL/GLCompute.h b/rpcs3/Emu/RSX/GL/GLCompute.h index ff62b01506..247966dd9e 100644 --- a/rpcs3/Emu/RSX/GL/GLCompute.h +++ b/rpcs3/Emu/RSX/GL/GLCompute.h @@ -345,19 +345,19 @@ namespace gl struct cs_image_to_ssbo : compute_task { - virtual void run(gl::command_context& cmd, gl::viewable_image* src, const gl::buffer* dst, u32 out_offset, const coordu& region, const gl::pixel_buffer_layout& layout, const gl::pixel_pack_settings& settings) = 0; + virtual void run(gl::command_context& cmd, gl::viewable_image* src, const gl::buffer* dst, u32 out_offset, const coordu& region, const gl::pixel_buffer_layout& layout) = 0; }; struct cs_d24x8_to_ssbo : cs_image_to_ssbo { cs_d24x8_to_ssbo(); - void run(gl::command_context& cmd, gl::viewable_image* src, const gl::buffer* dst, u32 out_offset, const coordu& region, const gl::pixel_buffer_layout& layout, const gl::pixel_pack_settings& settings) override; + void run(gl::command_context& cmd, gl::viewable_image* src, const gl::buffer* dst, u32 out_offset, const coordu& region, const gl::pixel_buffer_layout& layout) override; }; struct cs_rgba8_to_ssbo : cs_image_to_ssbo { cs_rgba8_to_ssbo(); - void run(gl::command_context& cmd, gl::viewable_image* src, const gl::buffer* dst, u32 out_offset, const coordu& region, const gl::pixel_buffer_layout& layout, const gl::pixel_pack_settings& settings) override; + void run(gl::command_context& cmd, gl::viewable_image* src, const gl::buffer* dst, u32 out_offset, const coordu& region, const gl::pixel_buffer_layout& layout) override; }; struct cs_ssbo_to_color_image : compute_task diff --git a/rpcs3/Emu/RSX/GL/GLTexture.cpp b/rpcs3/Emu/RSX/GL/GLTexture.cpp index f3e94af557..14a2245b94 100644 --- a/rpcs3/Emu/RSX/GL/GLTexture.cpp +++ b/rpcs3/Emu/RSX/GL/GLTexture.cpp @@ -470,7 +470,7 @@ namespace gl void* copy_image_to_buffer(gl::command_context& cmd, const pixel_buffer_layout& pack_info, const gl::texture* src, gl::buffer* dst, u32 dst_offset, const int src_level, const coord3u& src_region, image_memory_requirements* mem_info) { - auto initialize_scratch_mem = [&]() + auto initialize_scratch_mem = [&]() -> bool // skip_transform { const u64 max_mem = (mem_info->memory_required) ? mem_info->memory_required : mem_info->image_size_in_bytes; if (!(*dst) || max_mem > static_cast(dst->size())) @@ -490,15 +490,15 @@ namespace gl gl::get_compute_task()->run(cmd, const_cast(as_vi), dst, dst_offset, { {src_region.x, src_region.y}, {src_region.width, src_region.height} }, - pack_info, {}); - return; + pack_info); + return true; case gl::texture::internal_format::rgba8: case gl::texture::internal_format::bgra8: gl::get_compute_task()->run(cmd, const_cast(as_vi), dst, dst_offset, { {src_region.x, src_region.y}, {src_region.width, src_region.height} }, - pack_info, {}); - return; + pack_info); + return true; default: break; } @@ -506,6 +506,7 @@ namespace gl dst->bind(buffer::target::pixel_pack); src->copy_to(reinterpret_cast(static_cast(dst_offset)), static_cast(pack_info.format), static_cast(pack_info.type), src_level, src_region, {}); + return false; }; void* result = reinterpret_cast(static_cast(dst_offset)); @@ -513,17 +514,19 @@ namespace gl pack_info.type == GL_UNSIGNED_SHORT || pack_info.type == GL_UNSIGNED_INT_24_8) { - initialize_scratch_mem(); - if (auto job = get_trivial_transform_job(pack_info)) + if (!initialize_scratch_mem()) { - job->run(cmd, dst, static_cast(mem_info->image_size_in_bytes), dst_offset); + if (auto job = get_trivial_transform_job(pack_info)) + { + job->run(cmd, dst, static_cast(mem_info->image_size_in_bytes), dst_offset); + } } } else if (pack_info.type == GL_FLOAT) { ensure(mem_info->image_size_in_bytes == (mem_info->image_size_in_texels * 4)); mem_info->memory_required = (mem_info->image_size_in_texels * 6); - initialize_scratch_mem(); + ensure(!initialize_scratch_mem()); get_compute_task>()->run(cmd, dst, dst_offset, static_cast(mem_info->image_size_in_bytes), static_cast(mem_info->image_size_in_bytes)); @@ -533,7 +536,7 @@ namespace gl { ensure(mem_info->image_size_in_bytes == (mem_info->image_size_in_texels * 8)); mem_info->memory_required = (mem_info->image_size_in_texels * 12); - initialize_scratch_mem(); + ensure(!initialize_scratch_mem()); get_compute_task()->run(cmd, dst, dst_offset, static_cast(mem_info->image_size_in_bytes), static_cast(mem_info->image_size_in_texels));