Merge pull request #8914 from Jupeyy/pr_cpy_into_fake_buffer

Add another row to do the copying for presented images in when pitch is bigger than width
This commit is contained in:
Robert Müller 2024-09-07 18:56:16 +00:00 committed by GitHub
commit a865354320
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1508,8 +1508,9 @@ protected:
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 @@ protected:
{
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);
}
}