Commit 5d1e8540 by Alexis Hetu Committed by Alexis Hétu

Fixed 3D image copy

3D subregions were not properly supported in Image::copyTo() Bug: b/144353295 Change-Id: I445881b37be310401b38cffcb6003a1e4461bed8 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/38471 Presubmit-Ready: Alexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent d6407598
...@@ -314,13 +314,15 @@ void Image::copyTo(Image* dstImage, const VkImageCopy& pRegion) const ...@@ -314,13 +314,15 @@ void Image::copyTo(Image* dstImage, const VkImageCopy& pRegion) const
{ {
size_t copySize = copyExtent.width * srcBytesPerBlock; size_t copySize = copyExtent.width * srcBytesPerBlock;
for(uint32_t z = 0; z < copyExtent.depth; z++) for(uint32_t z = 0; z < copyExtent.depth; z++, dstMem += dstSlicePitchBytes, srcMem += srcSlicePitchBytes)
{ {
for(uint32_t y = 0; y < copyExtent.height; y++, dstMem += dstRowPitchBytes, srcMem += srcRowPitchBytes) const uint8_t* srcSlice = srcMem;
uint8_t* dstSlice = dstMem;
for(uint32_t y = 0; y < copyExtent.height; y++, dstSlice += dstRowPitchBytes, srcSlice += srcRowPitchBytes)
{ {
ASSERT((srcMem + copySize) < end()); ASSERT((srcSlice + copySize) < end());
ASSERT((dstMem + copySize) < dstImage->end()); ASSERT((dstSlice + copySize) < dstImage->end());
memcpy(dstMem, srcMem, copySize); memcpy(dstSlice, srcSlice, copySize);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment