From c3b234f972f4ac39c6fab89466ad8fd1f2e8560f Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sun, 19 May 2019 21:29:33 +0300 Subject: [PATCH] gl: Fix staging buffer size calculation --- rpcs3/Emu/RSX/GL/GLTexture.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/RSX/GL/GLTexture.cpp b/rpcs3/Emu/RSX/GL/GLTexture.cpp index 17276da052..8e59389c22 100644 --- a/rpcs3/Emu/RSX/GL/GLTexture.cpp +++ b/rpcs3/Emu/RSX/GL/GLTexture.cpp @@ -606,7 +606,8 @@ namespace gl // The rest of sampler state is now handled by sampler state objects // Calculate staging buffer size - size_t texture_data_sz = depth * height * width * get_format_block_size_in_bytes(gcm_format); + const u32 aligned_pitch = align(width * get_format_block_size_in_bytes(gcm_format), 4); + size_t texture_data_sz = depth * height * aligned_pitch; std::vector data_upload_buf(texture_data_sz); const auto format_type = get_format_type(gcm_format);