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

// Common Valid Usage
// Common to all dispatch and drawing commands
  * [[VUID-{refpage}-magFilter-04553]]
    If a slink:VkSampler created with pname:magFilter or pname:minFilter
    equal to ename:VK_FILTER_LINEAR and pname:compareEnable equal to
    ename:VK_FALSE is used to sample a slink:VkImageView as a result of this
    command, then the image view's
    <<resources-image-view-format-features,format features>> must: contain
    ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
  * [[VUID-{refpage}-mipmapMode-04770]]
    If a slink:VkSampler created with pname:mipmapMode equal to
    ename:VK_SAMPLER_MIPMAP_MODE_LINEAR and pname:compareEnable equal to
    ename:VK_FALSE is used to sample a slink:VkImageView as a result of this
    command, then the image view's
    <<resources-image-view-format-features,format features>> must: contain
    ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
ifndef::VK_VERSION_1_3,VK_KHR_format_feature_flags2[]
  * [[VUID-{refpage}-aspectMask-06478]]
    If a slink:VkImageView is sampled with
    <<textures-depth-compare-operation,depth comparison>>, the image view
    must: have been created with an pname:aspectMask that contains
    ename:VK_IMAGE_ASPECT_DEPTH_BIT
endif::VK_VERSION_1_3,VK_KHR_format_feature_flags2[]
ifdef::VK_VERSION_1_3,VK_KHR_format_feature_flags2[]
  * [[VUID-{refpage}-None-06479]]
    If a slink:VkImageView is sampled with
    <<textures-depth-compare-operation,depth comparison>>, the image view's
    <<resources-image-view-format-features,format features>> must: contain
    ename:VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT
endif::VK_VERSION_1_3,VK_KHR_format_feature_flags2[]
  * [[VUID-{refpage}-None-02691]]
    If a sname:VkImageView is accessed using atomic operations as a result
    of this command, then the image view's
    <<resources-image-view-format-features,format features>> must: contain
    ename:VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT
ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[]
  * [[VUID-{refpage}-None-02692]]
    If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_EXT as a
    result of this command, then the image view's
    <<resources-image-view-format-features,format features>> must: contain
    ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT
ifndef::VK_EXT_filter_cubic[]
  * [[VUID-{refpage}-None-02693]]
    Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a
    result of this command must: not have a elink:VkImageViewType of
    ename:VK_IMAGE_VIEW_TYPE_3D, ename:VK_IMAGE_VIEW_TYPE_CUBE, or
    ename:VK_IMAGE_VIEW_TYPE_CUBE_ARRAY
endif::VK_EXT_filter_cubic[]
ifdef::VK_EXT_filter_cubic[]
  * [[VUID-{refpage}-filterCubic-02694]]
    Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a
    result of this command must: have a elink:VkImageViewType and format
    that supports cubic filtering, as specified by
    sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubic
    returned by fname:vkGetPhysicalDeviceImageFormatProperties2
  * [[VUID-{refpage}-filterCubicMinmax-02695]]
    Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT with
    a reduction mode of either ename:VK_SAMPLER_REDUCTION_MODE_MIN or
    ename:VK_SAMPLER_REDUCTION_MODE_MAX as a result of this command must:
    have a elink:VkImageViewType and format that supports cubic filtering
    together with minmax filtering, as specified by
    sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubicMinmax
    returned by fname:vkGetPhysicalDeviceImageFormatProperties2
endif::VK_EXT_filter_cubic[]
endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[]
ifdef::VK_NV_corner_sampled_image[]
  * [[VUID-{refpage}-flags-02696]]
    Any slink:VkImage created with a slink:VkImageCreateInfo::pname:flags
    containing ename:VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV sampled as a
    result of this command must: only be sampled using a
    elink:VkSamplerAddressMode of
    ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE
endif::VK_NV_corner_sampled_image[]
ifdef::VK_VERSION_1_3,VK_KHR_format_feature_flags2[]
  * [[VUID-{refpage}-OpTypeImage-07027]]
    For any slink:VkImageView being written as a storage image where the
    image format field of the code:OpTypeImage is code:Unknown, the view's
    <<resources-image-view-format-features,format features>> must: contain
    ename:VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT
  * [[VUID-{refpage}-OpTypeImage-07028]]
    For any slink:VkImageView being read as a storage image where the image
    format field of the code:OpTypeImage is code:Unknown, the view's
    <<resources-image-view-format-features,format features>> must: contain
    ename:VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT
  * [[VUID-{refpage}-OpTypeImage-07029]]
    For any slink:VkBufferView being written as a storage texel buffer where
    the image format field of the code:OpTypeImage is code:Unknown, the
    view's <<VkFormatProperties3,buffer features>> must: contain
    ename:VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT
  * [[VUID-{refpage}-OpTypeImage-07030]]
    Any slink:VkBufferView being read as a storage texel buffer where the
    image format field of the code:OpTypeImage is code:Unknown then the
    view's <<VkFormatProperties3,buffer features>> must: contain
    ename:VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT
endif::VK_VERSION_1_3,VK_KHR_format_feature_flags2[]
  * [[VUID-{refpage}-None-02697]]
    For each set _n_ that is statically used by the sname:VkPipeline bound
    to the pipeline bind point used by this command, a descriptor set must:
    have been bound to _n_ at the same pipeline bind point, with a
    sname:VkPipelineLayout that is compatible for set _n_, with the
    sname:VkPipelineLayout used to create the current sname:VkPipeline, as
    described in <<descriptorsets-compatibility>>
ifndef::VK_VERSION_1_3,VK_KHR_maintenance4[]
  * [[VUID-{refpage}-None-02698]]
    For each push constant that is statically used by the sname:VkPipeline
    bound to the pipeline bind point used by this command, a push constant
    value must: have been set for the same pipeline bind point, with a
    sname:VkPipelineLayout that is compatible for push constants, with the
    sname:VkPipelineLayout used to create the current sname:VkPipeline, as
    described in <<descriptorsets-compatibility>>
endif::VK_VERSION_1_3,VK_KHR_maintenance4[]
ifdef::VK_VERSION_1_3,VK_KHR_maintenance4[]
  * [[VUID-{refpage}-maintenance4-06425]]
    If the <<features-maintenance4, pname:maintenance4>> feature is not
    enabled, then for each push constant that is statically used by the
    sname:VkPipeline bound to the pipeline bind point used by this command,
    a push constant value must: have been set for the same pipeline bind
    point, with a sname:VkPipelineLayout that is compatible for push
    constants, with the sname:VkPipelineLayout used to create the current
    sname:VkPipeline, as described in <<descriptorsets-compatibility>>
endif::VK_VERSION_1_3,VK_KHR_maintenance4[]
ifndef::VK_EXT_descriptor_buffer[]
  * [[VUID-{refpage}-None-02699]]
    Descriptors in each bound descriptor set, specified via
    fname:vkCmdBindDescriptorSets, must: be valid as described by
    <<descriptor-validity,descriptor validity>> if they are statically used
    by the sname:VkPipeline bound to the pipeline bind point used by this
    command
endif::VK_EXT_descriptor_buffer[]
ifdef::VK_EXT_descriptor_buffer[]
  * [[VUID-{refpage}-None-08114]]
    Descriptors in each bound descriptor set, specified via
    fname:vkCmdBindDescriptorSets, must: be valid if they are statically
    used by the sname:VkPipeline bound to the pipeline bind point used by
    this command and the bound sname:VkPipeline was not created with
    ename:VK_PIPELINE_CREATE_DESCRIPTOR_BUFFER_BIT_EXT
  * [[VUID-{refpage}-None-08115]]
    If the descriptors used by the sname:VkPipeline bound to the pipeline
    bind point were specified via fname:vkCmdBindDescriptorSets, the bound
    sname:VkPipeline must: have been created without
    ename:VK_PIPELINE_CREATE_DESCRIPTOR_BUFFER_BIT_EXT
  * [[VUID-{refpage}-None-08116]]
    Descriptors in bound descriptor buffers, specified via
    fname:vkCmdSetDescriptorBufferOffsetsEXT, must: be valid if they are
    dynamically used by the sname:VkPipeline bound to the pipeline bind
    point used by this command and the bound sname:VkPipeline was created
    with ename:VK_PIPELINE_CREATE_DESCRIPTOR_BUFFER_BIT_EXT
  * [[VUID-{refpage}-None-08117]]
    If the descriptors used by the sname:VkPipeline bound to the pipeline
    bind point were specified via fname:vkCmdSetDescriptorBufferOffsetsEXT,
    the bound sname:VkPipeline must: have been created with
    ename:VK_PIPELINE_CREATE_DESCRIPTOR_BUFFER_BIT_EXT
  * [[VUID-{refpage}-None-08119]]
    If a descriptor is dynamically used with a sname:VkPipeline created with
    ename:VK_PIPELINE_CREATE_DESCRIPTOR_BUFFER_BIT_EXT, the descriptor
    memory must: be resident
endif::VK_EXT_descriptor_buffer[]
  * [[VUID-{refpage}-None-02700]]
    A valid pipeline must: be bound to the pipeline bind point used by this
    command
  * [[VUID-{refpage}-commandBuffer-02701]]
    If the sname:VkPipeline object bound to the pipeline bind point used by
    this command requires any dynamic state, that state must: have been set
    or inherited (if the `apiext:VK_NV_inherited_viewport_scissor` extension
    is enabled) for pname:commandBuffer, and done so after any previously
    bound pipeline with the corresponding state not specified as dynamic
  * [[VUID-{refpage}-None-02859]]
    There must: not have been any calls to dynamic state setting commands
    for any state not specified as dynamic in the sname:VkPipeline object
    bound to the pipeline bind point used by this command, since that
    pipeline was bound
  * [[VUID-{refpage}-None-02702]]
    If the sname:VkPipeline object bound to the pipeline bind point used by
    this command accesses a sname:VkSampler object that uses unnormalized
    coordinates, that sampler must: not be used to sample from any
    sname:VkImage with a sname:VkImageView of the type
    ename:VK_IMAGE_VIEW_TYPE_3D, ename:VK_IMAGE_VIEW_TYPE_CUBE,
    ename:VK_IMAGE_VIEW_TYPE_1D_ARRAY, ename:VK_IMAGE_VIEW_TYPE_2D_ARRAY or
    ename:VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, in any shader stage
  * [[VUID-{refpage}-None-02703]]
    If the sname:VkPipeline object bound to the pipeline bind point used by
    this command accesses a sname:VkSampler object that uses unnormalized
    coordinates, that sampler must: not be used with any of the SPIR-V
    `OpImageSample*` or `OpImageSparseSample*` instructions with
    code:ImplicitLod, code:Dref or code:Proj in their name, in any shader
    stage
  * [[VUID-{refpage}-None-02704]]
    If the sname:VkPipeline object bound to the pipeline bind point used by
    this command accesses a sname:VkSampler object that uses unnormalized
    coordinates, that sampler must: not be used with any of the SPIR-V
    `OpImageSample*` or `OpImageSparseSample*` instructions that includes a
    LOD bias or any offset values, in any shader stage
ifndef::VK_EXT_pipeline_robustness[]
  * [[VUID-{refpage}-None-02705]]
    If the <<features-robustBufferAccess, pname:robustBufferAccess>> feature
    is not enabled, and if the sname:VkPipeline object bound to the pipeline
    bind point used by this command accesses a uniform buffer, it must: not
    access values outside of the range of the buffer as specified in the
    descriptor set bound to the same pipeline bind point
endif::VK_EXT_pipeline_robustness[]
ifdef::VK_EXT_pipeline_robustness[]
  * [[VUID-{refpage}-uniformBuffers-06935]]
    If any stage of the sname:VkPipeline object bound to the pipeline bind
    point used by this command accesses a uniform buffer, and that stage was
    created without enabling either
    ename:VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_EXT or
    ename:VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT
    for pname:uniformBuffers, and the <<features-robustBufferAccess,
    pname:robustBufferAccess>> feature is not enabled, that stage must: not
    access values outside of the range of the buffer as specified in the
    descriptor set bound to the same pipeline bind point
endif::VK_EXT_pipeline_robustness[]
ifndef::VK_EXT_pipeline_robustness[]
  * [[VUID-{refpage}-None-02706]]
    If the <<features-robustBufferAccess, pname:robustBufferAccess>> feature
    is not enabled, and if the sname:VkPipeline object bound to the pipeline
    bind point used by this command accesses a storage buffer, it must: not
    access values outside of the range of the buffer as specified in the
    descriptor set bound to the same pipeline bind point
endif::VK_EXT_pipeline_robustness[]
ifdef::VK_EXT_pipeline_robustness[]
  * [[VUID-{refpage}-storageBuffers-06936]]
    If any stage of the sname:VkPipeline object bound to the pipeline bind
    point used by this command accesses a storage buffer, and that stage was
    created without enabling either
    ename:VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_EXT or
    ename:VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT
    for pname:storageBuffers, and the <<features-robustBufferAccess,
    pname:robustBufferAccess>> feature is not enabled, that stage must: not
    access values outside of the range of the buffer as specified in the
    descriptor set bound to the same pipeline bind point
endif::VK_EXT_pipeline_robustness[]
ifdef::VK_VERSION_1_1[]
  * [[VUID-{refpage}-commandBuffer-02707]]
    If pname:commandBuffer is an unprotected command buffer and
    <<limits-protectedNoFault, pname:protectedNoFault>> is not supported,
    any resource accessed by the slink:VkPipeline object bound to the
    pipeline bind point used by this command must: not be a protected
    resource
endif::VK_VERSION_1_1[]
ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
  * [[VUID-{refpage}-None-06550]]
    If the sname:VkPipeline object bound to the pipeline bind point used by
    this command accesses a sname:VkSampler or sname:VkImageView object that
    enables <<samplers-YCbCr-conversion,sampler {YCbCr} conversion>>, that
    object must: only be used with `OpImageSample*` or
    `OpImageSparseSample*` instructions
  * [[VUID-{refpage}-ConstOffset-06551]]
    If the sname:VkPipeline object bound to the pipeline bind point used by
    this command accesses a sname:VkSampler or sname:VkImageView object that
    enables <<samplers-YCbCr-conversion,sampler {YCbCr} conversion>>, that
    object must: not use the code:ConstOffset and code:Offset operands
endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
  * [[VUID-{refpage}-viewType-07752]]
    If a slink:VkImageView is accessed as a result of this command, then the
    image view's pname:viewType must: match the code:Dim operand of the
    code:OpTypeImage as described in <<textures-operation-validation>>
  * [[VUID-{refpage}-format-07753]]
    If a slink:VkImageView is accessed as a result of this command, then the
    image view's pname:format must: match the numeric format from the
    code:Sampled code:Type operand of the code:OpTypeImage as described in
    the SPIR-V Sampled Type column of the <<formats-numericformat>> table
  * [[VUID-{refpage}-None-04115]]
    If a slink:VkImageView is accessed using code:OpImageWrite as a result
    of this command, then the code:Type of the code:Texel operand of that
    instruction must: have at least as many components as the image view's
    format
  * [[VUID-{refpage}-OpImageWrite-04469]]
    If a slink:VkBufferView is accessed using code:OpImageWrite as a result
    of this command, then the code:Type of the code:Texel operand of that
    instruction must: have at least as many components as the buffer view's
    format
ifdef::VK_EXT_shader_image_atomic_int64[]
  * [[VUID-{refpage}-SampledType-04470]]
    If a slink:VkImageView with a elink:VkFormat that has a 64-bit component
    width is accessed as a result of this command, the code:SampledType of
    the code:OpTypeImage operand of that instruction must: have a code:Width
    of 64
  * [[VUID-{refpage}-SampledType-04471]]
    If a slink:VkImageView with a elink:VkFormat that has a component width
    less than 64-bit is accessed as a result of this command, the
    code:SampledType of the code:OpTypeImage operand of that instruction
    must: have a code:Width of 32
  * [[VUID-{refpage}-SampledType-04472]]
    If a slink:VkBufferView with a elink:VkFormat that has a 64-bit
    component width is accessed as a result of this command, the
    code:SampledType of the code:OpTypeImage operand of that instruction
    must: have a code:Width of 64
  * [[VUID-{refpage}-SampledType-04473]]
    If a slink:VkBufferView with a elink:VkFormat that has a component width
    less than 64-bit is accessed as a result of this command, the
    code:SampledType of the code:OpTypeImage operand of that instruction
    must: have a code:Width of 32
  * [[VUID-{refpage}-sparseImageInt64Atomics-04474]]
    If the <<features-sparseImageInt64Atomics,
    pname:sparseImageInt64Atomics>> feature is not enabled, slink:VkImage
    objects created with the ename:VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT flag
    must: not be accessed by atomic instructions through an code:OpTypeImage
    with a code:SampledType with a code:Width of 64 by this command
  * [[VUID-{refpage}-sparseImageInt64Atomics-04475]]
    If the <<features-sparseImageInt64Atomics,
    pname:sparseImageInt64Atomics>> feature is not enabled, slink:VkBuffer
    objects created with the ename:VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT
    flag must: not be accessed by atomic instructions through an
    code:OpTypeImage with a code:SampledType with a code:Width of 64 by this
    command
endif::VK_EXT_shader_image_atomic_int64[]
ifdef::VK_QCOM_image_processing[]
  * [[VUID-{refpage}-OpImageWeightedSampleQCOM-06971]]
    If code:OpImageWeightedSampleQCOM is used to sample a slink:VkImageView
    as a result of this command, then the image view's
    <<resources-image-view-format-features,format features>> must: contain
    ename:VK_FORMAT_FEATURE_2_WEIGHT_SAMPLED_IMAGE_BIT_QCOM
  * [[VUID-{refpage}-OpImageWeightedSampleQCOM-06972]]
    If code:OpImageWeightedSampleQCOM uses a slink:VkImageView as a sample
    weight image as a result of this command, then the image view's
    <<resources-image-view-format-features,format features>> must: contain
    ename:VK_FORMAT_FEATURE_2_WEIGHT_IMAGE_BIT_QCOM
  * [[VUID-{refpage}-OpImageBoxFilterQCOM-06973]]
    If code:OpImageBoxFilterQCOM is used to sample a slink:VkImageView as a
    result of this command, then the image view's
    <<resources-image-view-format-features,format features>> must: contain
    ename:VK_FORMAT_FEATURE_2_BOX_FILTER_SAMPLED_BIT_QCOM
  * [[VUID-{refpage}-OpImageBlockMatchSSDQCOM-06974]]
    If code:OpImageBlockMatchSSDQCOM is used to read from an
    slink:VkImageView as a result of this command, then the image view's
    <<resources-image-view-format-features,format features>> must: contain
    ename:VK_FORMAT_FEATURE_2_BLOCK_MATCHING_BIT_QCOM
  * [[VUID-{refpage}-OpImageBlockMatchSADQCOM-06975]]
    If code:OpImageBlockMatchSADQCOM is used to read from an
    slink:VkImageView as a result of this command, then the image view's
    <<resources-image-view-format-features,format features>> must: contain
    ename:VK_FORMAT_FEATURE_2_BLOCK_MATCHING_BIT_QCOM
  * [[VUID-{refpage}-OpImageBlockMatchSADQCOM-06976]]
    If code:OpImageBlockMatchSADQCOM or OpImageBlockMatchSSDQCOM is used to
    read from a reference image as result of this command, then the
    specified reference coordinates must: not fail
    <<textures-integer-coordinate-validation,integer texel coordinate
    validation>>
  * [[VUID-{refpage}-OpImageWeightedSampleQCOM-06977]]
    If code:OpImageWeightedSampleQCOM, code:OpImageBoxFilterQCOM,
    code:OpImageBlockMatchSSDQCOM, or code:OpImageBlockMatchSADQCOM uses a
    slink:VkSampler as a result of this command, then the sampler must: have
    been created with ename:VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM
  * [[VUID-{refpage}-OpImageWeightedSampleQCOM-06978]]
    If any command other than code:OpImageWeightedSampleQCOM,
    code:OpImageBoxFilterQCOM, code:OpImageBlockMatchSSDQCOM, or
    code:OpImageBlockMatchSADQCOM uses a slink:VkSampler as a result of this
    command, then the sampler must: not have been created with
    ename:VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM
endif::VK_QCOM_image_processing[]
  * [[VUID-{refpage}-None-07288]]
    Any shader invocation executed by this command must:
    <<shaders-termination,terminate>>
// Common Valid Usage
