radv: Remove aspect mask "expansion" for copy_image.
The Vulkan spec says multi-planar images can only be copied on a per-plane basis. The COLOR_BIT to "all planes" expansion applies to image memory barriers which is completely unrelated. Remove the expansion logic to simplify the code. Add assertions to clearly describe the invariant. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26364>
This commit is contained in:

committed by
Marge Bot

parent
7ffb65f935
commit
eb0419a1aa
@@ -402,10 +402,18 @@ copy_image(struct radv_cmd_buffer *cmd_buffer, struct radv_image *src_image, VkI
|
||||
|
||||
/* From the Vulkan 1.0 spec:
|
||||
*
|
||||
* vkCmdCopyImage can be used to copy image data between multisample
|
||||
* images, but both images must have the same number of samples.
|
||||
* vkCmdCopyImage can be used to copy image data between multisample images, but both images must have the same
|
||||
* number of samples.
|
||||
*/
|
||||
assert(src_image->vk.samples == dst_image->vk.samples);
|
||||
/* From the Vulkan 1.3 spec:
|
||||
*
|
||||
* 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(src_image->plane_count == 1 || util_is_power_of_two_nonzero(region->srcSubresource.aspectMask));
|
||||
assert(dst_image->plane_count == 1 || util_is_power_of_two_nonzero(region->dstSubresource.aspectMask));
|
||||
|
||||
cs = cmd_buffer->qf == RADV_QUEUE_COMPUTE || !radv_image_is_renderable(cmd_buffer->device, dst_image);
|
||||
|
||||
@@ -446,28 +454,12 @@ copy_image(struct radv_cmd_buffer *cmd_buffer, struct radv_image *src_image, VkI
|
||||
}
|
||||
}
|
||||
|
||||
VkImageAspectFlags src_aspects[3] = {region->srcSubresource.aspectMask};
|
||||
VkImageAspectFlags dst_aspects[3] = {region->dstSubresource.aspectMask};
|
||||
unsigned aspect_count = 1;
|
||||
|
||||
if (region->srcSubresource.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT && src_image->plane_count > 1) {
|
||||
static const VkImageAspectFlags all_planes[3] = {VK_IMAGE_ASPECT_PLANE_0_BIT, VK_IMAGE_ASPECT_PLANE_1_BIT,
|
||||
VK_IMAGE_ASPECT_PLANE_2_BIT};
|
||||
|
||||
aspect_count = src_image->plane_count;
|
||||
for (unsigned i = 0; i < aspect_count; i++) {
|
||||
src_aspects[i] = all_planes[i];
|
||||
dst_aspects[i] = all_planes[i];
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned a = 0; a < aspect_count; ++a) {
|
||||
/* Create blit surfaces */
|
||||
struct radv_meta_blit2d_surf b_src =
|
||||
blit_surf_for_image_level_layer(src_image, src_image_layout, ®ion->srcSubresource, src_aspects[a]);
|
||||
struct radv_meta_blit2d_surf b_src = blit_surf_for_image_level_layer(
|
||||
src_image, src_image_layout, ®ion->srcSubresource, region->srcSubresource.aspectMask);
|
||||
|
||||
struct radv_meta_blit2d_surf b_dst =
|
||||
blit_surf_for_image_level_layer(dst_image, dst_image_layout, ®ion->dstSubresource, dst_aspects[a]);
|
||||
struct radv_meta_blit2d_surf b_dst = blit_surf_for_image_level_layer(
|
||||
dst_image, dst_image_layout, ®ion->dstSubresource, region->dstSubresource.aspectMask);
|
||||
|
||||
uint32_t dst_queue_mask = radv_image_queue_family_mask(dst_image, cmd_buffer->qf, cmd_buffer->qf);
|
||||
bool dst_compressed = radv_layout_dcc_compressed(cmd_buffer->device, dst_image, region->dstSubresource.mipLevel,
|
||||
@@ -488,7 +480,7 @@ copy_image(struct radv_cmd_buffer *cmd_buffer, struct radv_image *src_image, VkI
|
||||
|
||||
radv_decompress_dcc(cmd_buffer, dst_image,
|
||||
&(VkImageSubresourceRange){
|
||||
.aspectMask = dst_aspects[a],
|
||||
.aspectMask = region->dstSubresource.aspectMask,
|
||||
.baseMipLevel = region->dstSubresource.mipLevel,
|
||||
.levelCount = 1,
|
||||
.baseArrayLayer = region->dstSubresource.baseArrayLayer,
|
||||
@@ -560,7 +552,6 @@ copy_image(struct radv_cmd_buffer *cmd_buffer, struct radv_image *src_image, VkI
|
||||
b_src.layer++;
|
||||
b_dst.layer++;
|
||||
}
|
||||
}
|
||||
|
||||
if (cs) {
|
||||
/* Fixup HTILE after a copy on compute. */
|
||||
|
Reference in New Issue
Block a user