C Specification

To record a pipeline barrier, call:

// Provided by VK_VERSION_1_3
void vkCmdPipelineBarrier2(
    VkCommandBuffer                             commandBuffer,
    const VkDependencyInfo*                     pDependencyInfo);
// Provided by VK_KHR_synchronization2
// Equivalent to vkCmdPipelineBarrier2
void vkCmdPipelineBarrier2KHR(
    VkCommandBuffer                             commandBuffer,
    const VkDependencyInfo*                     pDependencyInfo);

Parameters

  • commandBuffer is the command buffer into which the command is recorded.

  • pDependencyInfo is a pointer to a VkDependencyInfo structure defining the scopes of this operation.

Description

When vkCmdPipelineBarrier2 is submitted to a queue, it defines memory dependencies between commands that were submitted to the same queue before it, and those submitted to the same queue after it.

The first synchronization scope and access scope of each memory dependency defined by pDependencyInfo are applied to operations that occurred earlier in submission order.

The second synchronization scope and access scope of each memory dependency defined by pDependencyInfo are applied to operations that occurred later in submission order.

If vkCmdPipelineBarrier2 is recorded within a render pass instance, the synchronization scopes are limited to a subset of operations within the same subpass or render pass instance.

Valid Usage
  • VUID-vkCmdPipelineBarrier2-image-09373
    If vkCmdPipelineBarrier2 is called within a render pass instance using a VkRenderPass object, and the image member of any image memory barrier is a color resolve attachment, the corresponding color attachment must be VK_ATTACHMENT_UNUSED

  • VUID-vkCmdPipelineBarrier2-image-09374
    If vkCmdPipelineBarrier2 is called within a render pass instance using a VkRenderPass object, and the image member of any image memory barrier is a color resolve attachment, it must have been created with a non-zero VkExternalFormatANDROID::externalFormat value

  • VUID-vkCmdPipelineBarrier2-oldLayout-01181
    If vkCmdPipelineBarrier2 is called within a render pass instance, the oldLayout and newLayout members of any image memory barrier included in this command must be equal

  • VUID-vkCmdPipelineBarrier2-srcQueueFamilyIndex-01182
    If vkCmdPipelineBarrier2 is called within a render pass instance, the srcQueueFamilyIndex and dstQueueFamilyIndex members of any memory barrier included in this command must be equal

  • VUID-vkCmdPipelineBarrier2-synchronization2-03848
    The synchronization2 feature must be enabled

  • VUID-vkCmdPipelineBarrier2-srcStageMask-09673
    The srcStageMask member of any element of the pMemoryBarriers member of pDependencyInfo must only include pipeline stages valid for the queue family that was used to create the command pool that commandBuffer was allocated from

  • VUID-vkCmdPipelineBarrier2-dstStageMask-09674
    The dstStageMask member of any element of the pMemoryBarriers member of pDependencyInfo must only include pipeline stages valid for the queue family that was used to create the command pool that commandBuffer was allocated from

  • VUID-vkCmdPipelineBarrier2-srcStageMask-09675
    If a buffer or image memory barrier does not specify an acquire operation, or if it does but pDependencyInfo->dependencyFlags includes VK_DEPENDENCY_QUEUE_FAMILY_OWNERSHIP_TRANSFER_USE_ALL_STAGES_BIT_KHR, the respective srcStageMask member of the element of the pBufferMemoryBarriers or pImageMemoryBarriers members of pDependencyInfo must only include pipeline stages valid for the queue family that was used to create the command pool that commandBuffer was allocated from

  • VUID-vkCmdPipelineBarrier2-dstStageMask-09676
    If a buffer or image memory barrier does not specify an release operation, or if it does but pDependencyInfo->dependencyFlags includes VK_DEPENDENCY_QUEUE_FAMILY_OWNERSHIP_TRANSFER_USE_ALL_STAGES_BIT_KHR, the respective dstStageMask member of the element of the pBufferMemoryBarriers or pImageMemoryBarriers members of pDependencyInfo must only include pipeline stages valid for the queue family that was used to create the command pool that commandBuffer was allocated from

  • VUID-vkCmdPipelineBarrier2-srcQueueFamilyIndex-10387
    If a buffer or image memory barrier specifies a queue family ownership transfer operation, either the srcQueueFamilyIndex or dstQueueFamilyIndex member of the element of the pBufferMemoryBarriers or pImageMemoryBarriers members of pDependencyInfo and the queue family index that was used to create the command pool that commandBuffer was allocated from must be equal

Valid Usage (Implicit)
Host Synchronization
  • Host access to commandBuffer must be externally synchronized

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

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Both

Both

VK_QUEUE_COMPUTE_BIT
VK_QUEUE_GRAPHICS_BIT
VK_QUEUE_TRANSFER_BIT
VK_QUEUE_VIDEO_DECODE_BIT_KHR
VK_QUEUE_VIDEO_ENCODE_BIT_KHR

Synchronization

Conditional Rendering

vkCmdPipelineBarrier2 is not affected by conditional rendering

See Also

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 2014-2026 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0