From 3595b70170244b97bf1f719653d35fbba2288e9d Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Sat, 7 Sep 2024 18:31:06 +0200 Subject: [PATCH] Add another row to do the copying for presented images in when pitch is bigger than width --- src/engine/client/backend/vulkan/backend_vulkan.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/engine/client/backend/vulkan/backend_vulkan.cpp b/src/engine/client/backend/vulkan/backend_vulkan.cpp index 8c36efa4ae8..1e59e3fc24e 100644 --- a/src/engine/client/backend/vulkan/backend_vulkan.cpp +++ b/src/engine/client/backend/vulkan/backend_vulkan.cpp @@ -1508,8 +1508,9 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase vkInvalidateMappedMemoryRanges(m_VKDevice, 1, &MemRange); size_t RealFullImageSize = maximum(ImageTotalSize, (size_t)(Height * m_GetPresentedImgDataHelperMappedLayoutPitch)); - if(vDstData.size() < RealFullImageSize) - vDstData.resize(RealFullImageSize); + size_t ExtraRowSize = Width * 4; + if(vDstData.size() < RealFullImageSize + ExtraRowSize) + vDstData.resize(RealFullImageSize + ExtraRowSize); mem_copy(vDstData.data(), pResImageData, RealFullImageSize); @@ -1520,7 +1521,8 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase { size_t OffsetImagePacked = (Y * Width * 4); size_t OffsetImageUnpacked = (Y * m_GetPresentedImgDataHelperMappedLayoutPitch); - mem_copy(vDstData.data() + OffsetImagePacked, vDstData.data() + OffsetImageUnpacked, Width * 4); + mem_copy(vDstData.data() + RealFullImageSize, vDstData.data() + OffsetImageUnpacked, Width * 4); + mem_copy(vDstData.data() + OffsetImagePacked, vDstData.data() + RealFullImageSize, Width * 4); } }