radv: Fix differing aspect masks for multiplane image copies.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11050
CC: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28867>
(cherry picked from commit d0c4b9144a)
This commit is contained in:
Bas Nieuwenhuizen 2024-04-22 20:56:13 +02:00 committed by Eric Engestrom
parent e8816cf5ae
commit e4117e7fb0
2 changed files with 17 additions and 6 deletions

View file

@ -24,7 +24,7 @@
"description": "radv: Fix differing aspect masks for multiplane image copies.",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1585,15 +1585,26 @@ radv_meta_image_to_image_cs(struct radv_cmd_buffer *cmd_buffer, struct radv_meta
}
u_foreach_bit (i, dst->aspect_mask) {
unsigned aspect_mask = 1u << i;
unsigned dst_aspect_mask = 1u << i;
unsigned src_aspect_mask = dst_aspect_mask;
VkFormat depth_format = 0;
if (aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT)
if (dst_aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT)
depth_format = vk_format_stencil_only(dst->image->vk.format);
else if (aspect_mask == VK_IMAGE_ASPECT_DEPTH_BIT)
else if (dst_aspect_mask == VK_IMAGE_ASPECT_DEPTH_BIT)
depth_format = vk_format_depth_only(dst->image->vk.format);
else {
/*
* "Multi-planar images can only be copied on a per-plane basis, and the subresources used in each region when
* copying to or from such images must specify only one plane, though different regions can specify different
* planes."
*/
assert((dst->aspect_mask & (dst->aspect_mask - 1)) == 0);
assert((src->aspect_mask & (src->aspect_mask - 1)) == 0);
src_aspect_mask = src->aspect_mask;
}
create_iview(cmd_buffer, src, &src_view, depth_format, aspect_mask);
create_iview(cmd_buffer, dst, &dst_view, depth_format, aspect_mask);
create_iview(cmd_buffer, src, &src_view, depth_format, src_aspect_mask);
create_iview(cmd_buffer, dst, &dst_view, depth_format, dst_aspect_mask);
itoi_bind_descriptors(cmd_buffer, &src_view, &dst_view);