From 7fe9802f8711ae9e3671f00bc2bc881f5ae72a13 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sat, 29 Feb 2020 18:59:59 +0300 Subject: [PATCH] vk: Properly use declared pitch when loading simple images --- rpcs3/Emu/RSX/VK/VKPresent.cpp | 2 +- rpcs3/Emu/RSX/VK/VKTextureCache.h | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/RSX/VK/VKPresent.cpp b/rpcs3/Emu/RSX/VK/VKPresent.cpp index 4f562c9aa6..2878b491da 100644 --- a/rpcs3/Emu/RSX/VK/VKPresent.cpp +++ b/rpcs3/Emu/RSX/VK/VKPresent.cpp @@ -338,7 +338,7 @@ vk::image* VKGSRender::get_present_source(vk::present_surface_info* info, const } m_texture_cache.invalidate_range(*m_current_command_buffer, range, rsx::invalidation_cause::read); - image_to_flip = m_texture_cache.upload_image_simple(*m_current_command_buffer, info->address, info->width, info->height); + image_to_flip = m_texture_cache.upload_image_simple(*m_current_command_buffer, info->address, info->width, info->height, info->pitch); } return image_to_flip; diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.h b/rpcs3/Emu/RSX/VK/VKTextureCache.h index dd61329777..6fa82a95e1 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.h +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.h @@ -1467,7 +1467,7 @@ namespace vk baseclass::on_frame_end(); } - vk::image *upload_image_simple(vk::command_buffer& cmd, u32 address, u32 width, u32 height) + vk::image *upload_image_simple(vk::command_buffer& cmd, u32 address, u32 width, u32 height, u32 pitch) { if (!m_formats_support.bgra8_linear) { @@ -1490,7 +1490,6 @@ namespace vk void* mem = image->memory->map(0, layout.rowPitch * height); - u32 row_pitch = width * 4; auto src = vm::_ptr(address); auto dst = static_cast(mem); @@ -1503,7 +1502,7 @@ namespace vk for (u32 col = 0; col < width; ++col) casted_dst[col] = casted_src[col]; - src += row_pitch; + src += pitch; dst += layout.rowPitch; }