VKCMDPIPELINEBARRIER(3)

NAME
vkCmdPipelineBarrier - Insert a set of execution and memory barriers

C SPECIFICATION

To record a pipeline barrier, call:

    void vkCmdPipelineBarrier(
        VkCommandBuffer                             commandBuffer,
        VkPipelineStageFlags                        srcStageMask,
        VkPipelineStageFlags                        dstStageMask,
        VkDependencyFlags                           dependencyFlags,
        uint32_t                                    memoryBarrierCount,
        const VkMemoryBarrier*                      pMemoryBarriers,
        uint32_t                                    bufferMemoryBarrierCount,
        const VkBufferMemoryBarrier*                pBufferMemoryBarriers,
        uint32_t                                    imageMemoryBarrierCount,
        const VkImageMemoryBarrier*                 pImageMemoryBarriers);

PARAMETERS

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

    • srcStageMask is a bitmask of VkPipelineStageFlagBits specifying a set of source pipeline stages (see ???).

    • dstStageMask is a bitmask specifying a set of destination pipeline stages.

    The pipeline barrier specifies an execution dependency such that all work performed by the set of pipeline stages included in srcStageMask of the first set of commands completes before any work performed by the set of pipeline stages included in dstStageMask of the second set of commands begins.

    • dependencyFlags is a bitmask of VkDependencyFlagBits. The execution dependency is by-region if the mask includes VK_DEPENDENCY_BY_REGION_BIT.

    • memoryBarrierCount is the length of the pMemoryBarriers array.

    • pMemoryBarriers is a pointer to an array of VkMemoryBarrier structures.

    • bufferMemoryBarrierCount is the length of the pBufferMemoryBarriers array.

    • pBufferMemoryBarriers is a pointer to an array of VkBufferMemoryBarrier structures.

    • imageMemoryBarrierCount is the length of the pImageMemoryBarriers array.

    • pImageMemoryBarriers is a pointer to an array of VkImageMemoryBarrier structures.

DESCRIPTION

Each element of the pMemoryBarriers, pBufferMemoryBarriers and pImageMemoryBarriers arrays specifies two halves of a memory dependency, as defined above. Specifics of each type of memory barrier and the memory access types are defined further in Memory Barriers.

If vkCmdPipelineBarrier is called outside a render pass instance, then the first set of commands is all prior commands submitted to the queue and recorded in the command buffer and the second set of commands is all subsequent commands recorded in the command buffer and submitted to the queue. If vkCmdPipelineBarrier is called inside a render pass instance, then the first set of commands is all prior commands in the same subpass and the second set of commands is all subsequent commands in the same subpass. Valid Usage

    • If the geometry shaders feature is not enabled, srcStageMask must not contain VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT

    • If the geometry shaders feature is not enabled, dstStageMask must not contain VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT

    • If the tessellation shaders feature is not enabled, srcStageMask must not contain VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT or VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT

    • If the tessellation shaders feature is not enabled, dstStageMask must not contain VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT or VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT

    • If vkCmdPipelineBarrier is called within a render pass instance, the render pass must have been created with a VkSubpassDependency instance in pDependencies that expresses a dependency from the current subpass to itself. Additionally:

        • srcStageMask must contain a subset of the bit values in the srcStageMask member of that instance of VkSubpassDependency

        • dstStageMask must contain a subset of the bit values in the dstStageMask member of that instance of VkSubpassDependency

        • The srcAccessMask of any element of pMemoryBarriers or pImageMemoryBarriers must contain a subset of the bit values the srcAccessMask member of that instance of VkSubpassDependency

        • The dstAccessMask of any element of pMemoryBarriers or pImageMemoryBarriers must contain a subset of the bit values the dstAccessMask member of that instance of VkSubpassDependency

        • dependencyFlags must be equal to the dependencyFlags member of that instance of VkSubpassDependency

    • If vkCmdPipelineBarrier is called within a render pass instance, bufferMemoryBarrierCount must be 0

    • If vkCmdPipelineBarrier is called within a render pass instance, the image member of any element of pImageMemoryBarriers must be equal to one of the elements of pAttachments that the current framebuffer was created with, that is also referred to by one of the elements of the pColorAttachments, pResolveAttachments or pDepthStencilAttachment members of the VkSubpassDescription instance that the current subpass was created with

    • If vkCmdPipelineBarrier is called within a render pass instance, the oldLayout and newLayout members of any element of pImageMemoryBarriers must be equal to the layout member of an element of the pColorAttachments, pResolveAttachments or pDepthStencilAttachment members of the VkSubpassDescription instance that the current subpass was created with, that refers to the same image

    • If vkCmdPipelineBarrier is called within a render pass instance, the oldLayout and newLayout members of an element of pImageMemoryBarriers must be equal

    • If vkCmdPipelineBarrier is called within a render pass instance, the srcQueueFamilyIndex and dstQueueFamilyIndex members of any element of pImageMemoryBarriers must be VK_QUEUE_FAMILY_IGNORED
Valid Usage (Implicit)

    • commandBuffer must be a valid VkCommandBuffer handle

    • srcStageMask must be a valid combination of VkPipelineStageFlagBits values

    • srcStageMask must not be 0

    • dstStageMask must be a valid combination of VkPipelineStageFlagBits values

    • dstStageMask must not be 0

    • dependencyFlags must be a valid combination of VkDependencyFlagBits values

    • If memoryBarrierCount is not 0, pMemoryBarriers must be a pointer to an array of memoryBarrierCount valid VkMemoryBarrier structures

    • If bufferMemoryBarrierCount is not 0, pBufferMemoryBarriers must be a pointer to an array of bufferMemoryBarrierCount valid VkBufferMemoryBarrier structures

    • If imageMemoryBarrierCount is not 0, pImageMemoryBarriers must be a pointer to an array of imageMemoryBarrierCount valid VkImageMemoryBarrier structures

    • commandBuffer must be in the recording state

    • The VkCommandPool that commandBuffer was allocated from must support transfer, graphics, or compute operations
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 | Supported Queue Types
Primary Secondary | Both | TRANSFER GRAPHICS COMPUTE

SEE ALSO

VkBufferMemoryBarrier, VkCommandBuffer, VkDependencyFlags, VkImageMemoryBarrier, VkMemoryBarrier, VkPipelineStageFlags

DOCUMENT NOTES

For more information, see the Vulkan Specification at URL

https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#vkCmdPipelineBarrier

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

COPYRIGHT

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

AUTHOR

Khronos Group
    Author.