Add another row to do the copying for presented images in when pitch is bigger than width

This commit is contained in:
Jupeyy 2024-09-07 18:31:06 +02:00
parent 3d30ce4bf2
commit 3595b70170
No known key found for this signature in database

View file

@ -1508,8 +1508,9 @@ protected:
vkInvalidateMappedMemoryRanges(m_VKDevice, 1, &MemRange); vkInvalidateMappedMemoryRanges(m_VKDevice, 1, &MemRange);
size_t RealFullImageSize = maximum(ImageTotalSize, (size_t)(Height * m_GetPresentedImgDataHelperMappedLayoutPitch)); size_t RealFullImageSize = maximum(ImageTotalSize, (size_t)(Height * m_GetPresentedImgDataHelperMappedLayoutPitch));
if(vDstData.size() < RealFullImageSize) size_t ExtraRowSize = Width * 4;
vDstData.resize(RealFullImageSize); if(vDstData.size() < RealFullImageSize + ExtraRowSize)
vDstData.resize(RealFullImageSize + ExtraRowSize);
mem_copy(vDstData.data(), pResImageData, RealFullImageSize); mem_copy(vDstData.data(), pResImageData, RealFullImageSize);
@ -1520,7 +1521,8 @@ protected:
{ {
size_t OffsetImagePacked = (Y * Width * 4); size_t OffsetImagePacked = (Y * Width * 4);
size_t OffsetImageUnpacked = (Y * m_GetPresentedImgDataHelperMappedLayoutPitch); 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);
} }
} }