// Copyright 2019-2021 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
  * [[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[]
  * [[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>>
  * [[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>>
  * [[VUID-{refpage}-None-02699]]
    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
  * [[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 `<<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
  * [[VUID-{refpage}-None-02705]]
    If the <<features-robustBufferAccess,robust buffer access>> 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
  * [[VUID-{refpage}-None-02706]]
    If the <<features-robustBufferAccess,robust buffer access>> 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
ifdef::VK_VERSION_1_1[]
  * [[VUID-{refpage}-commandBuffer-02707]]
    If pname:commandBuffer is an unprotected command buffer, any resource
    accessed by the sname:VkPipeline object bound to the pipeline bind point
    used by this command must: not be a protected resource
endif::VK_VERSION_1_1[]
  * [[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 channel
    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 channel 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 channel
    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 channel 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[]
// Common Valid Usage
