From 0e3499bf41f498d4c85aff64edbb6dcb9dc90eb4 Mon Sep 17 00:00:00 2001 From: Romaric Jodin Date: Wed, 11 Oct 2023 07:26:25 +0200 Subject: [PATCH] fix initialization of 2d and 3d image After #612 the cts started to regress on swiftshader. It is because in the cts, the height and depth can be set to zero when the dimension is not used. --- src/queue.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/queue.cpp b/src/queue.cpp index 882ea066..18ca429b 100644 --- a/src/queue.cpp +++ b/src/queue.cpp @@ -1804,6 +1804,21 @@ cvk_command_image_init::build_batchable_inner(cvk_command_buffer& cmdbuf) { extent.height = m_image->height(); extent.depth = m_image->depth(); + switch (m_image->type()) { + case CL_MEM_OBJECT_IMAGE2D: + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + extent.depth = 1; + break; + case CL_MEM_OBJECT_IMAGE1D_BUFFER: + case CL_MEM_OBJECT_IMAGE1D: + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + extent.height = 1; + extent.depth = 1; + break; + default: + break; + } + VkBufferImageCopy copy = { 0, // bufferOffset row_length, // bufferRowLength