radv: fix copying 2D to 3D images

CTS is testing 2D to 3D image copies but the checks are incomplete and
we used to only copy the first slice.

This should fix
dEQP-GLES31.functional.copy_image.non_compressed.*.texture2d_array_to_texture3d
with ANGLE.

Cc: mesa-stable
Suggested-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23231>
(cherry picked from commit d2d07a7262)
This commit is contained in:
Samuel Pitoiset 2023-05-25 10:44:11 +02:00 committed by Eric Engestrom
parent 07e26682f5
commit 91d6a4dec6
2 changed files with 7 additions and 13 deletions

View file

@ -2560,7 +2560,7 @@
"description": "radv: fix copying 2D to 3D images",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -497,19 +497,17 @@ copy_image(struct radv_cmd_buffer *cmd_buffer, struct radv_image *src_image,
.height = img_extent_el.height,
};
if (src_image->vk.image_type == VK_IMAGE_TYPE_3D)
unsigned num_slices = region->srcSubresource.layerCount;
if (src_image->vk.image_type == VK_IMAGE_TYPE_3D) {
b_src.layer = src_offset_el.z;
num_slices = img_extent_el.depth;
}
if (dst_image->vk.image_type == VK_IMAGE_TYPE_3D)
b_dst.layer = dst_offset_el.z;
/* Loop through each 3D or array slice */
unsigned num_slices_3d = img_extent_el.depth;
unsigned num_slices_array = region->dstSubresource.layerCount;
unsigned slice_3d = 0;
unsigned slice_array = 0;
while (slice_3d < num_slices_3d && slice_array < num_slices_array) {
for (unsigned slice = 0; slice < num_slices; slice++) {
/* Finish creating blit rect */
rect.dst_x = dst_offset_el.x;
rect.dst_y = dst_offset_el.y;
@ -529,10 +527,6 @@ copy_image(struct radv_cmd_buffer *cmd_buffer, struct radv_image *src_image,
b_src.layer++;
b_dst.layer++;
if (dst_image->vk.image_type == VK_IMAGE_TYPE_3D)
slice_3d++;
else
slice_array++;
}
}