From: Jason Ekstrand Date: Wed, 25 Mar 2020 05:43:14 +0000 (-0500) Subject: anv: Add TRANSFER_SRC to pass usage not subpass usage X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5808efdf40d2496e14625322c1f9e8bdbe6f8c36;p=mesa.git anv: Add TRANSFER_SRC to pass usage not subpass usage The subpass usage flags are supposed to always be one bit and never multiple bits. However, when adding in TRANSFER_SRC usage for resolve attachments we were adding it to the subpass bits and not the render pass bits. This potentially is causing issues where images aren't getting marked written properly. Reviewed-by: Rafael Antognolli Part-of: --- diff --git a/src/intel/vulkan/anv_pass.c b/src/intel/vulkan/anv_pass.c index 69a66478c56..ec32e0ca3bd 100644 --- a/src/intel/vulkan/anv_pass.c +++ b/src/intel/vulkan/anv_pass.c @@ -86,7 +86,6 @@ anv_render_pass_compile(struct anv_render_pass *pass) struct anv_render_pass_attachment *pass_att = &pass->attachments[subpass_att->attachment]; - assert(__builtin_popcount(subpass_att->usage) == 1); pass_att->usage |= subpass_att->usage; pass_att->last_subpass_idx = i; @@ -116,8 +115,13 @@ anv_render_pass_compile(struct anv_render_pass *pass) subpass->has_color_resolve = true; + assert(color_att->attachment < pass->attachment_count); + struct anv_render_pass_attachment *color_pass_att = + &pass->attachments[color_att->attachment]; + assert(resolve_att->usage == VK_IMAGE_USAGE_TRANSFER_DST_BIT); - color_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + assert(color_att->usage == VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT); + color_pass_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; } } @@ -127,9 +131,17 @@ anv_render_pass_compile(struct anv_render_pass *pass) UNUSED struct anv_subpass_attachment *resolve_att = subpass->ds_resolve_attachment; + assert(ds_att->attachment < pass->attachment_count); + struct anv_render_pass_attachment *ds_pass_att = + &pass->attachments[ds_att->attachment]; + assert(resolve_att->usage == VK_IMAGE_USAGE_TRANSFER_DST_BIT); - ds_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + assert(ds_att->usage == VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT); + ds_pass_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; } + + for (uint32_t j = 0; j < subpass->attachment_count; j++) + assert(__builtin_popcount(subpass->attachments[j].usage) == 1); } /* From the Vulkan 1.0.39 spec: diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 3ac514ee777..28c375cb1b8 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -5238,6 +5238,7 @@ cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer, } } + assert(util_bitcount(subpass->attachments[i].usage) == 1); if (subpass->attachments[i].usage == VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) { /* We assume that if we're starting a subpass, we're going to do some