From: Danylo Piliaiev Date: Thu, 31 Jan 2019 13:56:21 +0000 (+0200) Subject: radv: Handle VK_ATTACHMENT_UNUSED in CmdClearAttachment X-Git-Tag: upstream/19.3.0~10057 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b7a93cbdede05af6bf5cad0a67d1a6045c52369f;p=platform%2Fupstream%2Fmesa.git radv: Handle VK_ATTACHMENT_UNUSED in CmdClearAttachment From the Vulkan 1.0.98 spec for vkCmdClearAttachments: "If any attachment to be cleared in the current subpass is VK_ATTACHMENT_UNUSED, then the clear has no effect on that attachment." "If the aspectMask member of any element of pAttachments contains VK_IMAGE_ASPECT_COLOR_BIT, then the colorAttachment member of that element must either refer to a color attachment which is VK_ATTACHMENT_UNUSED, or must be a valid color attachment." "If the aspectMask member of any element of pAttachments contains VK_IMAGE_ASPECT_DEPTH_BIT, then the current subpass' depth/stencil attachment must either be VK_ATTACHMENT_UNUSED, or must have a depth component" "If the aspectMask member of any element of pAttachments contains VK_IMAGE_ASPECT_STENCIL_BIT, then the current subpass' depth/stencil attachment must either be VK_ATTACHMENT_UNUSED, or must have a stencil component" Signed-off-by: Danylo Piliaiev Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c index 819ec06..35da5fb 100644 --- a/src/amd/vulkan/radv_meta_clear.c +++ b/src/amd/vulkan/radv_meta_clear.c @@ -1522,7 +1522,13 @@ emit_clear(struct radv_cmd_buffer *cmd_buffer, if (aspects & VK_IMAGE_ASPECT_COLOR_BIT) { const uint32_t subpass_att = clear_att->colorAttachment; + if (subpass_att == VK_ATTACHMENT_UNUSED) + return; + const uint32_t pass_att = subpass->color_attachments[subpass_att].attachment; + if (pass_att == VK_ATTACHMENT_UNUSED) + return; + VkImageLayout image_layout = subpass->color_attachments[subpass_att].layout; const struct radv_image_view *iview = fb->attachments[pass_att].attachment; VkClearColorValue clear_value = clear_att->clearValue.color; @@ -1537,6 +1543,9 @@ emit_clear(struct radv_cmd_buffer *cmd_buffer, } } else { const uint32_t pass_att = subpass->depth_stencil_attachment->attachment; + if (pass_att == VK_ATTACHMENT_UNUSED) + return; + VkImageLayout image_layout = subpass->depth_stencil_attachment->layout; const struct radv_image_view *iview = fb->attachments[pass_att].attachment; VkClearDepthStencilValue clear_value = clear_att->clearValue.depthStencil;