## C Specification

The VkClearAttachment structure is defined as:

// Provided by VK_VERSION_1_0
typedef struct VkClearAttachment {
uint32_t              colorAttachment;
VkClearValue          clearValue;
} VkClearAttachment;

## Members

• aspectMask is a mask selecting the color, depth and/or stencil aspects of the attachment to be cleared.

• colorAttachment is only meaningful if VK_IMAGE_ASPECT_COLOR_BIT is set in aspectMask, in which case it is an index to the pColorAttachments array in the VkSubpassDescription structure of the current subpass which selects the color attachment to clear.

• clearValue is the color or depth/stencil value to clear the attachment to, as described in Clear Values below.

## Description

No memory barriers are needed between vkCmdClearAttachments and preceding or subsequent draw or attachment clear commands in the same subpass.

The vkCmdClearAttachments command is not affected by the bound pipeline state.

Attachments can also be cleared at the beginning of a render pass instance by setting loadOp (or stencilLoadOp) of VkAttachmentDescription to VK_ATTACHMENT_LOAD_OP_CLEAR, as described for vkCreateRenderPass.

Valid Usage
• If aspectMask includes VK_IMAGE_ASPECT_COLOR_BIT, it must not include VK_IMAGE_ASPECT_DEPTH_BIT or VK_IMAGE_ASPECT_STENCIL_BIT

• aspectMask must not include VK_IMAGE_ASPECT_METADATA_BIT

• aspectMask must not include VK_IMAGE_ASPECT_MEMORY_PLANE_i_BIT_EXT for any index i

• clearValue must be a valid VkClearValue union

Valid Usage (Implicit)
• aspectMask must be a valid combination of VkImageAspectFlagBits values

• aspectMask must not be 0