From 07828c0456fd446c9664cd04d70acb2bfaafce22 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Tue, 25 Aug 2020 10:17:29 +0200 Subject: [PATCH] v3dv: fix 3D image blits Specifically, we should select the slice to blit from on the source image to be in the middle of the depth step. This issue was only raised recently after the CTS improved the 3D blitting tests. Fixes: dEQP-VK.api.copy_and_blit.core.blit_image.all_formats.*.3d.* Part-of: --- src/broadcom/vulkan/v3dv_meta_copy.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_meta_copy.c b/src/broadcom/vulkan/v3dv_meta_copy.c index e1e63071a97..7c9578776aa 100644 --- a/src/broadcom/vulkan/v3dv_meta_copy.c +++ b/src/broadcom/vulkan/v3dv_meta_copy.c @@ -4033,8 +4033,15 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer, if (!job) goto fail; - if (src->type == VK_IMAGE_TYPE_3D) - tex_coords[4] = (min_src_layer + i * src_z_step) / (float)src_level_d; + /* For 3D blits we need to compute the source slice to blit from (the Z + * coordinate of the source sample operation). We want to choose this + * based on the ratio of the depth of the source and the destination + * images, picking the coordinate in the middle of each step. + */ + if (src->type == VK_IMAGE_TYPE_3D) { + tex_coords[4] = + (min_src_layer + (i + 0.5f) * src_z_step) / (float)src_level_d; + } v3dv_CmdPushConstants(_cmd_buffer, device->meta.blit.playout,