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
This commit is contained in:
paulfradgley
2022-05-31 16:55:42 +01:00
committed by GitHub
parent f32f1aeaa2
commit 3bf46004ef

View File

@@ -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;