# VkClearAttachment(3) Manual Page

## Name

VkClearAttachment - Structure specifying a clear attachment

## C Specification

The `VkClearAttachment` structure is defined as:

    typedef struct VkClearAttachment {
        VkImageAspectFlags    aspectMask;
        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`

## See Also

VkClearValue, VkImageAspectFlags, vkCmdClearAttachments

## Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.