From 3bf46004ef4f6308bc49b1e22b1c7824a7a0e626 Mon Sep 17 00:00:00 2001 From: paulfradgley <39525348+paulfradgley@users.noreply.github.com> Date: Tue, 31 May 2022 16:55:42 +0100 Subject: [PATCH] Fixes incorrect slice pitch calculation in clCopyImage 1Darray (#1258) The slice pitch/padding calculation assumed that the 'height' variable contained the pixel height of the image, which it doesn't for IMAGE1D_ARRAY. Fixes #1257 --- test_conformance/images/clCopyImage/test_copy_generic.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test_conformance/images/clCopyImage/test_copy_generic.cpp b/test_conformance/images/clCopyImage/test_copy_generic.cpp index bd935e7f..3bd1b6ef 100644 --- a/test_conformance/images/clCopyImage/test_copy_generic.cpp +++ b/test_conformance/images/clCopyImage/test_copy_generic.cpp @@ -228,6 +228,11 @@ cl_mem create_image( cl_context context, cl_command_queue queue, BufferOwningPtr } size_t mappedSlicePad = mappedSlice - (mappedRow * height); + // For 1Darray, the height variable actually contains the arraysize, + // so it can't be used for calculating the slice padding. + if (imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY) + mappedSlicePad = mappedSlice - (mappedRow * 1); + // Copy the image. size_t scanlineSize = row_pitch_lod; size_t sliceSize = slice_pitch_lod - scanlineSize * height;