// Copyright 2020-2021 The Khronos Group Inc.
//
// SPDX-License-Identifier: CC-BY-4.0
// Common Valid Usage
// Common to structs taking VkPipelineStageFlags2KHR and VkAccessFlags2KHR parameters to define scopes
// Set "stageMaskName" and "accessMaskName" attribute to the name of the stage and access mask to validate
  * [[VUID-{refpage}-{accessMaskName}-03900]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT_KHR, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03901]]
    If pname:{accessMaskName} includes ename:VK_ACCESS_2_INDEX_READ_BIT_KHR,
    pname:{stageMaskName} must: include
    ename:VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03902]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT_KHR, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03903]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT_KHR, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_SUBPASS_SHADING_BIT_HUAWEI,
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03904]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_UNIFORM_READ_BIT_KHR, pname:{stageMaskName} must:
    include ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR, or one of the
    etext:VK_PIPELINE_STAGE_*_SHADER_BIT stages
  * [[VUID-{refpage}-{accessMaskName}-03905]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_SHADER_SAMPLED_READ_BIT_KHR, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR, or one of the
    etext:VK_PIPELINE_STAGE_*_SHADER_BIT stages
  * [[VUID-{refpage}-{accessMaskName}-03906]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR, or one of the
    etext:VK_PIPELINE_STAGE_*_SHADER_BIT stages
  * [[VUID-{refpage}-{accessMaskName}-03907]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR, or one of the
    etext:VK_PIPELINE_STAGE_*_SHADER_BIT stages
  * [[VUID-{refpage}-{accessMaskName}-03908]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_SHADER_READ_BIT_KHR, pname:{stageMaskName} must:
    include ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR, or one
    of the etext:VK_PIPELINE_STAGE_*_SHADER_BIT stages
  * [[VUID-{refpage}-{accessMaskName}-03909]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_SHADER_WRITE_BIT_KHR, pname:{stageMaskName} must:
    include ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR, or one of the
    etext:VK_PIPELINE_STAGE_*_SHADER_BIT stages
  * [[VUID-{refpage}-{accessMaskName}-03910]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_COLOR_ATTACHMENT_READ_BIT_KHR, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03911]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT_KHR, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03912]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT_KHR,
    pname:{stageMaskName} must: include
    ename:VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03913]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT_KHR,
    pname:{stageMaskName} must: include
    ename:VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03914]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_TRANSFER_READ_BIT_KHR, pname:{stageMaskName} must:
    include ename:VK_PIPELINE_STAGE_2_COPY_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_BLIT_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03915]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_TRANSFER_WRITE_BIT_KHR, pname:{stageMaskName} must:
    include ename:VK_PIPELINE_STAGE_2_COPY_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_BLIT_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03916]]
    If pname:{accessMaskName} includes ename:VK_ACCESS_2_HOST_READ_BIT_KHR,
    pname:{stageMaskName} must: include
    ename:VK_PIPELINE_STAGE_2_HOST_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03917]]
    If pname:{accessMaskName} includes ename:VK_ACCESS_2_HOST_WRITE_BIT_KHR,
    pname:{stageMaskName} must: include
    ename:VK_PIPELINE_STAGE_2_HOST_BIT_KHR
ifdef::VK_EXT_conditional_rendering[]
  * [[VUID-{refpage}-{accessMaskName}-03918]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_CONDITIONAL_RENDERING_READ_BIT_EXT,
    pname:{stageMaskName} must: include
    ename:VK_PIPELINE_STAGE_2_CONDITIONAL_RENDERING_BIT_EXT,
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
endif::VK_EXT_conditional_rendering[]
ifdef::VK_EXT_fragment_density_map[]
  * [[VUID-{refpage}-{accessMaskName}-03919]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_FRAGMENT_DENSITY_MAP_READ_BIT_EXT,
    pname:{stageMaskName} must: include
    ename:VK_PIPELINE_STAGE_2_FRAGMENT_DENSITY_PROCESS_BIT_EXT,
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
endif::VK_EXT_fragment_density_map[]
ifdef::VK_EXT_transform_feedback[]
  * [[VUID-{refpage}-{accessMaskName}-03920]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_TRANSFORM_FEEDBACK_WRITE_BIT_EXT,
    pname:{stageMaskName} must: include
    ename:VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT,
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-04747]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT,
    pname:{stageMaskName} must: include
    ename:VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT,
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03922]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT,
    pname:{stageMaskName} must: include
    ename:VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT,
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
endif::VK_EXT_transform_feedback[]
ifdef::VK_NV_shading_rate_image[]
  * [[VUID-{refpage}-{accessMaskName}-03923]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_SHADING_RATE_IMAGE_READ_BIT_NV, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_SHADING_RATE_IMAGE_BIT_NV,
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
endif::VK_NV_shading_rate_image[]
ifdef::VK_HUAWEI_invocation_mask[]
  * [[VUID-{refpage}-{accessMaskName}-04994]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI
endif::VK_HUAWEI_invocation_mask[]
ifdef::VK_NV_device_generated_commands[]
  * [[VUID-{refpage}-{accessMaskName}-03924]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_COMMAND_PREPROCESS_READ_BIT_NV, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_COMMAND_PREPROCESS_BIT_NV or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03925]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_COMMAND_PREPROCESS_WRITE_BIT_NV, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_COMMAND_PREPROCESS_BIT_NV or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
endif::VK_NV_device_generated_commands[]
ifdef::VK_EXT_blend_operation_advanced[]
  * [[VUID-{refpage}-{accessMaskName}-03926]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT,
    pname:{stageMaskName} must: include
    ename:VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR
    ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
endif::VK_EXT_blend_operation_advanced[]
ifdef::VK_KHR_acceleration_structure,VK_NV_ray_tracing[]
  * [[VUID-{refpage}-{accessMaskName}-03927]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_KHR,
    pname:{stageMaskName} must: include
    ename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR,
    ename:VK_PIPELINE_STAGE_2_RAY_TRACING_SHADER_BIT_KHR, or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-03928]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_ACCELERATION_STRUCTURE_WRITE_BIT_KHR,
    pname:{stageMaskName} must: include
    ename:VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR or
    ename:VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR
endif::VK_KHR_acceleration_structure,VK_NV_ray_tracing[]
ifdef::VK_KHR_video_decode_queue[]
  * [[VUID-{refpage}-{accessMaskName}-04858]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR, pname:{stageMaskName} must:
    include ename:VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-04859]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR
endif::VK_KHR_video_decode_queue[]
ifdef::VK_KHR_video_encode_queue[]
  * [[VUID-{refpage}-{accessMaskName}-04860]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_VIDEO_ENCODE_READ_BIT_KHR, pname:{stageMaskName} must:
    include ename:VK_PIPELINE_STAGE_2_VIDEO_ENCODE_BIT_KHR
  * [[VUID-{refpage}-{accessMaskName}-04861]]
    If pname:{accessMaskName} includes
    ename:VK_ACCESS_2_VIDEO_ENCODE_WRITE_BIT_KHR, pname:{stageMaskName}
    must: include ename:VK_PIPELINE_STAGE_2_VIDEO_ENCODE_BIT_KHR
endif::VK_KHR_video_encode_queue[]
// Common Valid Usage
