diff --git a/rpcs3/Emu/RSX/GL/GLCompute.cpp b/rpcs3/Emu/RSX/GL/GLCompute.cpp index f0f21194e3..6a552cb989 100644 --- a/rpcs3/Emu/RSX/GL/GLCompute.cpp +++ b/rpcs3/Emu/RSX/GL/GLCompute.cpp @@ -373,16 +373,16 @@ namespace gl void cs_ssbo_to_color_image::run(gl::command_context& cmd, const buffer* src, const texture_view* dst, const u32 src_offset, const coordu& dst_region, const pixel_buffer_layout& layout) { - const auto row_pitch = static_cast(dst_region.width); const u32 bpp = dst->image()->pitch() / dst->image()->width(); + const u32 row_length = utils::align(dst_region.width * bpp, std::max(layout.alignment, 1)) / bpp; m_program.uniforms["swap_bytes"] = layout.swap_bytes; - m_program.uniforms["src_pitch"] = row_pitch; + m_program.uniforms["src_pitch"] = row_length; m_program.uniforms["format"] = static_cast(dst->image()->get_internal_format()); m_program.uniforms["region_offset"] = color2i(dst_region.x, dst_region.y); m_program.uniforms["region_size"] = color2i(dst_region.width, dst_region.height); - src->bind_range(gl::buffer::target::ssbo, GL_COMPUTE_BUFFER_SLOT(0), src_offset, row_pitch * bpp * dst_region.height); + src->bind_range(gl::buffer::target::ssbo, GL_COMPUTE_BUFFER_SLOT(0), src_offset, row_length * bpp * dst_region.height); glBindImageTexture(GL_COMPUTE_IMAGE_SLOT(0), dst->id(), 0, GL_FALSE, 0, GL_WRITE_ONLY, dst->view_format()); const int num_invocations = utils::aligned_div(dst_region.width * dst_region.height, optimal_kernel_size); diff --git a/rpcs3/Emu/RSX/GL/GLOverlays.cpp b/rpcs3/Emu/RSX/GL/GLOverlays.cpp index 3d2f104574..835181b9b8 100644 --- a/rpcs3/Emu/RSX/GL/GLOverlays.cpp +++ b/rpcs3/Emu/RSX/GL/GLOverlays.cpp @@ -621,8 +621,8 @@ namespace gl const u32 src_offset, const coordu& dst_region, const pixel_buffer_layout& layout) { - const u32 row_length = static_cast(dst_region.width); const u32 bpp = dst->image()->pitch() / dst->image()->width(); + const u32 row_length = utils::align(dst_region.width * bpp, std::max(layout.alignment, 1)) / bpp; program_handle.uniforms["src_pitch"] = row_length; program_handle.uniforms["swap_bytes"] = layout.swap_bytes; diff --git a/rpcs3/Emu/RSX/GL/GLTexture.cpp b/rpcs3/Emu/RSX/GL/GLTexture.cpp index 2a1b3cc7be..0cdd65c5e8 100644 --- a/rpcs3/Emu/RSX/GL/GLTexture.cpp +++ b/rpcs3/Emu/RSX/GL/GLTexture.cpp @@ -856,6 +856,7 @@ namespace gl if (driver_caps.ARB_compute_shader_supported) { // 0. Preconf + mem_layout.alignment = caps.alignment; mem_layout.swap_bytes = op.require_swap; mem_layout.format = gl_format; mem_layout.type = gl_type; diff --git a/rpcs3/Emu/RSX/GL/GLTexture.h b/rpcs3/Emu/RSX/GL/GLTexture.h index 6d544c2771..1f2eb8d7da 100644 --- a/rpcs3/Emu/RSX/GL/GLTexture.h +++ b/rpcs3/Emu/RSX/GL/GLTexture.h @@ -21,6 +21,7 @@ namespace gl GLenum type; u8 size; bool swap_bytes; + u8 alignment; }; struct image_memory_requirements