/ appendices / spirvenv.txt
spirvenv.txt
   1  // Copyright (c) 2015-2019 Khronos Group. This work is licensed under a
   2  // Creative Commons Attribution 4.0 International License; see
   3  // http://creativecommons.org/licenses/by/4.0/
   4  
   5  [appendix]
   6  [[spirvenv]]
   7  = Vulkan Environment for SPIR-V
   8  
   9  Shaders for Vulkan are defined by the <<spirv-spec,Khronos SPIR-V
  10  Specification>> as well as the <<spirv-extended,Khronos SPIR-V Extended
  11  Instructions for GLSL>> Specification.
  12  This appendix defines additional SPIR-V requirements applying to Vulkan
  13  shaders.
  14  
  15  == Versions and Formats
  16  
  17  ifdef::VK_VERSION_1_1[]
  18  A Vulkan 1.1 implementation must: support the 1.0, 1.1, 1.2, and 1.3
  19  versions of SPIR-V and the 1.0 version of the SPIR-V Extended Instructions
  20  for GLSL.
  21  endif::VK_VERSION_1_1[]
  22  ifndef::VK_VERSION_1_1[]
  23  A Vulkan 1.0 implementation must: support the 1.0 version of SPIR-V and the
  24  1.0 version of the SPIR-V Extended Instructions for GLSL.
  25  endif::VK_VERSION_1_1[]
  26  
  27  A SPIR-V module passed into flink:vkCreateShaderModule is interpreted as a
  28  series of 32-bit words in host endianness, with literal strings packed as
  29  described in section 2.2 of the SPIR-V Specification.
  30  The first few words of the SPIR-V module must: be a magic number and a
  31  SPIR-V version number, as described in section 2.3 of the SPIR-V
  32  Specification.
  33  
  34  
  35  [[spirvenv-capabilities]]
  36  == Capabilities
  37  
  38  The SPIR-V capabilities listed below must: be supported if the corresponding
  39  feature or extension is enabled, or if no features or extensions are listed
  40  for that capability.
  41  Extensions are only listed when there is not also a feature bit associated
  42  with that capability.
  43  
  44  [[spirvenv-capabilities-table]]
  45  .List of SPIR-V Capabilities and enabling features or extensions
  46  [options="header"]
  47  |====
  48  | SPIR-V code:OpCapability                | Vulkan feature or extension name
  49  
  50  | code:Matrix                             |
  51  | code:Shader                             |
  52  | code:InputAttachment                    |
  53  | code:Sampled1D                          |
  54  | code:Image1D                            |
  55  | code:SampledBuffer                      |
  56  | code:ImageBuffer                        |
  57  | code:ImageQuery                         |
  58  | code:DerivativeControl                  |
  59  | code:Geometry                           | <<features-geometryShader,geometryShader>>
  60  | code:Tessellation                       | <<features-tessellationShader,tessellationShader>>
  61  | code:Float64                            | <<features-shaderFloat64,shaderFloat64>>
  62  | code:Int64                              | <<features-shaderInt64,shaderInt64>>
  63  ifdef::VK_KHR_shader_atomic_int64[]
  64  [[spirvenv-capabilities-table-int64atomics]]
  65  | code:Int64Atomics                       | <<VK_KHR_shader_atomic_int64,VK_KHR_shader_atomic_int64>>
  66  endif::VK_KHR_shader_atomic_int64[]
  67  | code:Int16                              | <<features-shaderInt16,shaderInt16>>
  68  | code:TessellationPointSize              | <<features-shaderTessellationAndGeometryPointSize,shaderTessellationAndGeometryPointSize>>
  69  | code:GeometryPointSize                  | <<features-shaderTessellationAndGeometryPointSize,shaderTessellationAndGeometryPointSize>>
  70  | code:ImageGatherExtended                | <<features-shaderImageGatherExtended,shaderImageGatherExtended>>
  71  | code:StorageImageMultisample            | <<features-shaderStorageImageMultisample,shaderStorageImageMultisample>>
  72  | code:UniformBufferArrayDynamicIndexing  | <<features-shaderUniformBufferArrayDynamicIndexing,shaderUniformBufferArrayDynamicIndexing>>
  73  | code:SampledImageArrayDynamicIndexing   | <<features-shaderSampledImageArrayDynamicIndexing,shaderSampledImageArrayDynamicIndexing>>
  74  | code:StorageBufferArrayDynamicIndexing  | <<features-shaderStorageBufferArrayDynamicIndexing,shaderStorageBufferArrayDynamicIndexing>>
  75  | code:StorageImageArrayDynamicIndexing   | <<features-shaderStorageImageArrayDynamicIndexing,shaderStorageImageArrayDynamicIndexing>>
  76  | code:ClipDistance                       | <<features-shaderClipDistance,shaderClipDistance>>
  77  | code:CullDistance                       | <<features-shaderCullDistance,shaderCullDistance>>
  78  | code:ImageCubeArray                     | <<features-imageCubeArray,imageCubeArray>>
  79  | code:SampleRateShading                  | <<features-sampleRateShading,sampleRateShading>>
  80  | code:SparseResidency                    | <<features-shaderResourceResidency,shaderResourceResidency>>
  81  | code:MinLod                             | <<features-shaderResourceMinLod,shaderResourceMinLod>>
  82  | code:SampledCubeArray                   | <<features-imageCubeArray,imageCubeArray>>
  83  | code:ImageMSArray                       | <<features-shaderStorageImageMultisample,shaderStorageImageMultisample>>
  84  | code:StorageImageExtendedFormats        |
  85  | code:InterpolationFunction              | <<features-sampleRateShading,sampleRateShading>>
  86  | code:StorageImageReadWithoutFormat      | <<features-shaderStorageImageReadWithoutFormat,shaderStorageImageReadWithoutFormat>>
  87  | code:StorageImageWriteWithoutFormat     | <<features-shaderStorageImageWriteWithoutFormat,shaderStorageImageWriteWithoutFormat>>
  88  | code:MultiViewport                      | <<features-multiViewport,multiViewport>>
  89  ifdef::VK_VERSION_1_1,VK_KHR_shader_draw_parameters[]
  90  | code:DrawParameters                     |
  91  ifdef::VK_VERSION_1_1[]
  92  <<features-shaderDrawParameters,shaderDrawParameters>>
  93  endif::VK_VERSION_1_1[]
  94  ifdef::VK_KHR_shader_draw_parameters+VK_VERSION_1_1[]
  95  or
  96  endif::VK_KHR_shader_draw_parameters+VK_VERSION_1_1[]
  97  ifdef::VK_KHR_shader_draw_parameters[]
  98  <<VK_KHR_shader_draw_parameters>>
  99  endif::VK_KHR_shader_draw_parameters[]
 100  endif::VK_VERSION_1_1,VK_KHR_shader_draw_parameters[]
 101  ifdef::VK_VERSION_1_1,VK_KHR_multiview[]
 102  [[spirvenv-capabilities-multiview]]
 103  | code:MultiView                          |
 104  ifndef::VK_VERSION_1_1[]
 105  <<VK_KHR_multiview,VK_KHR_multiview>>
 106  endif::VK_VERSION_1_1[]
 107  endif::VK_VERSION_1_1,VK_KHR_multiview[]
 108  ifdef::VK_VERSION_1_1,VK_KHR_device_group[]
 109  | code:DeviceGroup                        |
 110  ifndef::VK_VERSION_1_1[]
 111  <<VK_KHR_device_group,VK_KHR_device_group>>
 112  endif::VK_VERSION_1_1[]
 113  endif::VK_VERSION_1_1,VK_KHR_device_group[]
 114  ifdef::VK_VERSION_1_1,VK_KHR_variable_pointers[]
 115  [[spirvenv-capabilities-table-variablepointers]]
 116  | code:VariablePointersStorageBuffer      | <<features-variablePointersStorageBuffer,variablePointersStorageBuffer>>
 117  | code:VariablePointers                   | <<features-variablePointers,variablePointers>>
 118  endif::VK_VERSION_1_1,VK_KHR_variable_pointers[]
 119  ifdef::VK_EXT_shader_stencil_export[]
 120  [[spirvenv-capabilities-table-shaderstencilexportext]]
 121  | code:StencilExportEXT                   | `<<VK_EXT_shader_stencil_export>>`
 122  endif::VK_EXT_shader_stencil_export[]
 123  ifdef::VK_EXT_shader_subgroup_ballot[]
 124  [[spirvenv-capabilities-table-subgroupballot]]
 125  | code:SubgroupBallotKHR                  | `<<VK_EXT_shader_subgroup_ballot>>`
 126  endif::VK_EXT_shader_subgroup_ballot[]
 127  ifdef::VK_EXT_shader_subgroup_vote[]
 128  [[spirvenv-capabilities-table-subgroupvote]]
 129  | code:SubgroupVoteKHR                    | `<<VK_EXT_shader_subgroup_vote>>`
 130  endif::VK_EXT_shader_subgroup_vote[]
 131  ifdef::VK_AMD_shader_image_load_store_lod[]
 132  [[spirvenv-capabilities-table-imagereadwritelodamd]]
 133  | code:ImageReadWriteLodAMD               | `<<VK_AMD_shader_image_load_store_lod>>`
 134  endif::VK_AMD_shader_image_load_store_lod[]
 135  ifdef::VK_AMD_texture_gather_bias_lod[]
 136  [[spirvenv-capabilities-table-imagegatherbiaslodamd]]
 137  | code:ImageGatherBiasLodAMD              | `<<VK_AMD_texture_gather_bias_lod>>`
 138  endif::VK_AMD_texture_gather_bias_lod[]
 139  ifdef::VK_AMD_shader_fragment_mask[]
 140  [[spirvenv-capabilities-table-fragmentmaskamd]]
 141  | code:FragmentMaskAMD                    | `<<VK_AMD_shader_fragment_mask>>`
 142  endif::VK_AMD_shader_fragment_mask[]
 143  ifdef::VK_NV_sample_mask_override_coverage[]
 144  [[spirvenv-capabilities-table-samplemaskoverridecoverage]]
 145  | code:SampleMaskOverrideCoverageNV       | `<<VK_NV_sample_mask_override_coverage>>`
 146  endif::VK_NV_sample_mask_override_coverage[]
 147  ifdef::VK_NV_geometry_shader_passthrough[]
 148  [[spirvenv-capabilities-table-geometryshaderpassthrough]]
 149  | code:GeometryShaderPassthroughNV        | `<<VK_NV_geometry_shader_passthrough>>`
 150  endif::VK_NV_geometry_shader_passthrough[]
 151  ifdef::VK_EXT_shader_viewport_index_layer[]
 152  [[spirvenv-capabilities-table-shader-viewport-index-layer]]
 153  | code:ShaderViewportIndexLayerEXT        | `<<VK_EXT_shader_viewport_index_layer>>`
 154  endif::VK_EXT_shader_viewport_index_layer[]
 155  ifdef::VK_NV_viewport_array2[]
 156  [[spirvenv-capabilities-table-viewportarray2]]
 157  | code:ShaderViewportIndexLayerNV         | `<<VK_NV_viewport_array2>>`
 158  | code:ShaderViewportMaskNV               | `<<VK_NV_viewport_array2>>`
 159  endif::VK_NV_viewport_array2[]
 160  ifdef::VK_NVX_multiview_per_view_attributes[]
 161  [[spirvenv-capabilities-table-perviewattributes]]
 162  | code:PerViewAttributesNV                | `<<VK_NVX_multiview_per_view_attributes>>`
 163  endif::VK_NVX_multiview_per_view_attributes[]
 164  ifdef::VK_VERSION_1_1,VK_KHR_16bit_storage[]
 165  [[spirvenv-capabilities-table-16bitstorage]]
 166  | code:StorageBuffer16BitAccess           | <<features-storageBuffer16BitAccess, StorageBuffer16BitAccess>>
 167  | code:UniformAndStorageBuffer16BitAccess | <<features-uniformAndStorageBuffer16BitAccess,UniformAndStorageBuffer16BitAccess>>
 168  | code:StoragePushConstant16              | <<features-storagePushConstant16,storagePushConstant16>>
 169  | code:StorageInputOutput16               | <<features-storageInputOutput16,storageInputOutput16>>
 170  endif::VK_VERSION_1_1,VK_KHR_16bit_storage[]
 171  ifdef::VK_VERSION_1_1[]
 172  [[spirvenv-capabilities-table-subgroup]]
 173  | code:GroupNonUniform                    | <<features-subgroup-basic,VK_SUBGROUP_FEATURE_BASIC_BIT>>
 174  | code:GroupNonUniformVote                | <<features-subgroup-vote,VK_SUBGROUP_FEATURE_VOTE_BIT>>
 175  | code:GroupNonUniformArithmetic          | <<features-subgroup-arithmetic,VK_SUBGROUP_FEATURE_ARITHMETIC_BIT>>
 176  | code:GroupNonUniformBallot              | <<features-subgroup-ballot,VK_SUBGROUP_FEATURE_BALLOT_BIT>>
 177  | code:GroupNonUniformShuffle             | <<features-subgroup-shuffle,VK_SUBGROUP_FEATURE_SHUFFLE_BIT>>
 178  | code:GroupNonUniformShuffleRelative     | <<features-subgroup-shuffle-relative,VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT>>
 179  | code:GroupNonUniformClustered           | <<features-subgroup-clustered,VK_SUBGROUP_FEATURE_CLUSTERED_BIT>>
 180  | code:GroupNonUniformQuad                | <<features-subgroup-quad,VK_SUBGROUP_FEATURE_QUAD_BIT>>
 181  ifdef::VK_NV_shader_subgroup_partitioned[]
 182  | code:GroupNonUniformPartitionedNV       | <<features-subgroup-partitioned,VK_SUBGROUP_FEATURE_PARTITIONED_BIT_NV>>
 183  endif::VK_NV_shader_subgroup_partitioned[]
 184  endif::VK_VERSION_1_1[]
 185  ifdef::VK_EXT_post_depth_coverage[]
 186  [[spirvenv-capabilities-table-postdepthcoverage]]
 187  | code:SampleMaskPostDepthCoverage        | `<<VK_EXT_post_depth_coverage>>`
 188  endif::VK_EXT_post_depth_coverage[]
 189  ifdef::VK_EXT_descriptor_indexing[]
 190  [[spirvenv-capabilities-table-descriptorindexing]]
 191  | code:ShaderNonUniformEXT                   | `<<VK_EXT_descriptor_indexing>>`
 192  | code:RuntimeDescriptorArrayEXT             | <<features-runtimeDescriptorArray,runtimeDescriptorArray>>
 193  | code:InputAttachmentArrayDynamicIndexingEXT | <<features-shaderInputAttachmentArrayDynamicIndexing,shaderInputAttachmentArrayDynamicIndexing>>
 194  | code:UniformTexelBufferArrayDynamicIndexingEXT | <<features-shaderUniformTexelBufferArrayDynamicIndexing,shaderUniformTexelBufferArrayDynamicIndexing>>
 195  | code:StorageTexelBufferArrayDynamicIndexingEXT | <<features-shaderStorageTexelBufferArrayDynamicIndexing,shaderStorageTexelBufferArrayDynamicIndexing>>
 196  | code:UniformBufferArrayNonUniformIndexingEXT | <<features-shaderUniformBufferArrayNonUniformIndexing,shaderUniformBufferArrayNonUniformIndexing>>
 197  | code:SampledImageArrayNonUniformIndexingEXT | <<features-shaderSampledImageArrayNonUniformIndexing,shaderSampledImageArrayNonUniformIndexing>>
 198  | code:StorageBufferArrayNonUniformIndexingEXT | <<features-shaderStorageBufferArrayNonUniformIndexing,shaderStorageBufferArrayNonUniformIndexing>>
 199  | code:StorageImageArrayNonUniformIndexingEXT | <<features-shaderStorageImageArrayNonUniformIndexing,shaderStorageImageArrayNonUniformIndexing>>
 200  | code:InputAttachmentArrayNonUniformIndexingEXT | <<features-shaderInputAttachmentArrayNonUniformIndexing,shaderInputAttachmentArrayNonUniformIndexing>>
 201  | code:UniformTexelBufferArrayNonUniformIndexingEXT | <<features-shaderUniformTexelBufferArrayNonUniformIndexing,shaderUniformTexelBufferArrayNonUniformIndexing>>
 202  | code:StorageTexelBufferArrayNonUniformIndexingEXT | <<features-shaderStorageTexelBufferArrayNonUniformIndexing,shaderStorageTexelBufferArrayNonUniformIndexing>>
 203  endif::VK_EXT_descriptor_indexing[]
 204  ifdef::VK_KHR_shader_float16_int8,VK_AMD_gpu_shader_half_float[]
 205  | code:Float16                            |
 206  ifdef::VK_KHR_shader_float16_int8[]
 207                                              <<features-shaderFloat16,shaderFloat16>>
 208  endif::VK_KHR_shader_float16_int8[]
 209  ifdef::VK_KHR_shader_float16_int8+VK_AMD_gpu_shader_half_float[or]
 210  ifdef::VK_AMD_gpu_shader_half_float[]
 211                                              `<<VK_AMD_gpu_shader_half_float>>`
 212  endif::VK_AMD_gpu_shader_half_float[]
 213  endif::VK_KHR_shader_float16_int8,VK_AMD_gpu_shader_half_float[]
 214  ifdef::VK_KHR_shader_float16_int8[]
 215  | code:Int8                               | <<features-shaderInt8,shaderInt8>>
 216  endif::VK_KHR_shader_float16_int8[]
 217  ifdef::VK_KHR_8bit_storage[]
 218  [[spirvenv-capabilities-table-8bitstorage]]
 219  | code:StorageBuffer8BitAccess            | <<features-storageBuffer8BitAccess,StorageBuffer8BitAccess>>
 220  | code:UniformAndStorageBuffer8BitAccess  | <<features-uniformAndStorageBuffer8BitAccess,UniformAndStorageBuffer8BitAccess>>
 221  | code:StoragePushConstant8               | <<features-storagePushConstant8,StoragePushConstant8>>
 222  endif::VK_KHR_8bit_storage[]
 223  ifdef::VK_KHR_vulkan_memory_model[]
 224  [[spirvenv-capabilities-table-memorymodel]]
 225  | code:VulkanMemoryModelKHR               | <<features-vulkanMemoryModel,vulkanMemoryModel>>
 226  | code:VulkanMemoryModelDeviceScopeKHR    | <<features-vulkanMemoryModel,vulkanMemoryModelDeviceScope>>
 227  endif::VK_KHR_vulkan_memory_model[]
 228  ifdef::VK_KHR_shader_float_controls[]
 229  [[spirvenv-capabilities-table-shaderfloatcontrols]]
 230  | code:DenormPreserve            | <<features-shaderDenormPreserveFloat16,shaderDenormPreserveFloat16>>, <<features-shaderDenormPreserveFloat32,shaderDenormPreserveFloat32>>, <<features-shaderDenormPreserveFloat64,shaderDenormPreserveFloat64>>
 231  | code:DenormFlushToZero         | <<features-shaderDenormFlushToZeroFloat16,shaderDenormFlushToZeroFloat16>>, <<features-shaderDenormFlushToZeroFloat32,shaderDenormFlushToZeroFloat32>>, <<features-shaderDenormFlushToZeroFloat64,shaderDenormFlushToZeroFloat64>>
 232  | code:SignedZeroInfNanPreserve  | <<features-shaderSignedZeroInfNanPreserveFloat16,shaderSignedZeroInfNanPreserveFloat16>>, <<features-shaderSignedZeroInfNanPreserveFloat32,shaderSignedZeroInfNanPreserveFloat32>>, <<features-shaderSignedZeroInfNanPreserveFloat64,shaderSignedZeroInfNanPreserveFloat64>>
 233  | code:RoundingModeRTE           | <<features-shaderRoundingModeRTEFloat16,shaderRoundingModeRTEFloat16>>, <<features-shaderRoundingModeRTEFloat32,shaderRoundingModeRTEFloat32>>, <<features-shaderRoundingModeRTEFloat64,shaderRoundingModeRTEFloat64>>
 234  | code:RoundingModeRTZ           | <<features-shaderRoundingModeRTZFloat16,shaderRoundingModeRTZFloat16>>, <<features-shaderRoundingModeRTZFloat32,shaderRoundingModeRTZFloat32>>, <<features-shaderRoundingModeRTZFloat64,shaderRoundingModeRTZFloat64>>
 235  endif::VK_KHR_shader_float_controls[]
 236  ifdef::VK_NV_compute_shader_derivatives[]
 237  [[spirvenv-capabilities-table-computederivatives-quads]]
 238  | code:ComputeDerivativeGroupQuadsNV      | <<features-computeShaderDerivativesQuads,computeDerivativeGroupQuads>>
 239  [[spirvenv-capabilities-table-computederivatives-linear]]
 240  | code:ComputeDerivativeGroupLinearNV     | <<features-computeShaderDerivativesLinear,computeDerivativeGroupLinear>>
 241  endif::VK_NV_compute_shader_derivatives[]
 242  ifdef::VK_NV_fragment_shader_barycentric[]
 243  [[spirvenv-capabilities-fragment-barycentric]]
 244  | code:FragmentBarycentricNV              | <<features-fragmentShaderBarycentric,fragmentShaderBarycentric>>
 245  endif::VK_NV_fragment_shader_barycentric[]
 246  ifdef::VK_NV_shader_image_footprint[]
 247  [[spirvenv-capabilities-table-imagefootprint]]
 248  | code:ImageFootprintNV                   | <<features-imageFootprint,imageFootprint>>
 249  endif::VK_NV_shader_image_footprint[]
 250  ifdef::VK_NV_shading_rate_image[]
 251  | code:ShadingRateImageNV | <<features-shadingRateImage,shadingRateImage>>
 252  endif::VK_NV_shading_rate_image[]
 253  ifdef::VK_NV_mesh_shader[]
 254  [[spirvenv-capabilities-table-meshshading]]
 255  | code:MeshShadingNV                      | `<<VK_NV_mesh_shader>>`
 256  endif::VK_NV_mesh_shader[]
 257  ifdef::VK_NV_ray_tracing[]
 258  [[spirvenv-capabilities-table-raytracing]]
 259  | code:RayTracingNV                       | `<<VK_NV_ray_tracing>>`
 260  endif::VK_NV_ray_tracing[]
 261  ifdef::VK_EXT_transform_feedback[]
 262  | code:TransformFeedback                  | <<features-transformFeedback,transformFeedback>>
 263  | code:GeometryStreams                    | <<features-geometryStreams,geometryStreams>>
 264  endif::VK_EXT_transform_feedback[]
 265  ifdef::VK_EXT_fragment_density_map[]
 266  [[spirvenv-capabilities-table-fragmentdensity]]
 267  | code:FragmentDensityEXT                 | <<features-fragmentdensitymap,fragmentDensityMap>>
 268  endif::VK_EXT_fragment_density_map[]
 269  ifdef::VK_EXT_buffer_device_address[]
 270  [[spirvenv-capabilities-table-physicalstoragebufferaddresses]]
 271  | code:PhysicalStorageBufferAddressesEXT  | <<features-bufferDeviceAddress,bufferDeviceAddress>>
 272  endif::VK_EXT_buffer_device_address[]
 273  ifdef::VK_NV_cooperative_matrix[]
 274  [[spirvenv-capabilities-table-cooperativeMatrix]]
 275  | code:CooperativeMatrixNV  | <<features-cooperativeMatrix,cooperativeMatrix>>
 276  endif::VK_NV_cooperative_matrix[]
 277  ifdef::VK_INTEL_shader_integer_functions2[]
 278  [[spirvenv-capabilities-table-shaderIntegerFunctions2]]
 279  | code:ShaderIntegerFunctions2INTEL  | <<features-shaderIntegerFunctions2,shaderIntegerFunctions2>>
 280  endif::VK_INTEL_shader_integer_functions2[]
 281  ifdef::VK_NV_shader_sm_builtins[]
 282  [[spirvenv-capabilities-table-shadersmbuiltins]]
 283  | code:ShaderSMBuiltinsNV    | <<features-features-shadersmbuiltins,shaderSMBuiltins>>
 284  endif::VK_NV_shader_sm_builtins[]
 285  ifdef::VK_EXT_fragment_shader_interlock[]
 286  [[spirvenv-capabilities-table-fragmentShaderInterlock]]
 287  | code:FragmentShaderSampleInterlockEXT  | <<features-features-fragmentShaderSampleInterlock,fragmentShaderSampleInterlock>>
 288  | code:FragmentShaderPixelInterlockEXT  | <<features-features-fragmentShaderPixelInterlock,fragmentShaderPixelInterlock>>
 289  ifdef::VK_NV_shading_rate_image[]
 290  | code:FragmentShaderShadingRateInterlockEXT  | <<features-features-fragmentShaderShadingRateInterlock,fragmentShaderShadingRateInterlock>>, <<features-shadingRateImage,shadingRateImage>>
 291  endif::VK_NV_shading_rate_image[]
 292  endif::VK_EXT_fragment_shader_interlock[]
 293  ifdef::VK_EXT_shader_demote_to_helper_invocation[]
 294  [[spirvenv-capabilities-table-demote]]
 295  | code:DemoteToHelperInvocationEXT    | <<features-features-shaderDemoteToHelperInvocation,shaderDemoteToHelperInvocation>>
 296  endif::VK_EXT_shader_demote_to_helper_invocation[]
 297  |====
 298  
 299  ifdef::VK_VERSION_1_1,VK_KHR_variable_pointers[]
 300  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 301  uses the `SPV_KHR_variable_pointers` SPIR-V extension.
 302  endif::VK_VERSION_1_1,VK_KHR_variable_pointers[]
 303  
 304  ifdef::VK_AMD_shader_explicit_vertex_parameter[]
 305  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 306  uses the `SPV_AMD_shader_explicit_vertex_parameter` SPIR-V extension.
 307  endif::VK_AMD_shader_explicit_vertex_parameter[]
 308  
 309  ifdef::VK_AMD_gcn_shader[]
 310  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 311  uses the `SPV_AMD_gcn_shader` SPIR-V extension.
 312  endif::VK_AMD_gcn_shader[]
 313  
 314  ifdef::VK_AMD_gpu_shader_half_float[]
 315  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 316  uses the `SPV_AMD_gpu_shader_half_float` SPIR-V extension.
 317  endif::VK_AMD_gpu_shader_half_float[]
 318  
 319  ifdef::VK_AMD_gpu_shader_int16[]
 320  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 321  uses the `SPV_AMD_gpu_shader_int16` SPIR-V extension.
 322  endif::VK_AMD_gpu_shader_int16[]
 323  
 324  ifdef::VK_AMD_shader_ballot[]
 325  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 326  uses the `SPV_AMD_shader_ballot` SPIR-V extension.
 327  endif::VK_AMD_shader_ballot[]
 328  
 329  ifdef::VK_AMD_shader_fragment_mask[]
 330  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 331  uses the `SPV_AMD_shader_fragment_mask` SPIR-V extension.
 332  endif::VK_AMD_shader_fragment_mask[]
 333  
 334  ifdef::VK_AMD_shader_image_load_store_lod[]
 335  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 336  uses the `SPV_AMD_shader_image_load_store_lod` SPIR-V extension.
 337  endif::VK_AMD_shader_image_load_store_lod[]
 338  
 339  ifdef::VK_AMD_shader_trinary_minmax[]
 340  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 341  uses the `SPV_AMD_shader_trinary_minmax` SPIR-V extension.
 342  endif::VK_AMD_shader_trinary_minmax[]
 343  
 344  ifdef::VK_AMD_texture_gather_bias_lod[]
 345  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 346  uses the `SPV_AMD_texture_gather_bias_lod` SPIR-V extension.
 347  endif::VK_AMD_texture_gather_bias_lod[]
 348  
 349  ifdef::VK_VERSION_1_1,VK_KHR_shader_draw_parameters[]
 350  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 351  uses the `SPV_KHR_shader_draw_parameters` SPIR-V extension.
 352  endif::VK_VERSION_1_1,VK_KHR_shader_draw_parameters[]
 353  
 354  ifdef::VK_KHR_8bit_storage[]
 355  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 356  uses the `SPV_KHR_8bit_storage` SPIR-V extension.
 357  endif::VK_KHR_8bit_storage[]
 358  
 359  ifdef::VK_VERSION_1_1,VK_KHR_16bit_storage[]
 360  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 361  uses the
 362  https://www.khronos.org/registry/spir-v/extensions/KHR/SPV_KHR_16bit_storage.html[`SPV_KHR_16bit_storage`]
 363  SPIR-V extension.
 364  endif::VK_VERSION_1_1,VK_KHR_16bit_storage[]
 365  
 366  ifdef::VK_KHR_shader_float_controls[]
 367  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 368  uses the
 369  https://www.khronos.org/registry/spir-v/extensions/KHR/SPV_KHR_float_controls.html[`SPV_KHR_float_controls`]
 370  SPIR-V extension.
 371  endif::VK_KHR_shader_float_controls[]
 372  
 373  ifdef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 374  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 375  uses the
 376  https://www.khronos.org/registry/spir-v/extensions/KHR/SPV_KHR_storage_buffer_storage_class.html[`SPV_KHR_storage_buffer_storage_class`]
 377  SPIR-V extension.
 378  endif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 379  
 380  ifdef::VK_EXT_post_depth_coverage[]
 381  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 382  uses the `SPV_KHR_post_depth_coverage` SPIR-V extension.
 383  endif::VK_EXT_post_depth_coverage[]
 384  
 385  ifdef::VK_EXT_shader_stencil_export[]
 386  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 387  uses the `SPV_EXT_shader_stencil_export` SPIR-V extension.
 388  endif::VK_EXT_shader_stencil_export[]
 389  
 390  ifdef::VK_EXT_shader_subgroup_ballot[]
 391  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 392  uses the `SPV_KHR_shader_ballot` SPIR-V extension.
 393  endif::VK_EXT_shader_subgroup_ballot[]
 394  
 395  ifdef::VK_EXT_shader_subgroup_vote[]
 396  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 397  uses the `SPV_KHR_subgroup_vote` SPIR-V extension.
 398  endif::VK_EXT_shader_subgroup_vote[]
 399  
 400  ifdef::VK_NV_sample_mask_override_coverage[]
 401  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 402  uses the `SPV_NV_sample_mask_override_coverage` SPIR-V extension.
 403  endif::VK_NV_sample_mask_override_coverage[]
 404  
 405  ifdef::VK_NV_geometry_shader_passthrough[]
 406  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 407  uses the `SPV_NV_geometry_shader_passthrough` SPIR-V extension.
 408  endif::VK_NV_geometry_shader_passthrough[]
 409  
 410  ifdef::VK_NV_mesh_shader[]
 411  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 412  uses the `SPV_NV_mesh_shader` SPIR-V extension.
 413  endif::VK_NV_mesh_shader[]
 414  
 415  ifdef::VK_NV_viewport_array2[]
 416  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 417  uses the `SPV_NV_viewport_array2` SPIR-V extension.
 418  endif::VK_NV_viewport_array2[]
 419  
 420  ifdef::VK_NV_shader_subgroup_partitioned[]
 421  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 422  uses the `SPV_NV_shader_subgroup_partitioned` SPIR-V extension.
 423  endif::VK_NV_shader_subgroup_partitioned[]
 424  
 425  ifdef::VK_EXT_shader_viewport_index_layer[]
 426  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 427  uses the `SPV_EXT_shader_viewport_index_layer` SPIR-V extension.
 428  endif::VK_EXT_shader_viewport_index_layer[]
 429  
 430  ifdef::VK_NVX_multiview_per_view_attributes[]
 431  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 432  uses the `SPV_NVX_multiview_per_view_attributes` SPIR-V extension.
 433  endif::VK_NVX_multiview_per_view_attributes[]
 434  
 435  ifdef::VK_EXT_descriptor_indexing[]
 436  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 437  uses the `SPV_EXT_descriptor_indexing` SPIR-V extension.
 438  endif::VK_EXT_descriptor_indexing[]
 439  
 440  ifdef::VK_KHR_vulkan_memory_model[]
 441  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 442  uses the `SPV_KHR_vulkan_memory_model` SPIR-V extension.
 443  endif::VK_KHR_vulkan_memory_model[]
 444  
 445  ifdef::VK_NV_compute_shader_derivatives[]
 446  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 447  uses the `SPV_NV_compute_shader_derivatives` SPIR-V extension.
 448  endif::VK_NV_compute_shader_derivatives[]
 449  
 450  ifdef::VK_NV_fragment_shader_barycentric[]
 451  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 452  uses the `SPV_NV_fragment_shader_barycentric` SPIR-V extension.
 453  endif::VK_NV_fragment_shader_barycentric[]
 454  
 455  ifdef::VK_NV_shader_image_footprint[]
 456  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 457  uses the `SPV_NV_shader_image_footprint` SPIR-V extension.
 458  endif::VK_NV_shader_image_footprint[]
 459  
 460  ifdef::VK_NV_shading_rate_image[]
 461  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 462  uses the `SPV_NV_shading_rate` SPIR-V extension.
 463  endif::VK_NV_shading_rate_image[]
 464  
 465  ifdef::VK_NV_ray_tracing[]
 466  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 467  uses the `SPV_NV_ray_tracing` SPIR-V extension.
 468  endif::VK_NV_ray_tracing[]
 469  
 470  ifdef::VK_GOOGLE_hlsl_functionality1[]
 471  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 472  uses the `SPV_GOOGLE_hlsl_functionality1` SPIR-V extension.
 473  endif::VK_GOOGLE_hlsl_functionality1[]
 474  
 475  ifdef::VK_GOOGLE_decorate_string[]
 476  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 477  uses the `SPV_GOOGLE_decorate_string` SPIR-V extension.
 478  endif::VK_GOOGLE_decorate_string[]
 479  
 480  ifdef::VK_EXT_fragment_density_map[]
 481  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 482  uses the `SPV_EXT_fragment_invocation_density` SPIR-V extension.
 483  endif::VK_EXT_fragment_density_map[]
 484  
 485  ifdef::VK_EXT_buffer_device_address[]
 486  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 487  uses the `SPV_EXT_physical_storage_buffer` SPIR-V extension.
 488  endif::VK_EXT_buffer_device_address[]
 489  
 490  ifdef::VK_NV_cooperative_matrix[]
 491  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 492  uses the `SPV_NV_cooperative_matrix` SPIR-V extension.
 493  endif::VK_NV_cooperative_matrix[]
 494  
 495  ifdef::VK_NV_shader_sm_builtins[]
 496  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 497  uses the `SPV_NV_shader_sm_builtins` SPIR-V extension.
 498  endif::VK_NV_shader_sm_builtins[]
 499  
 500  ifdef::VK_EXT_fragment_shader_interlock[]
 501  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 502  uses the `SPV_EXT_fragment_shader_interlock` SPIR-V extension.
 503  endif::VK_EXT_fragment_shader_interlock[]
 504  
 505  ifdef::VK_EXT_shader_demote_to_helper_invocation[]
 506  The application can: pass a SPIR-V module to flink:vkCreateShaderModule that
 507  uses the `SPV_EXT_demote_to_helper_invocation` SPIR-V extension.
 508  endif::VK_EXT_shader_demote_to_helper_invocation[]
 509  
 510  The application must: not pass a SPIR-V module containing any of the
 511  following to flink:vkCreateShaderModule:
 512  
 513    * any OpCapability not listed above,
 514    * an unsupported capability, or
 515    * a capability which corresponds to a Vulkan feature or extension which
 516      has not been enabled.
 517  
 518  
 519  [[spirvenv-module-validation]]
 520  == Validation Rules within a Module
 521  
 522  A SPIR-V module passed to flink:vkCreateShaderModule must: conform to the
 523  following rules:
 524  
 525    * Every entry point must: have no return value and accept no arguments.
 526    * Recursion: The static function-call graph for an entry point must: not
 527      contain cycles.
 528    * The *Logical* addressing model must: be selected.
 529    * *Scope* for execution must: be limited to:
 530    ** *Workgroup*
 531    ** *Subgroup*
 532    * *Scope* for memory must: be limited to:
 533    ** *Device*
 534  ifdef::VK_KHR_vulkan_memory_model[]
 535    *** If <<features-vulkanMemoryModel,pname:vulkanMemoryModel>> is enabled
 536        and
 537        <<features-vulkanMemoryModelDeviceScope,pname:vulkanMemoryModelDeviceScope>>
 538        is not enabled, *Device* scope must: not be used.
 539    *** If <<features-vulkanMemoryModel,pname:vulkanMemoryModel>> is not
 540        enabled, *Device* scope only extends to the queue family, not the
 541        whole device.
 542  endif::VK_KHR_vulkan_memory_model[]
 543  ifndef::VK_KHR_vulkan_memory_model[]
 544    *** *Device* scope only extends to the queue family, not the whole device.
 545  endif::VK_KHR_vulkan_memory_model[]
 546  ifdef::VK_KHR_vulkan_memory_model[]
 547    ** *QueueFamilyKHR*
 548    *** If <<features-vulkanMemoryModel,pname:vulkanMemoryModel>> is not
 549        enabled, *QueueFamilyKHR* must: not be used.
 550  endif::VK_KHR_vulkan_memory_model[]
 551    ** *Workgroup*
 552  ifdef::VK_VERSION_1_1[]
 553    ** *Subgroup*
 554  endif::VK_VERSION_1_1[]
 555    ** *Invocation*
 556  ifdef::VK_VERSION_1_1[]
 557    * *Scope* for *Non Uniform Group Operations* must: be limited to:
 558    ** *Subgroup*
 559  endif::VK_VERSION_1_1[]
 560    * *Storage Class* must: be limited to:
 561    ** *UniformConstant*
 562    ** *Input*
 563    ** *Uniform*
 564    ** *Output*
 565    ** *Workgroup*
 566    ** *Private*
 567    ** *Function*
 568    ** *PushConstant*
 569    ** *Image*
 570  ifdef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 571    ** *StorageBuffer*
 572  endif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 573  ifdef::VK_NV_ray_tracing[]
 574    ** *RayPayloadNV*
 575    ** *IncomingRayPayloadNV*
 576    ** *HitAttributeNV*
 577    ** *CallableDataNV*
 578    ** *IncomingCallableDataNV*
 579    ** *ShaderRecordBufferNV*
 580  endif::VK_NV_ray_tracing[]
 581  ifdef::VK_EXT_buffer_device_address[]
 582    ** *PhysicalStorageBufferEXT*
 583  endif::VK_EXT_buffer_device_address[]
 584    * Memory semantics must: obey the following rules:
 585    ** *Acquire* must: not be used with code:OpAtomicStore.
 586    ** *Release* must: not be used with code:OpAtomicLoad.
 587    ** *AcquireRelease* must: not be used with code:OpAtomicStore or
 588       code:OpAtomicLoad.
 589    ** Sequentially consistent atomics and barriers are not supported and
 590       *SequentiallyConsistent* is treated as *AcquireRelease*.
 591       *SequentiallyConsistent* should: not be used.
 592    ** code:OpMemoryBarrier must: use one of *Acquire*, *Release*,
 593       *AcquireRelease*, or *SequentiallyConsistent* and must: include at
 594       least one storage class.
 595    ** If the semantics for code:OpControlBarrier includes one of *Acquire*,
 596       *Release*, *AcquireRelease*, or *SequentiallyConsistent*, then it must:
 597       include at least one storage class.
 598    ** *SubgroupMemory*, *CrossWorkgroupMemory*, and *AtomicCounterMemory* are
 599       ignored.
 600  ifdef::VK_KHR_shader_float16_int8+!VK_KHR_8bit_storage[]
 601    * Any code:OpVariable with the result type pointing to an 8-bit integer
 602      object or an object containing an 8-bit integer element must: not have
 603      one of the following as its code:Storage code:Class operand:
 604    ** *Uniform*
 605    ** *PushConstant*
 606  ifdef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 607    ** *StorageBuffer*
 608  endif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 609  endif::VK_KHR_shader_float16_int8+!VK_KHR_8bit_storage[]
 610  ifdef::VK_KHR_shader_float16_int8+!VK_KHR_16bit_storage[]
 611    * Any code:OpVariable with the result type pointing to a 16-bit
 612      floating-point object or an object containing a 16-bit floating-point
 613      element must: not have one of the following as its code:Storage
 614      code:Class operand:
 615    ** *Uniform*
 616    ** *PushConstant*
 617  ifdef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 618    ** *StorageBuffer*
 619  endif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 620  endif::VK_KHR_shader_float16_int8+!VK_KHR_16bit_storage[]
 621    * Any code:OpVariable with an code:Initializer operand must: have one of
 622      the following as its *Storage Class* operand:
 623    ** *Output*
 624    ** *Private*
 625    ** *Function*
 626    * The code:OriginLowerLeft execution mode must: not be used; fragment
 627      entry points must: declare code:OriginUpperLeft.
 628    * The code:PixelCenterInteger execution mode must: not be used.
 629      Pixels are always centered at half-integer coordinates.
 630    * Images and Samplers
 631    ** code:OpTypeImage must: declare a scalar 32-bit float or 32-bit integer
 632       type for the "`Sampled Type`".
 633       (code:RelaxedPrecision can: be applied to a sampling instruction and to
 634       the variable holding the result of a sampling instruction.)
 635    ** code:OpTypeImage must: have a "`Sampled`" operand of 1 (sampled image)
 636       or 2 (storage image).
 637    ** If
 638       <<features-shaderStorageImageReadWithoutFormat,shaderStorageImageReadWithoutFormat>>
 639       is not enabled and an code:OpTypeImage has "`Image Format`" operand of
 640       code:Unknown, any variables created with the given type must be
 641       decorated with code:NonReadable.
 642    ** If
 643       <<features-shaderStorageImageWriteWithoutFormat,shaderStorageImageWriteWithoutFormat>>
 644       is not enabled and an code:OpTypeImage has "`Image Format`" operand of
 645       code:Unknown, any variables created with the given type must be
 646       decorated with code:NonWritable.
 647    ** code:OpImageQuerySizeLod, and code:OpImageQueryLevels must: only
 648       consume an "`Image`" operand whose type has its "`Sampled`" operand set
 649       to 1.
 650    ** The [eq]#(u,v)# coordinates used for a code:SubpassData must: be the
 651       <id> of a constant vector [eq]#(0,0)#, or if a layer coordinate is
 652       used, must: be a vector that was formed with constant 0 for the [eq]#u#
 653       and [eq]#v# components.
 654    ** The "`Depth`" operand of code:OpTypeImage is ignored.
 655    ** Objects of types code:OpTypeImage, code:OpTypeSampler,
 656       code:OpTypeSampledImage, and arrays of these types must: not be stored
 657       to or modified.
 658    * The "`Component`" operand of code:OpImageGather, and
 659      code:OpImageSparseGather must: be the <id> of a constant instruction.
 660    * Structure types must: not contain opaque types.
 661    * Decorations
 662    ** Any code:BuiltIn decoration not listed in
 663       <<interfaces-builtin-variables>> must: not be used.
 664    ** Any code:BuiltIn decoration that corresponds only to Vulkan features or
 665       extensions that have not been enabled must: not be used.
 666    ** The code:GLSLShared and code:GLSLPacked decorations must: not be used.
 667    ** The code:Flat, code:NoPerspective, code:Sample, and code:Centroid
 668       decorations must: not be used on variables with storage class other
 669       than code:Input or on variables used in the interface of non-fragment
 670       shader entry points.
 671    ** The code:Patch decoration must: not be used on variables in the
 672       interface of a vertex, geometry, or fragment shader stage's entry
 673       point.
 674  ifdef::VK_NV_viewport_array2[]
 675    ** The code:ViewportRelativeNV decoration must: only be used on a variable
 676       decorated with code:Layer in the vertex, tessellation evaluation, or
 677       geometry shader stages.
 678    ** The code:ViewportRelativeNV decoration must: not be used unless a
 679       variable decorated with one of code:ViewportIndex or
 680       code:ViewportMaskNV is also statically used by the same
 681       code:OpEntryPoint.
 682    ** The code:ViewportMaskNV and code:ViewportIndex decorations must: not
 683       both be statically used by one or more code:OpEntryPoint's that form
 684       the vertex processing stages of a graphics pipeline.
 685  endif::VK_NV_viewport_array2[]
 686  ifdef::VK_VERSION_1_1,VK_KHR_16bit_storage[]
 687    ** Only the round-to-nearest-even and the round-to-zero rounding modes
 688       can: be used for the code:FPRoundingMode decoration.
 689    ** The code:FPRoundingMode decoration can: only be used for the
 690       floating-point conversion instructions as described in the
 691       https://www.khronos.org/registry/spir-v/extensions/KHR/SPV_KHR_16bit_storage.html[`SPV_KHR_16bit_storage`]
 692       SPIR-V extension.
 693  endif::VK_VERSION_1_1,VK_KHR_16bit_storage[]
 694    ** code:DescriptorSet and code:Binding decorations must: obey the
 695       constraints on storage class, type, and descriptor type described in
 696       <<interfaces-resources-setandbinding,DescriptorSet and Binding
 697       Assignment>>
 698    * code:OpTypeRuntimeArray must: only be used for:
 699    ** the last member of an code:OpTypeStruct
 700  ifdef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 701       that is in the code:StorageBuffer storage class decorated as
 702       code:Block, or
 703  endif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 704  ifdef::VK_EXT_buffer_device_address[]
 705       that is in the code:PhysicalStorageBufferEXT storage class decorated as
 706       code:Block, or
 707  endif::VK_EXT_buffer_device_address[]
 708       that is in the code:Uniform storage class decorated as
 709       code:BufferBlock.
 710  ifdef::VK_EXT_descriptor_indexing[]
 711    ** If the code:RuntimeDescriptorArrayEXT capability is supported, an array
 712       of variables with storage class code:Uniform,
 713  ifdef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 714       code:StorageBuffer,
 715  endif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 716       or code:UniformConstant, or for the outermost dimension of an array of
 717       arrays of such variables.
 718  endif::VK_EXT_descriptor_indexing[]
 719    * Linkage: See <<interfaces,Shader Interfaces>> for additional linking and
 720      validation rules.
 721  ifdef::VK_VERSION_1_1[]
 722    * If code:OpControlBarrier is used in fragment, vertex, tessellation
 723      evaluation, or geometry stages, the execution Scope must: be
 724      code:Subgroup.
 725  endif::VK_VERSION_1_1[]
 726    * Compute Shaders
 727    ** For each compute shader entry point, either a code:LocalSize execution
 728       mode or an object decorated with the code:WorkgroupSize decoration
 729       must: be specified.
 730  ifdef::VK_NV_compute_shader_derivatives[]
 731    ** For compute shaders using the code:DerivativeGroupQuadsNV execution
 732       mode, the first two dimensions of the local workgroup size must: be a
 733       multiple of two.
 734    ** For compute shaders using the code:DerivativeGroupLinearNV execution
 735       mode, the product of the dimensions of the local workgroup size must:
 736       be a multiple of four.
 737  endif::VK_NV_compute_shader_derivatives[]
 738  ifdef::VK_VERSION_1_1[]
 739    * "`Result Type`" for *Non Uniform Group Operations* must: be limited to
 740      32-bit float, 32-bit integer, boolean, or vectors of these types.
 741      If the code:Float64 capability is enabled, double and vectors of double
 742      types are also permitted.
 743    * If code:OpGroupNonUniformBallotBitCount is used, the group operation
 744      must: be one of:
 745    ** *Reduce*
 746    ** *InclusiveScan*
 747    ** *ExclusiveScan*
 748  endif::VK_VERSION_1_1[]
 749    * Atomic instructions must: declare a scalar 32-bit integer type,
 750  ifdef::VK_KHR_shader_atomic_int64[]
 751      or a scalar 64-bit integer type if the code:Int64Atomics capability is
 752      enabled,
 753  endif::VK_KHR_shader_atomic_int64[]
 754      for the value pointed to by _Pointer_.
 755  ifdef::VK_KHR_shader_atomic_int64[]
 756    ** <<features-shaderBufferInt64Atomics,shaderBufferInt64Atomics>> must: be
 757       enabled for 64-bit integer atomic operations to be supported on a
 758       _Pointer_ with a *Storage Class* of
 759  ifdef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 760       *StorageBuffer* or
 761  endif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 762       *Uniform*.
 763    ** <<features-shaderSharedInt64Atomics,shaderSharedInt64Atomics>> must: be
 764       enabled for 64-bit integer atomic operations to be supported on a
 765       _Pointer_ with a *Storage Class* of *Workgroup*.
 766  endif::VK_KHR_shader_atomic_int64[]
 767    * The _Pointer_ operand of all atomic instructions must: have a *Storage
 768      Class* limited to:
 769    ** *Uniform*
 770    ** *Workgroup*
 771    ** *Image*
 772  ifdef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 773    ** *StorageBuffer*
 774  endif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[]
 775  ifdef::VK_EXT_descriptor_indexing[]
 776    * If an instruction loads from or stores to a resource (including atomics
 777      and image instructions) and the resource descriptor being accessed is
 778      not dynamically uniform, then the operand corresponding to that resource
 779      (e.g. the pointer or sampled image operand) must: be decorated with
 780      code:NonUniformEXT.
 781  endif::VK_EXT_descriptor_indexing[]
 782  ifdef::VK_KHR_shader_float_controls[]
 783    * If <<features-separateDenormSettings,pname:separateDenormSettings>> is
 784      ename:VK_FALSE, then the entry point must: use the same denormals
 785      execution mode for both 16-bit and 64-bit floating-point types.
 786    * If
 787      <<features-separateRoundingModeSettings,pname:separateRoundingModeSettings>>
 788      is ename:VK_FALSE, then the entry point must: use the same rounding
 789      execution mode for both 16-bit and 64-bit floating-point types.
 790    * If
 791      <<features-shaderSignedZeroInfNanPreserveFloat16,pname:shaderSignedZeroInfNanPreserveFloat16>>
 792      is ename:VK_FALSE, then code:SignedZeroInfNanPreserve for 16-bit
 793      floating-point type must: not be used.
 794    * If
 795      <<features-shaderSignedZeroInfNanPreserveFloat32,pname:shaderSignedZeroInfNanPreserveFloat32>>
 796      is ename:VK_FALSE, then code:SignedZeroInfNanPreserve for 32-bit
 797      floating-point type must: not be used.
 798    * If
 799      <<features-shaderSignedZeroInfNanPreserveFloat64,pname:shaderSignedZeroInfNanPreserveFloat64>>
 800      is ename:VK_FALSE, then code:SignedZeroInfNanPreserve for 64-bit
 801      floating-point type must: not be used.
 802    * If
 803      <<features-shaderDenormPreserveFloat16,pname:shaderDenormPreserveFloat16>>
 804      is ename:VK_FALSE, then code:DenormPreserve for 16-bit floating-point
 805      type must: not be used.
 806    * If
 807      <<features-shaderDenormPreserveFloat32,pname:shaderDenormPreserveFloat32>>
 808      is ename:VK_FALSE, then code:DenormPreserve for 32-bit floating-point
 809      type must: not be used.
 810    * If
 811      <<features-shaderDenormPreserveFloat64,pname:shaderDenormPreserveFloat64>>
 812      is ename:VK_FALSE, then code:DenormPreserve for 64-bit floating-point
 813      type must: not be used.
 814    * If
 815      <<features-shaderDenormFlushToZeroFloat16,pname:shaderDenormFlushToZeroFloat16>>
 816      is ename:VK_FALSE, then code:DenormFlushToZero for 16-bit floating-point
 817      type must: not be used.
 818    * If
 819      <<features-shaderDenormFlushToZeroFloat32,pname:shaderDenormFlushToZeroFloat32>>
 820      is ename:VK_FALSE, then code:DenormFlushToZero for 32-bit floating-point
 821      type must: not be used.
 822    * If
 823      <<features-shaderDenormFlushToZeroFloat64,pname:shaderDenormFlushToZeroFloat64>>
 824      is ename:VK_FALSE, then code:DenormFlushToZero for 64-bit floating-point
 825      type must: not be used.
 826    * If
 827      <<features-shaderRoundingModeRTEFloat16,pname:shaderRoundingModeRTEFloat16>>
 828      is ename:VK_FALSE, then code:RoundingModeRTE for 16-bit floating-point
 829      type must: not be used.
 830    * If
 831      <<features-shaderRoundingModeRTEFloat32,pname:shaderRoundingModeRTEFloat32>>
 832      is ename:VK_FALSE, then code:RoundingModeRTE for 32-bit floating-point
 833      type must: not be used.
 834    * If
 835      <<features-shaderRoundingModeRTEFloat64,pname:shaderRoundingModeRTEFloat64>>
 836      is ename:VK_FALSE, then code:RoundingModeRTE for 64-bit floating-point
 837      type must: not be used.
 838    * If
 839      <<features-shaderRoundingModeRTZFloat16,pname:shaderRoundingModeRTZFloat16>>
 840      is ename:VK_FALSE, then code:RoundingModeRTZ for 16-bit floating-point
 841      type must: not be used.
 842    * If
 843      <<features-shaderRoundingModeRTZFloat32,pname:shaderRoundingModeRTZFloat32>>
 844      is ename:VK_FALSE, then code:RoundingModeRTZ for 32-bit floating-point
 845      type must: not be used.
 846    * If
 847      <<features-shaderRoundingModeRTZFloat64,pname:shaderRoundingModeRTZFloat64>>
 848      is ename:VK_FALSE, then code:RoundingModeRTZ for 64-bit floating-point
 849      type must: not be used.
 850  endif::VK_KHR_shader_float_controls[]
 851  ifdef::VK_EXT_transform_feedback[]
 852    * The code:Offset plus size of the type of each variable, in the output
 853      interface of the entry point being compiled, decorated with
 854      code:XfbBuffer must: not be greater than
 855      sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackBufferDataSize
 856    * For any given code:XfbBuffer value, define the buffer data size to be
 857      smallest number of bytes such that, for all outputs decorated with the
 858      same code:XfbBuffer value, the size of the output interface variable
 859      plus the code:Offset is less than or equal to the buffer data size.
 860      For a given code:Stream, the sum of all the buffer data sizes for all
 861      buffers writing to that stream the must: not exceed
 862      sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackStreamDataSize
 863    * Output variables or block members decorated with code:Offset that have a
 864      64-bit type, or a composite type containing a 64-bit type, must: specify
 865      an code:Offset value aligned to a 8 byte boundary
 866    * Any output block or block member decorated with code:Offset containing a
 867      64-bit type consumes a multiple of 8 bytes
 868    * The size of any output block, that contains any member decorated with
 869      code:Offset that is a 64-bit type, must: be a multiple of 8
 870    * The first member of an output block that specifies a code:Offset
 871      decoration must: specify a code:Offset value that is aligned to an 8
 872      byte boundary if that block contains any member decorated with
 873      code:Offset and is a 64-bit type
 874    * Output variables or block members decorated with code:Offset that have a
 875      32-bit type, or a composite type contains a 32-bit type, must: specify
 876      an code:Offset value aligned to a 4 byte boundary
 877    * Output variables, blocks or block members decorated with code:Offset
 878      must: only contain base types that have components that are either
 879      32-bit or 64-bit in size
 880    * The Stream value to code:OpEmitStreamVertex and
 881      code:OpEndStreamPrimitive must: be less than
 882      sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackStreams
 883    * If the geometry shader emits to more than one vertex stream and
 884      sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:transformFeedbackStreamsLinesTriangles
 885      is ename:VK_FALSE, then execution mode must: be code:OutputPoints
 886    * Only variables or block members in the output interface decorated with
 887      code:Offset can: be captured for transform feedback, and those variables
 888      or block memebers must: also be decorated with code:XfbBuffer and
 889      code:XfbStride, or inherit code:XfbBuffer and code:XfbStride decorations
 890      from a block that contains them
 891    * All variables or block members in the output interface of the entry
 892      point being compiled decorated with a specific code:XfbBuffer value
 893      must: all be decorated with identical code:XfbStride values
 894    * If any variables or block members in the output interface of the entry
 895      point being compiled are decorated with code:Stream, then all variables
 896      belonging to the same code:XfbBuffer must specify the same code:Stream
 897      value
 898    * Output variables, blocks or block members that are not decorated with
 899      code:Stream default to vertex stream zero
 900    * For any two variables or block members in the output interface of the
 901      entry point being compiled with the same code:XfbBuffer value, the
 902      ranges determined by the code:Offset decoration and the size of the type
 903      must: not overlap
 904    * The stream number value to code:Stream must: be less than
 905      sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackStreams
 906    * The XFB Stride value to code:XfbStride must be less than or equal to
 907      sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackBufferDataStride
 908  endif::VK_EXT_transform_feedback[]
 909  ifdef::VK_NV_ray_tracing[]
 910    * code:RayPayloadNV storage class must: only be used in ray generation,
 911      any-hit, closest hit or miss shaders.
 912    * code:IncomingRayPayloadNV storage class must: only be used in closest
 913      hit, any-hit, or miss shaders.
 914    * code:HitAttributeNV storage class must: only be used in intersection,
 915      any-hit, or closest hit shaders.
 916    * code:CallableDataNV storage class must: only be used in ray generation,
 917      closest hit, miss, and callable shaders.
 918    * code:IncomingCallableDataNV storage class must only be used in callable
 919      shaders.
 920  endif::VK_NV_ray_tracing[]
 921  ifdef::VK_VERSION_1_1,VK_KHR_variable_pointers,VK_EXT_buffer_device_address[]
 922    * The code:Base operand of code:OpPtrAccessChain must: point to one of the
 923      following storage classes:
 924  ifdef::VK_VERSION_1_1,VK_KHR_variable_pointers[]
 925    ** *Workgroup*, if code:VariablePointers is enabled.
 926    ** *StorageBuffer*, if code:VariablePointers or
 927       code:VariablePointersStorageBuffer is enabled.
 928  endif::VK_VERSION_1_1,VK_KHR_variable_pointers[]
 929    ** *PhysicalStorageBufferEXT*, if the code:PhysicalStorageBuffer64EXT
 930       addressing model is enabled.
 931  endif::VK_VERSION_1_1,VK_KHR_variable_pointers,VK_EXT_buffer_device_address[]
 932  ifdef::VK_EXT_buffer_device_address[]
 933    * If the code:PhysicalStorageBuffer64EXT addressing model is enabled:
 934    ** Any load or store through a physical pointer type must: be aligned to a
 935       multiple of the size of the largest scalar type in the pointed-to type.
 936    ** All instructions that support memory access operands and that use a
 937       physical pointer must: include the code:Aligned operand.
 938    ** The pointer value of a memory access instruction must be at least as
 939       aligned as specified by the code:Aligned memory access operand.
 940    ** Any access chain instruction that accesses into a code:RowMajor matrix
 941       must: only be used as the code:Pointer operand to code:OpLoad or
 942       code:OpStore.
 943    ** code:OpConvertUToPtr and code:OpConvertPtrToU must: use an integer type
 944       whose code:Width is 64.
 945  endif::VK_EXT_buffer_device_address[]
 946  ifdef::VK_NV_cooperative_matrix[]
 947    * For code:OpCooperativeMatrixLoadNV and code:OpCooperativeMatrixStoreNV
 948      instructions, the code:Pointer and code:Stride operands must: be aligned
 949      to at least the lesser of 16 bytes or the natural alignment of a row or
 950      column (depending on code:ColumnMajor) of the matrix (where the natural
 951      alignment is the number of columns/rows multiplied by the component
 952      size).
 953    * For code:OpTypeCooperativeMatrixNV, the component type, scope, number of
 954      rows, and number of columns must: match one of the matrices in any of
 955      the supported slink:VkCooperativeMatrixPropertiesNV.
 956    * For code:OpCooperativeMatrixMulAddNV, the code:Result, code:A, code:B,
 957      and code:C matrices must: all have types that satisfy the same supported
 958      slink:VkCooperativeMatrixPropertiesNV.
 959      That is, for one supported supported
 960      slink:VkCooperativeMatrixPropertiesNV, all of the following must: hold:
 961    ** The type of code:A must have pname:MSize rows and pname:KSize columns
 962       and have a component type that matches pname:AType.
 963    ** The type of code:B must have pname:KSize rows and pname:NSize columns
 964       and have a component type that matches pname:BType.
 965    ** The type of code:C must have pname:MSize rows and pname:NSize columns
 966       and have a component type that matches pname:CType.
 967    ** The type of code:Result must have pname:MSize rows and pname:NSize
 968       columns and have a component type that matches pname:DType.
 969    ** The type of code:A, code:B, code:C, and code:Result must all have a
 970       scope of pname:scope.
 971    * code:OpTypeCooperativeMatrixNV and code:OpCooperativeMatrix*
 972      instructions must: not be used in shader stages not included in
 973      slink:VkPhysicalDeviceCooperativeMatrixPropertiesNV::pname:cooperativeMatrixSupportedStages.
 974  endif::VK_NV_cooperative_matrix[]
 975  
 976  
 977  [[spirvenv-precision-operation]]
 978  == Precision and Operation of SPIR-V Instructions
 979  
 980  The following rules apply to half, single, and double-precision floating
 981  point instructions:
 982  
 983    * Positive and negative infinities and positive and negative zeros are
 984      generated as dictated by <<ieee-754,IEEE 754>>, but subject to the
 985      precisions allowed in the following table.
 986    * Dividing a non-zero by a zero results in the appropriately signed
 987  <<ieee-754,IEEE 754>> infinity.
 988    * Signaling [eq]##NaN##s are not required to be generated and exceptions
 989      are never raised.
 990      Signaling [eq]##NaN## may: be converted to quiet [eq]##NaN##s values by
 991      any floating point instruction.
 992    * The following instructions must: not flush denormalized values:
 993      code:OpConstant, code:OpConstantComposite, code:OpSpecConstant,
 994      code:OpSpecConstantComposite, code:OpLoad, code:OpStore, code:OpBitcast,
 995      code:OpPhi, code:OpSelect, code:OpFunctionCall, code:OpReturnValue,
 996      code:OpVectorExtractDynamic, code:OpVectorInsertDynamic,
 997      code:OpVectorShuffle, code:OpCompositeConstruct,
 998      code:OpCompositeExtract, code:OpCompositeInsert, code:OpCopyMemory,
 999      code:OpCopyObject.
1000  ifndef::VK_KHR_shader_float_controls[]
1001    * Any denormalized value input into a shader or potentially generated by
1002      any instruction in a shader (except those listed above) may: be flushed
1003      to 0.
1004    * The rounding mode cannot: be set, and results will be
1005      <<spirvenv-correctly-rounded, correctly rounded>>, as described below.
1006    * [eq]##NaN##s may: not be generated.
1007      Instructions that operate on a [eq]#NaN# may: not result in a [eq]#NaN#.
1008  endif::VK_KHR_shader_float_controls[]
1009  ifdef::VK_KHR_shader_float_controls[]
1010    * By default, the implementation may: perform optimizations on half,
1011      single, or double-precision floating-point instructions respectively
1012      that ignore sign of a zero, or assume that arguments and results are not
1013      [eq]##Nan##s or latexmath:[\pm\infty], this does not apply to
1014      code:OpIsNan and code:OpIsInf, which must: always correctly detect
1015      [eq]##Nan##s and latexmath:[\pm\infty].
1016      If the entry point is declared with the code:SignedZeroInfNanPreserve
1017      execution mode, then sign of a zero, [eq]##Nan##s, and
1018      latexmath:[\pm\infty] must: not be ignored.
1019    ** The following core SPIR-V instructions must: respect the
1020       code:SignedZeroInfNanPreserve execution mode: code:OpPhi,
1021       code:OpSelect, code:OpReturnValue, code:OpVectorExtractDynamic,
1022       code:OpVectorInsertDynamic, code:OpVectorShuffle,
1023       code:OpCompositeConstruct, code:OpCompositeExtract,
1024       code:OpCompositeInsert, code:OpCopyObject, code:OpTranspose,
1025       code:OpFConvert, code:OpFNegate, code:OpFAdd, code:OpFSub, code:OpFMul,
1026       code:OpStore.
1027       This execution mode must: also be respected by code:OpLoad except for
1028       loads from the code:Input storage class in the fragment shader stage
1029       with the floating-point result type.
1030       Other SPIR-V instructions may: also respect the
1031       code:SignedZeroInfNanPreserve execution mode.
1032    * Denormalized values are supported.
1033    ** By default, any half, single, or double-precision denormalized value
1034       input into a shader or potentially generated by any instruction (except
1035       those listed above) or any extended instructions for GLSL in a shader
1036       may: be flushed to zero.
1037    ** If the entry point is declared with the code:DenormFlushToZero
1038       execution mode then for the affected instuctions the denormalized
1039       result must: be flushed to zero and the denormalized operands may: be
1040       flushed to zero.
1041       Denormalized values obtained via unpacking an integer into a vector of
1042       values with smaller bit width and interpreting those values as
1043       floating-point numbers must: be flushed to zero.
1044    ** The following core SPIR-V instructions must: respect the
1045       code:DenormFlushToZero execution mode: code:OpSpecConstantOp (with
1046       opcode code:OpFConvert), code:OpFConvert, code:OpFNegate, code:OpFAdd,
1047       code:OpFSub, code:OpFMul, code:OpFDiv, code:OpFRem, code:OpFMod,
1048       code:OpVectorTimesScalar, code:OpMatrixTimesScalar,
1049       code:OpVectorTimesMatrix, code:OpMatrixTimesVector,
1050       code:OpMatrixTimesMatrix, code:OpOuterProduct, code:OpDot; and the
1051       following extended instructions for GLSL: code:Round, code:RoundEven,
1052       code:Trunc, code:FAbs, code:Floor, code:Ceil, code:Fract, code:Radians,
1053       code:Degrees, code:Sin, code:Cos, code:Tan, code:Asin, code:Acos,
1054       code:Atan, code:Sinh, code:Cosh, code:Tanh, code:Asinh, code:Acosh,
1055       code:Atanh, code:Atan2, code:Pow, code:Exp, code:Log, code:Exp2,
1056       code:Log2, code:Sqrt, code:InverseSqrt, code:Determinant,
1057       code:MatrixInverse, code:Modf, code:ModfStruct, code:FMin, code:FMax,
1058       code:FClamp, code:FMix, code:Step, code:SmoothStep, code:Fma,
1059       code:UnpackHalf2x16, code:UnpackDouble2x32, code:Length, code:Distance,
1060       code:Cross, code:Normalize, code:FaceForward, code:Reflect,
1061       code:Refract, code:NMin, code:NMax, code:NClamp.
1062       Other SPIR-V instructions (except those excluded above) may: also flush
1063       denormalized values.
1064    ** The following core SPIR-V instructions must: respect the
1065       code:DenormPreserve execution mode: code:OpTranspose,
1066       code:OpSpecConstantOp, code:OpFConvert, code:OpFNegate, code:OpFAdd,
1067       code:OpFSub, code:OpFMul, code:OpVectorTimesScalar,
1068       code:OpMatrixTimesScalar, code:OpVectorTimesMatrix,
1069       code:OpMatrixTimesVector, code:OpMatrixTimesMatrix,
1070       code:OpOuterProduct, code:OpDot, code:OpFOrdEqual, code:OpFUnordEqual,
1071       code:OpFOrdNotEqual, code:OpFUnordNotEqual, code:OpFOrdLessThan,
1072       code:OpFUnordLessThan, code:OpFOrdGreaterThan,
1073       code:OpFUnordGreaterThan, code:OpFOrdLessThanEqual,
1074       code:OpFUnordLessThanEqual, code:OpFOrdGreaterThanEqual,
1075       code:OpFUnordGreaterThanEqual; and the following extended instructions
1076       for GLSL: code:FAbs, code:FSign, code:Radians, code:Degrees, code:FMin,
1077       code:FMax, code:FClamp, code:FMix, code:Fma, code:PackHalf2x16,
1078       code:PackDouble2x32, code:UnpackHalf2x16, code:UnpackDouble2x32,
1079       code:NMin, code:NMax, code:NClamp.
1080       Other SPIR-V instructions may: also preserve denorm values.
1081  endif::VK_KHR_shader_float_controls[]
1082  
1083  The precision of double-precision instructions is at least that of single
1084  precision.
1085  
1086  The precision of operations is defined either in terms of rounding, as an
1087  error bound in ULP, or as inherited from a formula as follows.
1088  
1089  [[spirvenv-correctly-rounded]]
1090  .Correctly Rounded
1091  Operations described as "`correctly rounded`" will return the infinitely
1092  precise result, [eq]#x#, rounded so as to be representable in
1093  floating-point.
1094  ifdef::VK_KHR_shader_float_controls[]
1095  The rounding mode is not specified, unless the entry point is declared with
1096  the code:RoundingModeRTE or the code:RoundingModeRTZ execution mode.
1097  These execution modes affect only correctly rounded SPIR-V instructions.
1098  These execution modes do not affect code:OpQuantizeToF16.
1099  If the rounding mode is not specified then this rounding is implementation
1100  specific, subject to the following rules.
1101  endif::VK_KHR_shader_float_controls[]
1102  ifndef::VK_KHR_shader_float_controls[]
1103  The rounding mode used is not defined but must: obey the following rules.
1104  endif::VK_KHR_shader_float_controls[]
1105  If [eq]#x# is exactly representable then [eq]#x# will be returned.
1106  Otherwise, either the floating-point value closest to and no less than
1107  [eq]#x# or the value closest to and no greater than [eq]#x# will be
1108  returned.
1109  
1110  .ULP
1111  Where an error bound of [eq]#n# ULP (units in the last place) is given, for
1112  an operation with infinitely precise result #x# the value returned must: be
1113  in the range #[x - n * ulp(x), x + n * ulp(x)]#.
1114  The function #ulp(x)# is defined as follows:
1115  
1116   :: If there exist non-equal floating-point numbers #a# and #b# such that
1117  [eq]#a {leq} x {leq} b# then #ulp(x)# is the minimum possible distance
1118  between such numbers, latexmath:[ulp(x) = \mathrm{min}_{a,b} | b - a |].
1119  If such numbers do not exist then #ulp(x)# is defined to be the difference
1120  between the two finite floating-point numbers nearest to #x#.
1121  
1122  Where the range of allowed return values includes any value of magnitude
1123  larger than that of the largest representable finite floating-point number,
1124  operations may:, additionally, return either an infinity of the appropriate
1125  sign or the finite number with the largest magnitude of the appropriate
1126  sign.
1127  If the infinitely precise result of the operation is not mathematically
1128  defined then the value returned is undefined:.
1129  
1130  .Inherited From ...
1131  Where an operation's precision is described as being inherited from a
1132  formula, the result returned must be at least as accurate as the result of
1133  computing an approximation to [eq]#x# using a formula equivalent to the
1134  given formula applied to the supplied inputs.
1135  Specifically, the formula given may be transformed using the mathematical
1136  associativity, commutativity and distributivity of the operators involved to
1137  yield an equivalent formula.
1138  The SPIR-V precision rules, when applied to each such formula and the given
1139  input values, define a range of permitted values.
1140  If [eq]#NaN# is one of the permitted values then the operation may return
1141  any result, otherwise let the largest permitted value in any of the ranges
1142  be [eq]#F~max~# and the smallest be [eq]#F~min~#.
1143  The operation must return a value in the range [eq]#[x - E, x + E]# where
1144  latexmath:[E = \mathrm{max} \left( | x - F_{\mathrm{min}} |, | x -
1145  F_{\mathrm{max}} | \right) ].
1146  ifdef::VK_KHR_shader_float_controls[]
1147  If the entry point is declared with the code:DenormFlushToZero execution
1148  mode, then any intermediate denormal value(s) while evaluating the formula
1149  may: be flushed to zero.
1150  Denormal final results must: be flushed to zero.
1151  If the entry point is declared with the code:DenormPreserve execution mode,
1152  then denormals must: be preserved throughout the formula.
1153  endif::VK_KHR_shader_float_controls[]
1154  
1155  ifdef::VK_KHR_shader_float16_int8[]
1156  For half- (16 bit) and single- (32 bit) precision instructions, precisions
1157  are required: to be at least as follows:
1158  
1159  .Precision of core SPIR-V Instructions
1160  [options="header", cols=",,"]
1161  |====
1162  | Instruction
1163   | Single precision, unless decorated with RelaxedPrecision | Half precision
1164  | code:OpFAdd
1165  2+| Correctly rounded.
1166  | code:OpFSub
1167  2+| Correctly rounded.
1168  | code:OpFMul, code:OpVectorTimesScalar, code:OpMatrixTimesScalar
1169  2+| Correctly rounded.
1170  | code:OpDot(x, y)
1171  2+a| Inherited from latexmath:[\sum_{i = 0}^{n - 1} x_{i} \times y_{i}].
1172  | code:OpFOrdEqual, code:OpFUnordEqual
1173  2+| Correct result.
1174  | code:OpFOrdLessThan, code:OpFUnordLessThan
1175  2+| Correct result.
1176  | code:OpFOrdGreaterThan, code:OpFUnordGreaterThan
1177  2+| Correct result.
1178  | code:OpFOrdLessThanEqual, code:OpFUnordLessThanEqual
1179  2+| Correct result.
1180  | code:OpFOrdGreaterThanEqual, code:OpFUnordGreaterThanEqual
1181  2+| Correct result.
1182  | code:OpFDiv(x,y)
1183   | 2.5 ULP for [eq]#{vert}y{vert}# in the range [2^-126^, 2^126^].   | 2.5 ULP for [eq]#{vert}y{vert}# in the range [2^-14^, 2^14^].
1184  | code:OpFRem(x,y)
1185  2+| Inherited from [eq]#x - y {times} trunc(x/y)#.
1186  | code:OpFMod(x,y)
1187  2+| Inherited from [eq]#x - y {times} floor(x/y)#.
1188  | conversions between types
1189  2+| Correctly rounded.
1190  |====
1191  
1192  [NOTE]
1193  .Note
1194  ====
1195  The code:OpFRem and code:OpFMod instructions use cheap approximations of
1196  remainder, and the error can be large due to the discontinuity in trunc()
1197  and floor().
1198  This can produce mathematically unexpected results in some cases, such as
1199  FMod(x,x) computing x rather than 0, and can also cause the result to have a
1200  different sign than the infinitely precise result.
1201  ====
1202  
1203  .Precision of GLSL.std.450 Instructions
1204  [options="header", cols=",,"]
1205  |====
1206  |Instruction
1207    | Single precision, unless decorated with RelaxedPrecision | Half precision
1208  | code:fma()
1209  2+| Inherited from code:OpFMul followed by code:OpFAdd.
1210  | code:exp(x),  code:exp2(x)
1211   a| latexmath:[3 + 2 \times \vert x \vert] ULP.             a| latexmath:[1 + 2 \times \vert x \vert] ULP.
1212  | code:log(),  code:log2()
1213   a| 3 ULP outside the range latexmath:[[0.5, 2.0\]]. Absolute error < latexmath:[2^{-21}] inside the range latexmath:[[0.5, 2.0\]].
1214   a| 3 ULP outside the range latexmath:[[0.5, 2.0\]]. Absolute error < latexmath:[2^{-7}] inside the range latexmath:[[0.5, 2.0\]].
1215  | code:pow(x, y)
1216  2+| Inherited from code:exp2(y {times} code:log2(x)).
1217  | code:sqrt()
1218  2+| Inherited from 1.0 / code:inversesqrt().
1219  | code:inversesqrt()
1220  2+| 2 ULP.
1221  | code:radians(x)
1222  2+a| Inherited from latexmath:[\frac{x \times \pi}{180}].
1223  | code:degrees(x)
1224  2+a| Inherited from latexmath:[\frac{x \times 180}{\pi}].
1225  | code:sin()
1226    a| Absolute error latexmath:[\leq 2^{-11}] inside the range latexmath:[[-\pi, \pi\]]. a| Absolute error latexmath:[\leq 2^{-7}] inside the range latexmath:[[-\pi, \pi\]].
1227  | code:cos()
1228    a| Absolute error latexmath:[\leq 2^{-11}] inside the range latexmath:[[-\pi, \pi\]]. a| Absolute error latexmath:[\leq 2^{-7}] inside the range latexmath:[[-\pi, \pi\]].
1229  | code:tan()
1230  2+a| Inherited from latexmath:[\frac{\sin()}{\cos()}].
1231  | code:asin(x)
1232  2+a| Inherited from latexmath:[\mathrm{atan2}(x, sqrt(1.0 - x^2))].
1233  | code:acos(x)
1234  2+a| Inherited from latexmath:[\mathrm{atan2}(sqrt(1.0 - x^2), x)].
1235  | code:atan(), code:atan2()
1236     | 4096 ULP                                                      | 5 ULP.
1237  | code:sinh(x)
1238  2+a| Inherited from latexmath:[(\exp(x) - \exp(-x)) \times 0.5].
1239  | code:cosh(x)
1240  2+a| Inherited from latexmath:[(\exp(x) + \exp(-x)) \times 0.5].
1241  | code:tanh()
1242  2+a| Inherited from latexmath:[\frac{\sinh()}{\cosh()}].
1243  | code:asinh(x)
1244  2+a| Inherited from latexmath:[\log(x + sqrt(x^2 + 1.0))].
1245  | code:acosh(x)
1246  2+a| Inherited from latexmath:[\log(x + sqrt(x^2 - 1.0))].
1247  | code:atanh(x)
1248  2+a| Inherited from latexmath:[\log(\frac{1.0 + x}{1.0 - x}) \times 0.5].
1249  | code:frexp()
1250  2+| Correctly rounded.
1251  | code:ldexp()
1252  2+| Correctly rounded.
1253  | code:length(x)
1254  2+a| Inherited from latexmath:[sqrt(dot(x, x))].
1255  | code:distance(x, y)
1256  2+a| Inherited from latexmath:[length(x - y)].
1257  | code:cross()
1258  2+| Inherited from [eq]#code:OpFSub(code:OpFMul, code:OpFMul)#.
1259  | code:normalize(x)
1260  2+a| Inherited from latexmath:[\frac{x}{length(x)}].
1261  | code:faceforward
1262  2+| Correctly rounded.
1263  | code:reflect(x, y)
1264  2+| Inherited from [eq]#x - 2.0 {times} code:dot(y, x) {times} y#.
1265  | code:refract(I, N, eta)
1266  2+| Inherited from [eq]#eta {times} I - (eta {times} code:dot(N, I) + code:sqrt(k)) {times} N#.
1267  | code:round
1268  2+| Correctly rounded.
1269  | code:roundEven
1270  2+| Correctly rounded.
1271  | code:trunc
1272  2+| Correctly rounded.
1273  | code:fabs
1274  2+| Correctly rounded.
1275  | code:fsign
1276  2+| Correctly rounded.
1277  | code:floor
1278  2+| Correctly rounded.
1279  | code:ceil
1280  2+| Correctly rounded.
1281  | code:fract
1282  2+| Correctly rounded.
1283  | code:modf
1284  2+| Correctly rounded.
1285  | code:fmin
1286  2+| Correctly rounded.
1287  | code:fmax
1288  2+| Correctly rounded.
1289  | code:fclamp
1290  2+| Correctly rounded.
1291  | code:fmix(x, y, a)
1292  2+a| Inherited from latexmath:[x \times (1.0 - a) + y \times a].
1293  | code:step
1294  2+| Correctly rounded.
1295  | code:smoothStep(edge0, edge1, x)
1296  2+a| Inherited from latexmath:[t^{2} \times (3.0 - 2.0 \times t)],
1297  where latexmath:[t = clamp(\frac{x - edge0}{edge1 - edge0}, 0.0, 1.0)].
1298  | code:nmin
1299  2+| Correctly rounded.
1300  | code:nmax
1301  2+| Correctly rounded.
1302  | code:nclamp
1303  2+| Correctly rounded.
1304  |====
1305  endif::VK_KHR_shader_float16_int8[]
1306  
1307  ifndef::VK_KHR_shader_float16_int8[]
1308  For single precision (32 bit) instructions, precisions are required: to be
1309  at least as follows, unless decorated with RelaxedPrecision:
1310  
1311  .Precision of core SPIR-V Instructions
1312  [options="header"]
1313  |====
1314  | Instruction                                                     | Precision
1315  | code:OpFAdd                                                     | Correctly rounded.
1316  | code:OpFSub                                                     | Correctly rounded.
1317  | code:OpFMul, code:OpVectorTimesScalar, code:OpMatrixTimesScalar | Correctly rounded.
1318  | code:OpFOrdEqual, code:OpFUnordEqual                            | Correct result.
1319  | code:OpFOrdLessThan, code:OpFUnordLessThan                      | Correct result.
1320  | code:OpFOrdGreaterThan, code:OpFUnordGreaterThan                | Correct result.
1321  | code:OpFOrdLessThanEqual, code:OpFUnordLessThanEqual            | Correct result.
1322  | code:OpFOrdGreaterThanEqual, code:OpFUnordGreaterThanEqual      | Correct result.
1323  | code:OpFDiv(x,y)                                                | 2.5 ULP for [eq]#{vert}y{vert}# in the range [2^-126^, 2^126^].
1324  | conversions between types                                       | Correctly rounded.
1325  |====
1326  
1327  .Precision of GLSL.std.450 Instructions
1328  [options="header"]
1329  |====
1330  |Instruction                 | Precision
1331  | code:fma()                 | Inherited from code:OpFMul followed by code:OpFAdd.
1332  | code:exp(x),  code:exp2(x) | [eq]#3 {plus} 2 {times} {vert}x{vert}# ULP.
1333  | code:log(),  code:log2()   | 3 ULP outside the range [eq]#[0.5, 2.0]#. Absolute error < [eq]#2^-21^# inside the range [eq]#[0.5, 2.0]#.
1334  | code:pow(x, y)             | Inherited from code:exp2(y {times} code:log2(x)).
1335  | code:sqrt()                | Inherited from 1.0 / code:inversesqrt().
1336  | code:inversesqrt()         | 2 ULP.
1337  |====
1338  endif::VK_KHR_shader_float16_int8[]
1339  
1340  GLSL.std.450 extended instructions specifically defined in terms of the
1341  above instructions inherit the above errors.
1342  GLSL.std.450 extended instructions not listed above and not defined in terms
1343  of the above have undefined: precision.
1344  
1345  For the code:OpSRem and code:OpSMod instructions, if either operand is
1346  negative the result is undefined:.
1347  
1348  [NOTE]
1349  .Note
1350  ====
1351  While the code:OpSRem and code:OpSMod instructions are supported by the
1352  Vulkan environment, they require non-negative values and thus do not enable
1353  additional functionality beyond what code:OpUMod provides.
1354  ====
1355  
1356  ifdef::VK_NV_cooperative_matrix[]
1357  code:OpCooperativeMatrixMulAddNV performs its operations in an
1358  implementation-dependent order and internal precision.
1359  endif::VK_NV_cooperative_matrix[]
1360  
1361  [[spirvenv-image-formats]]
1362  == Compatibility Between SPIR-V Image Formats And Vulkan Formats
1363  
1364  Images which are read from or written to by shaders must: have SPIR-V image
1365  formats compatible with the Vulkan image formats backing the image under the
1366  circumstances described for <<textures-operation-validation,texture image
1367  validation>>.
1368  The compatibile formats are:
1369  
1370  .SPIR-V and Vulkan Image Format Compatibility
1371  [cols="2*", options="header"]
1372  |====
1373  |SPIR-V Image Format    |Compatible Vulkan Format
1374  |code:Rgba32f           |ename:VK_FORMAT_R32G32B32A32_SFLOAT
1375  |code:Rgba16f           |ename:VK_FORMAT_R16G16B16A16_SFLOAT
1376  |code:R32f              |ename:VK_FORMAT_R32_SFLOAT
1377  |code:Rgba8             |ename:VK_FORMAT_R8G8B8A8_UNORM
1378  |code:Rgba8Snorm        |ename:VK_FORMAT_R8G8B8A8_SNORM
1379  |code:Rg32f             |ename:VK_FORMAT_R32G32_SFLOAT
1380  |code:Rg16f             |ename:VK_FORMAT_R16G16_SFLOAT
1381  |code:R11fG11fB10f      |ename:VK_FORMAT_B10G11R11_UFLOAT_PACK32
1382  |code:R16f              |ename:VK_FORMAT_R16_SFLOAT
1383  |code:Rgba16            |ename:VK_FORMAT_R16G16B16A16_UNORM
1384  |code:Rgb10A2           |ename:VK_FORMAT_A2B10G10R10_UNORM_PACK32
1385  |code:Rg16              |ename:VK_FORMAT_R16G16_UNORM
1386  |code:Rg8               |ename:VK_FORMAT_R8G8_UNORM
1387  |code:R16               |ename:VK_FORMAT_R16_UNORM
1388  |code:R8                |ename:VK_FORMAT_R8_UNORM
1389  |code:Rgba16Snorm       |ename:VK_FORMAT_R16G16B16A16_SNORM
1390  |code:Rg16Snorm         |ename:VK_FORMAT_R16G16_SNORM
1391  |code:Rg8Snorm          |ename:VK_FORMAT_R8G8_SNORM
1392  |code:R16Snorm          |ename:VK_FORMAT_R16_SNORM
1393  |code:R8Snorm           |ename:VK_FORMAT_R8_SNORM
1394  |code:Rgba32i           |ename:VK_FORMAT_R32G32B32A32_SINT
1395  |code:Rgba16i           |ename:VK_FORMAT_R16G16B16A16_SINT
1396  |code:Rgba8i            |ename:VK_FORMAT_R8G8B8A8_SINT
1397  |code:R32i              |ename:VK_FORMAT_R32_SINT
1398  |code:Rg32i             |ename:VK_FORMAT_R32G32_SINT
1399  |code:Rg16i             |ename:VK_FORMAT_R16G16_SINT
1400  |code:Rg8i              |ename:VK_FORMAT_R8G8_SINT
1401  |code:R16i              |ename:VK_FORMAT_R16_SINT
1402  |code:R8i               |ename:VK_FORMAT_R8_SINT
1403  |code:Rgba32ui          |ename:VK_FORMAT_R32G32B32A32_UINT
1404  |code:Rgba16ui          |ename:VK_FORMAT_R16G16B16A16_UINT
1405  |code:Rgba8ui           |ename:VK_FORMAT_R8G8B8A8_UINT
1406  |code:R32ui             |ename:VK_FORMAT_R32_UINT
1407  |code:Rgb10a2ui         |ename:VK_FORMAT_A2B10G10R10_UINT_PACK32
1408  |code:Rg32ui            |ename:VK_FORMAT_R32G32_UINT
1409  |code:Rg16ui            |ename:VK_FORMAT_R16G16_UINT
1410  |code:Rg8ui             |ename:VK_FORMAT_R8G8_UINT
1411  |code:R16ui             |ename:VK_FORMAT_R16_UINT
1412  |code:R8ui              |ename:VK_FORMAT_R8_UINT
1413  |====