vk/meta: generalize 3D blit code

This handles the 3D->2D Array case that we hit with maintenance8. Fixes tests
like
dEQP-VK.api.copy_and_blit.dedicated_allocation.blit_image.simple_tests.3d_to_2d_array.max_slices_linear

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34426>
This commit is contained in:
Alyssa Rosenzweig 2025-04-06 17:56:59 -04:00 committed by Marge Bot
parent c2a3c70086
commit 045880c8a6

View file

@ -771,12 +771,24 @@ vk_meta_blit_image(struct vk_command_buffer *cmd,
uint32_t dst_layer_count;
if (src_image->image_type == VK_IMAGE_TYPE_3D) {
/* We need to fixup to handle the 3D-->2D Array case */
unsigned dst_z_or_layer_offsets[] = {
regions[r].dstOffsets[0].z,
regions[r].dstOffsets[1].z
};
if (dst_image->image_type != VK_IMAGE_TYPE_3D) {
/* baseArrayLayer applied outside so we just need the count */
dst_z_or_layer_offsets[0] = 0;
dst_z_or_layer_offsets[1] = dst_subres.layerCount;
}
uint32_t layer0, layer1;
compute_off_scale(src_extent.depth,
regions[r].srcOffsets[0].z,
regions[r].srcOffsets[1].z,
regions[r].dstOffsets[0].z,
regions[r].dstOffsets[1].z,
dst_z_or_layer_offsets[0],
dst_z_or_layer_offsets[1],
&layer0, &layer1,
&push.z_off, &push.z_scale);
dst_rect.layer = layer0;