anv: Handle VK_ATTACHMENT_UNUSED in colorAttachment
authorDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Thu, 31 Jan 2019 13:49:35 +0000 (15:49 +0200)
committerDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Mon, 4 Feb 2019 12:49:50 +0000 (14:49 +0200)
From the Vulkan 1.0.98 spec for vkCmdClearAttachments:

"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."

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_blorp.c

index 0593b17099da0e6f9fb50602c4d1c81ff451c3d3..fbe3e82af597aa91b7151ebd9c417c1f53772f53 100644 (file)
@@ -1013,6 +1013,10 @@ clear_color_attachment(struct anv_cmd_buffer *cmd_buffer,
 {
    const struct anv_subpass *subpass = cmd_buffer->state.subpass;
    const uint32_t color_att = attachment->colorAttachment;
+
+   if (color_att == VK_ATTACHMENT_UNUSED)
+      return;
+
    const uint32_t att_idx = subpass->color_attachments[color_att].attachment;
 
    if (att_idx == VK_ATTACHMENT_UNUSED)