diff --git a/rocclr/device/pal/palresource.cpp b/rocclr/device/pal/palresource.cpp index 96e43f6279..c0af7b9ded 100644 --- a/rocclr/device/pal/palresource.cpp +++ b/rocclr/device/pal/palresource.cpp @@ -1447,7 +1447,8 @@ 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_) { - Pal::SubresId ImgSubresId = {0, dstResource.desc().baseLevel_, 0}; + int arraySliceIdx = img2Darray ? dstOrigin[2] : 0; + Pal::SubresId ImgSubresId = {0, dstResource.desc().baseLevel_, arraySliceIdx}; Pal::MemoryImageCopyRegion copyRegion = {}; copyRegion.imageSubres = ImgSubresId; copyRegion.imageOffset.x = dstOrigin[0]; @@ -1472,7 +1473,8 @@ 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 = {}; - Pal::SubresId ImgSubresId = {0, desc().baseLevel_, 0}; + int arraySliceIdx = img2Darray ? dstOrigin[2] : 0; + Pal::SubresId ImgSubresId = {0, desc().baseLevel_, arraySliceIdx}; copyRegion.imageSubres = ImgSubresId; copyRegion.imageOffset.x = srcOrigin[0]; copyRegion.imageOffset.y = srcOrigin[1];