Function Prototype

vkCmdSetColorWriteMaskEXT

Specify the color write masks for each attachment dynamically for a command buffer
primary / secondary
both
graphics
state

To dynamically set the color write masks, call:

void vkCmdSetColorWriteMaskEXT(
    VkCommandBuffer commandBuffer,
    uint32_t firstAttachment,
    uint32_t attachmentCount,
    const VkColorComponentFlags* pColorWriteMasks);
  • commandBuffer is the command buffer into which the command will be recorded.
  • firstAttachment the first color attachment the color write masks apply to.
  • attachmentCount the number of VkColorComponentFlags values in the pColorWriteMasks array.
  • pColorWriteMasks an array of VkColorComponentFlags values that specify the color write masks of the corresponding attachments.

This command sets the color write masks of the specified attachments for subsequent drawing commands when drawing using shader objects, or when the graphics pipeline is created with VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineColorBlendAttachmentState::colorWriteMask values used to create the currently active pipeline.

Formats with bits that are shared between components specified by VkColorComponentFlagBits, such as VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, cannot have their channels individually masked by this functionality; either all components that share bits have to be enabled, or none of them.

Valid Usage

VUID-vkCmdSetColorWriteMaskEXT-None-09423

At least one of the following must be true:

Valid Usage (Implicit)

VUID-vkCmdSetColorWriteMaskEXT-pColorWriteMasks-parameter

pColorWriteMasks must be a valid pointer to an array of attachmentCount valid combinations of VkColorComponentFlagBits values

VUID-vkCmdSetColorWriteMaskEXT-commandBuffer-cmdpool

The VkCommandPool that commandBuffer was allocated from must support graphics operations

VUID-vkCmdSetColorWriteMaskEXT-videocoding

This command must only be called outside of a video coding scope

Host Synchronization

  • Host access to commandBuffer must be externally synchronized
  • Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized ::