// Copyright 2019-2024 The Khronos Group Inc.
//
// SPDX-License-Identifier: CC-BY-4.0

// Common Valid Usage
// Common to vkCmdPipelineBarrier* commands
ifndef::VK_KHR_multiview,VK_VERSION_1_1[]
  * [[VUID-{refpage}-pDependencies-02285]]
    If fname:{refpage} is called within a render pass instance using a
    slink:VkRenderPass object, the render pass must: have been created with
    at least one subpass dependency that expresses a dependency from the
    current subpass to itself, does not include
    ename:VK_DEPENDENCY_BY_REGION_BIT if this command does not, and has
    <<synchronization-dependencies-scopes, synchronization scopes>> and
    <<synchronization-dependencies-access-scopes, access scopes>> that are
    all supersets of the scopes defined in this command
endif::VK_KHR_multiview,VK_VERSION_1_1[]
ifdef::VK_KHR_multiview,VK_VERSION_1_1[]
  * [[VUID-{refpage}-None-07889]]
    If fname:{refpage} is called within a render pass instance using a
    slink:VkRenderPass object, the render pass must: have been created with
    at least one subpass dependency that expresses a dependency from the
    current subpass to itself, does not include
    ename:VK_DEPENDENCY_BY_REGION_BIT if this command does not, does not
    include ename:VK_DEPENDENCY_VIEW_LOCAL_BIT if this command does not, and
    has <<synchronization-dependencies-scopes, synchronization scopes>> and
    <<synchronization-dependencies-access-scopes, access scopes>> that are
    all supersets of the scopes defined in this command
endif::VK_KHR_multiview,VK_VERSION_1_1[]
  * [[VUID-{refpage}-bufferMemoryBarrierCount-01178]]
    If fname:{refpage} is called within a render pass instance using a
    slink:VkRenderPass object, it must: not include any buffer memory
    barriers
  * [[VUID-{refpage}-image-04073]]
    If fname:{refpage} is called within a render pass instance using a
    slink:VkRenderPass object, the pname:image member of any image memory
    barrier included in this command must: be an attachment used in the
    current subpass both as an input attachment, and as either a color,
ifdef::VK_ANDROID_external_format_resolve[]
    color resolve,
endif::VK_ANDROID_external_format_resolve[]
    or depth/stencil attachment
ifdef::VK_ANDROID_external_format_resolve[]
  * [[VUID-{refpage}-image-09373]]
    If fname:{refpage} is called within a render pass instance using a
    slink:VkRenderPass object, and the pname:image member of any image
    memory barrier is a color resolve attachment, the corresponding color
    attachment must: be ename:VK_ATTACHMENT_UNUSED
  * [[VUID-{refpage}-image-09374]]
    If fname:{refpage} is called within a render pass instance using a
    slink:VkRenderPass object, and the pname:image member of any image
    memory barrier is a color resolve attachment, it must: have been created
    with a non-zero slink:VkExternalFormatANDROID::pname:externalFormat
    value
endif::VK_ANDROID_external_format_resolve[]
  * [[VUID-{refpage}-oldLayout-01181]]
    If fname:{refpage} is called within a render pass instance, the
    pname:oldLayout and pname:newLayout members of any image memory barrier
    included in this command must: be equal
  * [[VUID-{refpage}-srcQueueFamilyIndex-01182]]
    If fname:{refpage} is called within a render pass instance, the
    pname:srcQueueFamilyIndex and pname:dstQueueFamilyIndex members of any
    memory barrier included in this command must: be equal
  * [[VUID-{refpage}-None-07890]]
    If fname:{refpage} is called within a render pass instance, and the
    source stage masks of any memory barriers include
    <<synchronization-framebuffer-regions, framebuffer-space stages>>,
    destination stage masks of all memory barriers must: only include
    <<synchronization-framebuffer-regions, framebuffer-space stages>>
  * [[VUID-{refpage}-dependencyFlags-07891]]
    If fname:{refpage} is called within a render pass instance, and and the
    source stage masks of any memory barriers include
    <<synchronization-framebuffer-regions, framebuffer-space stages>>, then
    pname:dependencyFlags must: include ename:VK_DEPENDENCY_BY_REGION_BIT
  * [[VUID-{refpage}-None-07892]]
    If fname:{refpage} is called within a render pass instance, the source
    and destination stage masks of any memory barriers must: only include
    graphics pipeline stages
ifdef::VK_VERSION_1_1,VK_KHR_multiview[]
  * [[VUID-{refpage}-dependencyFlags-01186]]
    If fname:{refpage} is called outside of a render pass instance, the
    dependency flags must: not include ename:VK_DEPENDENCY_VIEW_LOCAL_BIT
  * [[VUID-{refpage}-None-07893]]
    If fname:{refpage} is called inside a render pass instance, and there is
    more than one view in the current subpass, dependency flags must:
    include ename:VK_DEPENDENCY_VIEW_LOCAL_BIT
endif::VK_VERSION_1_1,VK_KHR_multiview[]
ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[]
  * [[VUID-{refpage}-shaderTileImageColorReadAccess-08718]]
    If fname:{refpage} is called within a render pass instance
ifdef::VK_EXT_shader_tile_image[]
    and none of the <<features-shaderTileImageColorReadAccess,
    pname:shaderTileImageColorReadAccess>>,
    <<features-shaderTileImageDepthReadAccess,
    pname:shaderTileImageDepthReadAccess>>,
    <<features-shaderTileImageStencilReadAccess,
    pname:shaderTileImageStencilReadAccess>> features are enabled,
endif::VK_EXT_shader_tile_image[]
    the render pass must: not have been started with
    flink:vkCmdBeginRendering
ifdef::VK_EXT_shader_tile_image[]
  * [[VUID-{refpage}-None-08719]]
    If fname:{refpage} is called within a render pass instance started with
    flink:vkCmdBeginRendering, it must: adhere to the restrictions in
    <<synchronization-pipeline-barriers-explicit-renderpass-tileimage,
    Explicit Render Pass Tile Image Access Synchronization>>
endif::VK_EXT_shader_tile_image[]
endif::VK_VERSION_1_3,VK_KHR_dynamic_rendering[]
// Common Valid Usage
