From 4fb24c48b0239c2b5b7ac04ae886163615653ccd Mon Sep 17 00:00:00 2001 From: victzhan Date: Thu, 10 Aug 2023 16:58:47 -0400 Subject: [PATCH] SWDEV-274425 - fix bad initialization of array slice index for 1d image array in partialMemCopyTo() Change-Id: Id9a0c55d4296de8cd89f1870b2c8028ce6cf601b --- rocclr/device/pal/palresource.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rocclr/device/pal/palresource.cpp b/rocclr/device/pal/palresource.cpp index e0ca7241e3..979c0e8879 100644 --- a/rocclr/device/pal/palresource.cpp +++ b/rocclr/device/pal/palresource.cpp @@ -1503,7 +1503,7 @@ bool Resource::partialMemCopyTo(VirtualGPU& gpu, const amd::Coord3D& srcOrigin, gpu.queue(gpu.engineID_).addCmdMemRef(memRef()); gpu.queue(gpu.engineID_).addCmdMemRef(dstResource.memRef()); if (desc().buffer_ && !dstResource.desc().buffer_) { - uint32_t arraySliceIdx = img2Darray ? dstOrigin[2] : 0; + uint32_t arraySliceIdx = img2Darray ? dstOrigin[2] : img1Darray ? dstOrigin[1] : 0; Pal::SubresId ImgSubresId = {0, dstResource.desc().baseLevel_, arraySliceIdx}; Pal::MemoryImageCopyRegion copyRegion = {}; copyRegion.imageSubres = ImgSubresId; @@ -1529,7 +1529,7 @@ bool Resource::partialMemCopyTo(VirtualGPU& gpu, const amd::Coord3D& srcOrigin, gpu.iCmd()->CmdCopyMemoryToImage(*iMem(), *dstResource.image_, imgLayout, 1, ©Region); } else if (!desc().buffer_ && dstResource.desc().buffer_) { Pal::MemoryImageCopyRegion copyRegion = {}; - uint32_t arraySliceIdx = img2Darray ? dstOrigin[2] : 0; + uint32_t arraySliceIdx = img2Darray ? dstOrigin[2] : img1Darray ? dstOrigin[1] : 0; Pal::SubresId ImgSubresId = {0, desc().baseLevel_, arraySliceIdx}; copyRegion.imageSubres = ImgSubresId; copyRegion.imageOffset.x = srcOrigin[0];