Clear Commands

Clearing Images Outside a Render Pass Instance

Color and depth/stencil images can be cleared outside a render pass instance using vkCmdClearColorImage or vkCmdClearDepthStencilImage, respectively. These commands are only allowed outside of a render pass instance.

vkCmdClearColorImageClear regions of a color image
vkCmdClearDepthStencilImageFill regions of a combined depth/stencil image

Clears outside render pass instances are treated as transfer operations for the purposes of memory barriers.

Clearing Images Inside a Render Pass Instance

vkCmdClearAttachmentsClear regions within bound framebuffer attachments
VkClearRectStructure specifying a clear rectangle
VkClearAttachmentStructure specifying a clear attachment

Clear Values

VkClearColorValueStructure specifying a clear color value
VkClearDepthStencilValueStructure specifying a clear depth stencil value
VkClearValueStructure specifying a clear value

Filling Buffers

vkCmdFillBufferFill a region of a buffer with a fixed value

Updating Buffers

vkCmdUpdateBufferUpdate a buffer’s contents from host memory

The pData parameter was of type uint32_t* instead of void* prior to version 1.0.19 of the Specification and VK_HEADER_VERSION 19 of the Vulkan Header Files. This was a historical anomaly, as the source data may be of other types.