• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2015-2021 The Khronos Group, Inc.
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5[appendix]
6[[spirvenv]]
7= Vulkan Environment for SPIR-V
8
9Shaders for Vulkan are defined by the <<spirv-spec,Khronos SPIR-V
10Specification>> as well as the <<spirv-extended,Khronos SPIR-V Extended
11Instructions for GLSL>> Specification.
12This appendix defines additional SPIR-V requirements applying to Vulkan
13shaders.
14
15== Versions and Formats
16
17A Vulkan
18ifdef::VK_VERSION_1_2[]
191.2 implementation must: support the 1.0, 1.1, 1.2, 1.3, 1.4, and 1.5
20versions
21endif::VK_VERSION_1_2[]
22ifndef::VK_VERSION_1_2[]
23ifdef::VK_VERSION_1_1[]
241.1 implementation must: support the 1.0, 1.1, 1.2, and 1.3 versions
25endif::VK_VERSION_1_1[]
26ifndef::VK_VERSION_1_1[]
271.0 implementation must: support the 1.0 version
28endif::VK_VERSION_1_1[]
29endif::VK_VERSION_1_2[]
30of SPIR-V and the 1.0 version of the SPIR-V Extended Instructions for GLSL.
31ifndef::VK_VERSION_1_2[]
32ifdef::VK_KHR_spirv_1_4[]
33If the `apiext:VK_KHR_spirv_1_4` extension is enabled, the implementation
34must: additionally support the 1.4 version of SPIR-V.
35endif::VK_KHR_spirv_1_4[]
36endif::VK_VERSION_1_2[]
37
38A SPIR-V module passed into flink:vkCreateShaderModule is interpreted as a
39series of 32-bit words in host endianness, with literal strings packed as
40described in section 2.2 of the SPIR-V Specification.
41The first few words of the SPIR-V module must: be a magic number and a
42SPIR-V version number, as described in section 2.3 of the SPIR-V
43Specification.
44
45
46[[spirvenv-capabilities]]
47== Capabilities
48
49The <<spirvenv-capabilities-table,table below>> lists the set of SPIR-V
50capabilities that may: be supported in Vulkan implementations.
51The application must: not use any of these capabilities in SPIR-V passed to
52flink:vkCreateShaderModule unless one of the following conditions is met for
53the slink:VkDevice specified in the pname:device parameter of
54flink:vkCreateShaderModule:
55
56* The corresponding field in the table is blank.
57* Any corresponding Vulkan feature is enabled.
58* Any corresponding Vulkan extension is enabled.
59* Any corresponding Vulkan property is supported.
60* The corresponding core version is supported (as returned by
61  slink:VkPhysicalDeviceProperties::pname:apiVersion).
62
63:captableindent: {nbsp} {nbsp} {nbsp} {nbsp} {nbsp} {nbsp} {nbsp} {nbsp}
64[[spirvenv-capabilities-table]]
65.List of SPIR-V Capabilities and corresponding Vulkan features, extensions, or core version
66[options="header"]
67|====
68| SPIR-V code:OpCapability +
69  {captableindent} Vulkan feature, extension, or core version
70include::{generated}/spirvcap/captable.txt[]
71|====
72
73The application must: not pass a SPIR-V module containing any of the
74following to flink:vkCreateShaderModule:
75
76  * any code:OpCapability not listed above,
77  * an unsupported capability, or
78  * a capability which corresponds to a Vulkan feature or extension which
79    has not been enabled.
80
81
82[[spirvenv-extensions]]
83=== SPIR-V Extensions
84
85The <<spirvenv-extensions-table,following table>> lists SPIR-V extensions
86that implementations may: support.
87The application must: not pass a SPIR-V module to flink:vkCreateShaderModule
88that uses the following SPIR-V extensions unless one of the following
89conditions is met for the slink:VkDevice specified in the pname:device
90parameter of flink:vkCreateShaderModule:
91
92* Any corresponding Vulkan extension is enabled.
93* The corresponding core version is supported (as returned by
94  slink:VkPhysicalDeviceProperties::pname:apiVersion).
95
96[[spirvenv-extensions-table]]
97.List of SPIR-V Extensions and corresponding Vulkan extensions or core version
98[options="header"]
99|====
100| SPIR-V code:OpExtension +
101  {captableindent} Vulkan extension or core version
102include::{generated}/spirvcap/exttable.txt[]
103|====
104
105
106[[spirvenv-module-validation]]
107== Validation Rules within a Module
108
109A SPIR-V module passed to flink:vkCreateShaderModule must: conform to the
110following rules:
111
112
113[[spirvenv-module-validation-standalone]]
114=== Standalone SPIR-V Validation
115
116[open,refpage='StandaloneSpirv',desc='Standalone SPIR-V Validation',type='spirv']
117--
118:refpage: StandaloneSpirv
119
120The following rules can: be validated with only the SPIR-V module itself.
121They do not depend on knowledge of the implementation and its capabilities
122or knowledge of runtime information, such as enabled features.
123
124.Valid Usage
125****
126// NOTE: Do not conditionalize the "standalone" VUs.
127// Write as though all extensions were enabled.
128// Add any needed conditional logic to the runtime section if needed.
129  * [[VUID-{refpage}-None-04633]]
130    Every entry point must: have no return value and accept no arguments
131  * [[VUID-{refpage}-None-04634]]
132    The static function-call graph for an entry point must: not contain
133    cycles; that is, static recursion is not allowed
134  * [[VUID-{refpage}-None-04635]]
135    The *Logical* or *PhysicalStorageBuffer64* addressing model must: be
136    selected
137  * [[VUID-{refpage}-None-04636]]
138    *Scope* for execution must: be limited to *Workgroup* or *Subgroup*
139  * [[VUID-{refpage}-None-04637]]
140    If the *Scope* for execution is *Workgroup*, then it must: only be used
141    in the task, mesh, tessellation control, or compute execution models
142  * [[VUID-{refpage}-None-04638]]
143    *Scope* for memory must: be limited to *Device*, *QueueFamily*,
144    *Workgroup*, *ShaderCallKHR*, *Subgroup*, or *Invocation*
145  * [[VUID-{refpage}-None-04639]]
146    If the *Scope* for memory is *Workgroup*, then it must: only be used in
147    the task, mesh, or compute execution models
148  * [[VUID-{refpage}-None-04640]]
149    If the *Scope* for memory is *ShaderCallKHR*, then it must: only be used
150    in ray generation, intersection, closest hit, any-hit, miss, and
151    callable execution models
152  * [[VUID-{refpage}-None-04641]]
153    If the *Scope* for memory is *Invocation*, then memory semantics must:
154    be *None*
155ifdef::VK_VERSION_1_1[]
156  * [[VUID-{refpage}-None-04642]]
157    *Scope* for <<shaders-group-operations,group operations>> must: be
158    limited to *Subgroup*
159endif::VK_VERSION_1_1[]
160  * [[VUID-{refpage}-None-04643]]
161    *Storage Class* must: be limited to *UniformConstant*, *Input*,
162    *Uniform*, *Output*, *Workgroup*, *Private*, *Function*, *PushConstant*,
163    *Image*, *StorageBuffer*, *RayPayloadKHR*, *IncomingRayPayloadKHR*,
164    *HitAttributeKHR*, *CallableDataKHR*, *IncomingCallableDataKHR*,
165    *ShaderRecordBufferKHR*, or *PhysicalStorageBuffer*
166  * [[VUID-{refpage}-None-04644]]
167    If the *Storage Class* is *Output*, then it must: not be used in the
168    *GlCompute*, *RayGenerationKHR*, *IntersectionKHR*, *AnyHitKHR*,
169    *ClosestHitKHR*, *MissKHR*, or *CallableKHR* execution models
170  * [[VUID-{refpage}-None-04645]]
171    If the *Storage Class* is *Workgroup*, then it must: only be used in the
172    task, mesh, or compute execution models
173  * [[VUID-{refpage}-OpAtomicStore-04730]]
174    code:OpAtomicStore must: not use *Acquire*, *AcquireRelease*, or
175    *SequentiallyConsistent* memory semantics
176  * [[VUID-{refpage}-OpAtomicLoad-04731]]
177    code:OpAtomicLoad must: not use *Release*, *AcquireRelease*, or
178    *SequentiallyConsistent* memory semantics
179  * [[VUID-{refpage}-OpMemoryBarrier-04732]]
180    code:OpMemoryBarrier must: use one of *Acquire*, *Release*,
181    *AcquireRelease*, or *SequentiallyConsistent* memory semantics
182  * [[VUID-{refpage}-OpMemoryBarrier-04733]]
183    code:OpMemoryBarrier must: include at least one storage class
184  * [[VUID-{refpage}-OpControlBarrier-04650]]
185    If the semantics for code:OpControlBarrier includes one of *Acquire*,
186    *Release*, *AcquireRelease*, or *SequentiallyConsistent* memory
187    semantics, then it must: include at least one storage class
188  * [[VUID-{refpage}-OpVariable-04651]]
189    Any code:OpVariable with an code:Initializer operand must: have
190    *Output*, *Private*, *Function*, or *Workgroup* as its *Storage Class*
191    operand
192  * [[VUID-{refpage}-OpVariable-04734]]
193    Any code:OpVariable with an code:Initializer operand and *Workgroup* as
194    its *Storage Class* operand must: use code:OpConstantNull as the
195    initializer
196  * [[VUID-{refpage}-OpReadClockKHR-04652]]
197    *Scope* for code:OpReadClockKHR must: be limited to *Subgroup* or
198    *Device*
199  * [[VUID-{refpage}-OriginLowerLeft-04653]]
200    The code:OriginLowerLeft execution mode must: not be used; fragment
201    entry points must: declare code:OriginUpperLeft
202  * [[VUID-{refpage}-PixelCenterInteger-04654]]
203    The code:PixelCenterInteger execution mode must: not be used (pixels are
204    always centered at half-integer coordinates)
205  * [[VUID-{refpage}-UniformConstant-04655]]
206    Any variable in the code:UniformConstant storage class must: be typed as
207    either code:OpTypeImage, code:OpTypeSampler, code:OpTypeSampledImage,
208    code:OpTypeAccelerationStructureKHR, or an array of one of these types
209  * [[VUID-{refpage}-OpTypeImage-04656]]
210    code:OpTypeImage must: declare a scalar 32-bit float, 64-bit integer, or
211    32-bit integer type for the "`Sampled Type`" (code:RelaxedPrecision can:
212    be applied to a sampling instruction and to the variable holding the
213    result of a sampling instruction)
214  * [[VUID-{refpage}-OpTypeImage-04657]]
215    code:OpTypeImage must: have a "`Sampled`" operand of 1 (sampled image)
216    or 2 (storage image)
217  * [[VUID-{refpage}-Image-04965]]
218    The converted bit width, signedness, and numeric type of the code:Image
219    code:Format operand of an code:OpTypeImage must: match the code:Sampled
220    code:Type, as defined in <<spirvenv-format-type-matching>>
221  * [[VUID-{refpage}-OpImageTexelPointer-04658]]
222    If an code:OpImageTexelPointer is used in an atomic operation, the image
223    type of the code:image parameter to code:OpImageTexelPointer must: have
224    an image format of code:R64i, code:R64ui, code:R32f, code:R32i, or
225    code:R32ui
226  * [[VUID-{refpage}-OpImageQuerySizeLod-04659]]
227    code:OpImageQuerySizeLod, code:OpImageQueryLod, and
228    code:OpImageQueryLevels must: only consume an "`Image`" operand whose
229    type has its "`Sampled`" operand set to 1
230  * [[VUID-{refpage}-OpTypeImage-06214]]
231    An code:OpTypeImage with a "`Dim`" operand of code:SubpassData must:
232    have an "`Arrayed`" operand of 0 (non-arrayed) and a "`Sampled`" operand
233    of 2 (storage image)
234  * [[VUID-{refpage}-SubpassData-04660]]
235    The [eq]#(u,v)# coordinates used for a code:SubpassData must: be the
236    <id> of a constant vector [eq]#(0,0)#, or if a layer coordinate is used,
237    must: be a vector that was formed with constant 0 for the [eq]#u# and
238    [eq]#v# components
239  * [[VUID-{refpage}-OpTypeImage-04661]]
240    Objects of types code:OpTypeImage, code:OpTypeSampler,
241    code:OpTypeSampledImage, and arrays of these types must: not be stored
242    to or modified
243  * [[VUID-{refpage}-Offset-04662]]
244    Any image operation must: use at most one of the code:Offset,
245    code:ConstOffset, and code:ConstOffsets image operands
246  * [[VUID-{refpage}-Offset-04663]]
247    Image operand code:Offset must: only be used with code:OpImage*Gather
248    instructions
249  * [[VUID-{refpage}-Offset-04865]]
250    Any image instruction which uses an code:Offset, code:ConstOffset, or
251    code:ConstOffsets image operand, must only consume a "`Sampled Image`"
252    operand whose type has its "`Sampled`" operand set to 1
253  * [[VUID-{refpage}-OpImageGather-04664]]
254    The "`Component`" operand of code:OpImageGather, and
255    code:OpImageSparseGather must: be the <id> of a constant instruction
256  * [[VUID-{refpage}-OpImage-04777]]
257    code:OpImage*Dref must: not consume an image whose `Dim` is 3D
258  * [[VUID-{refpage}-OpTypeAccelerationStructureKHR-04665]]
259     Objects of types code:OpTypeAccelerationStructureKHR and arrays of this
260     type must: not be stored to or modified
261  * [[VUID-{refpage}-OpReportIntersectionKHR-04666]]
262    The value of the "`Hit Kind`" operand of code:OpReportIntersectionKHR
263    must: be in the range [eq]#[0,127]#
264  * [[VUID-{refpage}-None-04667]]
265    Structure types must: not contain opaque types
266  * [[VUID-{refpage}-BuiltIn-04668]]
267    Any code:BuiltIn decoration not listed in
268    <<interfaces-builtin-variables>> must: not be used
269  * [[VUID-{refpage}-Location-04915]]
270    The code:Location or code:Component decorations must: not be used with
271    code:BuiltIn
272  * [[VUID-{refpage}-Location-04916]]
273    The code:Location decorations must: be used on
274    <<interfaces-iointerfaces-user,user-defined variables>>
275  * [[VUID-{refpage}-Location-04917]]
276    The code:Location decorations must: be used on an code:OpVariable with a
277    structure type that is not a block
278  * [[VUID-{refpage}-Location-04918]]
279    The code:Location decorations must: not be used on the members of
280    code:OpVariable with a structure type that is decorated with
281    code:Location
282  * [[VUID-{refpage}-Location-04919]]
283    The code:Location decorations must: be used on each member of
284    code:OpVariable with a structure type that is a block not decorated with
285    code:Location
286  * [[VUID-{refpage}-Component-04920]]
287    The code:Component decoration value must: not be greater than 3
288  * [[VUID-{refpage}-Component-04921]]
289    If the code:Component decoration is used on an code:OpVariable that has
290    a code:OpTypeVector type with a code:Component code:Type with a
291    code:Width that is less than or equal to 32, the sum of its
292    code:Component code:Count and the code:Component decoration value must:
293    be less than 4
294  * [[VUID-{refpage}-Component-04922]]
295    If the code:Component decoration is used on an code:OpVariable that has
296    a code:OpTypeVector type with a code:Component code:Type with a
297    code:Width that is equal to 64, the sum of two times its code:Component
298    code:Count and the code:Component decoration value must: be less than 4
299  * [[VUID-{refpage}-Component-04923]]
300    The code:Component decorations value must: not be 1 or 3 for scalar or
301    two-component 64-bit data types
302  * [[VUID-{refpage}-Component-04924]]
303    The code:Component decorations must: not used with any type that is not
304    a scalar or vector
305  * [[VUID-{refpage}-GLSLShared-04669]]
306    The code:GLSLShared and code:GLSLPacked decorations must: not be used
307  * [[VUID-{refpage}-Flat-04670]]
308    The code:Flat, code:NoPerspective, code:Sample, and code:Centroid
309    decorations must: only be used on variables with the code:Output or
310    code:Input storage class
311  * [[VUID-{refpage}-Flat-06201]]
312    The code:Flat, code:NoPerspective, code:Sample, and code:Centroid
313    decorations must: not be used on variables with the code:Output storage
314    class in a fragment shader
315  * [[VUID-{refpage}-Flat-06202]]
316    The code:Flat, code:NoPerspective, code:Sample, and code:Centroid
317    decorations must: not be used on variables with the code:Input storage
318    class in a vertex shader
319  * [[VUID-{refpage}-Flat-04744]]
320    Any variable with integer or double-precision floating-point type and
321    with code:Input storage class in a fragment shader, must: be decorated
322    code:Flat
323  * [[VUID-{refpage}-ViewportRelativeNV-04672]]
324    The code:ViewportRelativeNV decoration must: only be used on a variable
325    decorated with code:Layer in the vertex, tessellation evaluation, or
326    geometry shader stages
327  * [[VUID-{refpage}-ViewportRelativeNV-04673]]
328    The code:ViewportRelativeNV decoration must: not be used unless a
329    variable decorated with one of code:ViewportIndex or code:ViewportMaskNV
330    is also statically used by the same code:OpEntryPoint
331  * [[VUID-{refpage}-ViewportMaskNV-04674]]
332    The code:ViewportMaskNV and code:ViewportIndex decorations must: not
333    both be statically used by one or more code:OpEntryPoint's that form the
334    <<pipeline-graphics-subsets-pre-rasterization,pre-rasterization shader
335    stages>> of a graphics pipeline
336  * [[VUID-{refpage}-FPRoundingMode-04675]]
337    Rounding modes other than round-to-nearest-even and round-towards-zero
338    must: not be used for the code:FPRoundingMode decoration
339  * [[VUID-{refpage}-FPRoundingMode-04676]]
340    The code:FPRoundingMode decoration must: only be used for a width-only
341    conversion instruction whose only uses are code:Object operands of
342    code:OpStore instructions storing through a pointer to a 16-bit
343    floating-point object in the code:StorageBuffer,
344    code:PhysicalStorageBuffer, code:Uniform, or code:Output storage class
345  * [[VUID-{refpage}-Invariant-04677]]
346    Variables decorated with code:Invariant and variables with structure
347    types that have any members decorated with code:Invariant must: be in
348    the code:Output or code:Input storage class, code:Invariant used on an
349    code:Input storage class variable or structure member has no effect
350  * [[VUID-{refpage}-VulkanMemoryModel-04678]]
351    [[builtin-volatile-semantics]] If the code:VulkanMemoryModel capability
352    is not declared, the code:Volatile decoration must: be used on any
353    variable declaration that includes one of the code:SMIDNV,
354    code:WarpIDNV, code:SubgroupSize, code:SubgroupLocalInvocationId,
355    code:SubgroupEqMask, code:SubgroupGeMask, code:SubgroupGtMask,
356    code:SubgroupLeMask, or code:SubgroupLtMask code:BuiltIn decorations
357    when used in the ray generation, closest hit, miss, intersection, or
358    callable shaders, or with the code:RayTmaxKHR code:Builtin decoration
359    when used in an intersection shader
360  * [[VUID-{refpage}-VulkanMemoryModel-04679]]
361    If the code:VulkanMemoryModel capability is declared, the code:OpLoad
362    instruction must: use the code:Volatile memory semantics when it
363    accesses into any variable that includes one of the code:SMIDNV,
364    code:WarpIDNV, code:SubgroupSize, code:SubgroupLocalInvocationId,
365    code:SubgroupEqMask, code:SubgroupGeMask, code:SubgroupGtMask,
366    code:SubgroupLeMask, or code:SubgroupLtMask code:BuiltIn decorations
367    when used in the ray generation, closest hit, miss, intersection, or
368    callable shaders, or with the code:RayTmaxKHR code:Builtin decoration
369    when used in an intersection shader
370  * [[VUID-{refpage}-OpTypeRuntimeArray-04680]]
371     code:OpTypeRuntimeArray must: only be used for the last member of an
372     code:OpTypeStruct that is in the code:StorageBuffer or
373     code:PhysicalStorageBuffer storage class decorated as code:Block, or
374     that is in the code:Uniform storage class decorated as code:BufferBlock
375  * [[VUID-{refpage}-Function-04681]]
376    A type _T_ that is an array sized with a specialization constant must:
377    neither be, nor be contained in, the type _T2_ of a variable _V_, unless
378    either: a) _T_ is equal to _T2_, b) _V_ is declared in the
379    code:Function, or code:Private storage classes, c) _V_ is a non-Block
380    variable in the code:Workgroup storage class, or d) _V_ is an interface
381    variable with an additional level of arrayness,
382    <<interfaces-iointerfaces-matching, as described in interface
383    matching>>, and _T_ is the member type of the array type _T2_
384  * [[VUID-{refpage}-OpControlBarrier-04682]]
385    If code:OpControlBarrier is used in ray generation, intersection,
386    any-hit, closest hit, miss, fragment, vertex, tessellation evaluation,
387    or geometry shaders, the execution Scope must: be code:Subgroup
388  * [[VUID-{refpage}-LocalSize-06426]]
389    For each compute shader entry point, either a code:LocalSize or
390    code:LocalSizeId execution mode, or an object decorated with the
391    code:WorkgroupSize decoration must: be specified
392  * [[VUID-{refpage}-DerivativeGroupQuadsNV-04684]]
393    For compute shaders using the code:DerivativeGroupQuadsNV execution
394    mode, the first two dimensions of the local workgroup size must: be a
395    multiple of two
396  * [[VUID-{refpage}-DerivativeGroupLinearNV-04778]]
397    For compute shaders using the code:DerivativeGroupLinearNV execution
398    mode, the product of the dimensions of the local workgroup size must: be
399    a multiple of four
400  * [[VUID-{refpage}-OpGroupNonUniformBallotBitCount-04685]]
401    If code:OpGroupNonUniformBallotBitCount is used, the group operation
402    must: be limited to *Reduce*, *InclusiveScan*, or *ExclusiveScan*
403  * [[VUID-{refpage}-None-04686]]
404    The _Pointer_ operand of all atomic instructions must: have a *Storage
405    Class* limited to *Uniform*, *Workgroup*, *Image*, *StorageBuffer*, or
406    *PhysicalStorageBuffer*
407  * [[VUID-{refpage}-Offset-04687]]
408    Output variables or block members decorated with code:Offset that have a
409    64-bit type, or a composite type containing a 64-bit type, must: specify
410    an code:Offset value aligned to a 8 byte boundary
411  * [[VUID-{refpage}-Offset-04689]]
412    The size of any output block containing any member decorated with
413    code:Offset that is a 64-bit type must: be a multiple of 8
414  * [[VUID-{refpage}-Offset-04690]]
415    The first member of an output block specifying a code:Offset decoration
416    must: specify a code:Offset value that is aligned to an 8 byte boundary
417    if that block contains any member decorated with code:Offset and is a
418    64-bit type
419  * [[VUID-{refpage}-Offset-04691]]
420    Output variables or block members decorated with code:Offset that have a
421    32-bit type, or a composite type contains a 32-bit type, must: specify
422    an code:Offset value aligned to a 4 byte boundary
423  * [[VUID-{refpage}-Offset-04692]]
424    Output variables, blocks or block members decorated with code:Offset
425    must: only contain base types that have components that are either
426    32-bit or 64-bit in size
427  * [[VUID-{refpage}-Offset-04716]]
428    Only variables or block members in the output interface decorated with
429    code:Offset can: be captured for transform feedback, and those variables
430    or block members must: also be decorated with code:XfbBuffer and
431    code:XfbStride, or inherit code:XfbBuffer and code:XfbStride decorations
432    from a block containing them
433  * [[VUID-{refpage}-XfbBuffer-04693]]
434    All variables or block members in the output interface of the entry
435    point being compiled decorated with a specific code:XfbBuffer value
436    must: all be decorated with identical code:XfbStride values
437  * [[VUID-{refpage}-Stream-04694]]
438    If any variables or block members in the output interface of the entry
439    point being compiled are decorated with code:Stream, then all variables
440    belonging to the same code:XfbBuffer must: specify the same code:Stream
441    value
442  * [[VUID-{refpage}-XfbBuffer-04696]]
443    For any two variables or block members in the output interface of the
444    entry point being compiled with the same code:XfbBuffer value, the
445    ranges determined by the code:Offset decoration and the size of the type
446    must: not overlap
447  * [[VUID-{refpage}-XfbBuffer-04697]]
448    All block members in the output interface of the entry point being
449    compiled that are in the same block and have a declared or inherited
450    code:XfbBuffer decoration must: specify the same code:XfbBuffer value
451  * [[VUID-{refpage}-RayPayloadKHR-04698]]
452    code:RayPayloadKHR storage class must: only be used in ray generation,
453    closest hit or miss shaders
454  * [[VUID-{refpage}-IncomingRayPayloadKHR-04699]]
455    code:IncomingRayPayloadKHR storage class must: only be used in closest
456    hit, any-hit, or miss shaders
457  * [[VUID-{refpage}-IncomingRayPayloadKHR-04700]]
458    There must: be at most one variable with the code:IncomingRayPayloadKHR
459    storage class in the input interface of an entry point
460  * [[VUID-{refpage}-HitAttributeKHR-04701]]
461    code:HitAttributeKHR storage class must: only be used in intersection,
462    any-hit, or closest hit shaders
463  * [[VUID-{refpage}-HitAttributeKHR-04702]]
464    There must: be at most one variable with the code:HitAttributeKHR
465    storage class in the input interface of an entry point
466  * [[VUID-{refpage}-HitAttributeKHR-04703]]
467    A variable with code:HitAttributeKHR storage class must: only be written
468    to in an intersection shader
469  * [[VUID-{refpage}-CallableDataKHR-04704]]
470    code:CallableDataKHR storage class must: only be used in ray generation,
471    closest hit, miss, and callable shaders
472  * [[VUID-{refpage}-IncomingCallableDataKHR-04705]]
473    code:IncomingCallableDataKHR storage class must: only be used in
474    callable shaders
475  * [[VUID-{refpage}-IncomingCallableDataKHR-04706]]
476    There must: be at most one variable with the
477    code:IncomingCallableDataKHR storage class in the input interface of an
478    entry point
479  * [[VUID-{refpage}-Base-04707]]
480    The code:Base operand of code:OpPtrAccessChain must: point to one of the
481    following: *Workgroup*, if code:VariablePointers is enabled;
482    *StorageBuffer*, if code:VariablePointers or
483    code:VariablePointersStorageBuffer is enabled; *PhysicalStorageBuffer*,
484    if the code:PhysicalStorageBuffer64 addressing model is enabled
485  * [[VUID-{refpage}-PhysicalStorageBuffer64-04708]]
486    If the code:PhysicalStorageBuffer64 addressing model is enabled, all
487    instructions that support memory access operands and that use a physical
488    pointer must: include the code:Aligned operand
489  * [[VUID-{refpage}-PhysicalStorageBuffer64-04709]]
490    If the code:PhysicalStorageBuffer64 addressing model is enabled, any
491    access chain instruction that accesses into a code:RowMajor matrix must:
492    only be used as the code:Pointer operand to code:OpLoad or code:OpStore
493  * [[VUID-{refpage}-PhysicalStorageBuffer64-04710]]
494    If the code:PhysicalStorageBuffer64 addressing model is enabled,
495    code:OpConvertUToPtr and code:OpConvertPtrToU must: use an integer type
496    whose code:Width is 64
497  * [[VUID-{refpage}-OpTypeForwardPointer-04711]]
498    code:OpTypeForwardPointer must: have a storage class of
499    code:PhysicalStorageBuffer
500  * [[VUID-{refpage}-None-04745]]
501    All variables with a storage class of *PushConstant* declared as an
502    array must: only be accessed by dynamically uniform indices
503  * [[VUID-{refpage}-Result-04780]]
504    The code:Result code:Type operand of any code:OpImageRead or
505    code:OpImageSparseRead instruction must: be a vector of four components
506  * [[VUID-{refpage}-Base-04781]]
507    The code:Base operand of any code:OpBitCount, code:OpBitReverse,
508    code:OpBitFieldInsert, code:OpBitFieldSExtract, or
509    code:OpBitFieldUExtract instruction must: be a 32-bit integer scalar or
510    a vector of 32-bit integers
511****
512--
513
514[[spirvenv-module-validation-runtime]]
515=== Runtime SPIR-V Validation
516
517[open,refpage='RuntimeSpirv',desc='Runtime SPIR-V Validation',type='spirv']
518--
519:refpage: RuntimeSpirv
520
521The following rules must: be validated at runtime.
522These rules depend on knowledge of the implementation and its capabilities
523and knowledge of runtime information, such as enabled features.
524
525.Valid Usage
526****
527ifdef::VK_VERSION_1_2,VK_KHR_vulkan_memory_model[]
528  * [[VUID-{refpage}-vulkanMemoryModel-06265]]
529    If <<features-vulkanMemoryModel,pname:vulkanMemoryModel>> is enabled and
530    <<features-vulkanMemoryModelDeviceScope,pname:vulkanMemoryModelDeviceScope>>
531    is not enabled, *Device* memory scope must: not be used.
532endif::VK_VERSION_1_2,VK_KHR_vulkan_memory_model[]
533ifdef::VK_VERSION_1_2,VK_KHR_vulkan_memory_model[]
534  * [[VUID-{refpage}-vulkanMemoryModel-06266]]
535    If <<features-vulkanMemoryModel,pname:vulkanMemoryModel>> is not
536    enabled, *QueueFamily* memory scope must: not be used.
537endif::VK_VERSION_1_2,VK_KHR_vulkan_memory_model[]
538ifdef::VK_KHR_shader_clock[]
539  * [[VUID-{refpage}-shaderSubgroupClock-06267]]
540    If <<features-shaderSubgroupClock,pname:shaderSubgroupClock>> is not
541    enabled, the code:Subgroup scope must: not be used for
542    code:OpReadClockKHR.
543  * [[VUID-{refpage}-shaderDeviceClock-06268]]
544    If <<features-shaderDeviceClock,pname:shaderDeviceClock>> is not
545    enabled, the code:Device scope must: not be used for
546    code:OpReadClockKHR.
547endif::VK_KHR_shader_clock[]
548ifndef::VK_KHR_format_feature_flags2[]
549  * [[VUID-{refpage}-OpTypeImage-06269]]
550    If
551    <<features-shaderStorageImageWriteWithoutFormat,shaderStorageImageWriteWithoutFormat>>
552    is not enabled, any variable created with a "`Type`" of code:OpTypeImage
553    that has a "`Sampled`" operand of 2 and an "`Image Format`" operand of
554    code:Unknown must: be decorated with code:NonWritable.
555  * [[VUID-{refpage}-OpTypeImage-06270]]
556    If
557    <<features-shaderStorageImageReadWithoutFormat,shaderStorageImageReadWithoutFormat>>
558    is not enabled, any variable created with a "`Type`" of code:OpTypeImage
559    that has a "`Sampled`" operand of 2 and an "`Image Format`" operand of
560    code:Unknown must: be decorated with code:NonReadable.
561endif::VK_KHR_format_feature_flags2[]
562  * [[VUID-{refpage}-Location-06272]]
563    The sum of code:Location and the number of locations the variable it
564    decorates consumes must: be less than or equal to the value for the
565    matching {ExecutionModel} defined in <<interfaces-iointerfaces-limits>>
566  * [[VUID-{refpage}-Fragment-06427]]
567    When blending is enabled and one of the dual source blend modes is in
568    use, the maximum number of output attachments written to in the
569    code:Fragment {ExecutionModel} must: be less than or equal to
570    <<limits-maxFragmentDualSrcAttachments,pname:maxFragmentDualSrcAttachments>>
571  * [[VUID-{refpage}-Location-06428]]
572    The maximum number of storage buffers, storage images, and output
573    code:Location decorated color attachments written to in the
574    code:Fragment {ExecutionModel} must: be less than or equal to
575    <<limits-maxFragmentCombinedOutputResources,pname:maxFragmentCombinedOutputResources>>
576ifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[]
577  * [[VUID-{refpage}-OpTypeRuntimeArray-06273]]
578    code:OpTypeRuntimeArray must: only be used for an array of variables
579    with storage class code:Uniform, code:StorageBuffer, or
580    code:UniformConstant, or for the outermost dimension of an array of
581    arrays of such variables if the
582    <<features-runtimeDescriptorArray,runtimeDescriptorArray>> feature is
583    enabled,
584  * [[VUID-{refpage}-NonUniform-06274]]
585    If an instruction loads from or stores to a resource (including atomics
586    and image instructions) and the resource descriptor being accessed is
587    not dynamically uniform, then the operand corresponding to that resource
588    (e.g. the pointer or sampled image operand) must: be decorated with
589    code:NonUniform.
590endif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[]
591ifdef::VK_VERSION_1_1[]
592ifdef::VK_VERSION_1_2,VK_KHR_shader_subgroup_extended_types[]
593  * [[VUID-{refpage}-None-06275]]
594    <<features-subgroup-extended-types,shaderSubgroupExtendedTypes>> must:
595    be enabled for <<shaders-group-operations,group operations>> to use
596    8-bit integer, 16-bit integer, 64-bit integer, 16-bit floating-point,
597    and vectors of these types
598endif::VK_VERSION_1_2,VK_KHR_shader_subgroup_extended_types[]
599endif::VK_VERSION_1_1[]
600ifdef::VK_VERSION_1_2[]
601  * [[VUID-{refpage}-subgroupBroadcastDynamicId-06276]]
602    If
603    <<features-subgroupBroadcastDynamicId,code:subgroupBroadcastDynamicId>>
604    is ename:VK_TRUE, and the shader module version is 1.5 or higher, the
605    "`Index`" for code:OpGroupNonUniformQuadBroadcast must: be dynamically
606    uniform within the derivative group.
607    Otherwise, "`Index`" must: be a constant.
608  * [[VUID-{refpage}-subgroupBroadcastDynamicId-06277]]
609    If
610    <<features-subgroupBroadcastDynamicId,code:subgroupBroadcastDynamicId>>
611    is ename:VK_TRUE, and the shader module version is 1.5 or higher, the
612    "`Id`" for code:OpGroupNonUniformBroadcast must: be dynamically uniform
613    within the subgroup.
614    Otherwise, "`Id`" must: be a constant.
615endif::VK_VERSION_1_2[]
616ifdef::VK_KHR_shader_atomic_int64[]
617  * [[VUID-{refpage}-None-06278]]
618    <<features-shaderBufferInt64Atomics,shaderBufferInt64Atomics>> must: be
619    enabled for 64-bit integer atomic operations to be supported on a
620    _Pointer_ with a *Storage Class* of *StorageBuffer* or *Uniform*.
621  * [[VUID-{refpage}-None-06279]]
622    <<features-shaderSharedInt64Atomics,shaderSharedInt64Atomics>> must: be
623    enabled for 64-bit integer atomic operations to be supported on a
624    _Pointer_ with a *Storage Class* of *Workgroup*.
625endif::VK_KHR_shader_atomic_int64[]
626ifdef::VK_EXT_shader_atomic_float[]
627ifndef::VK_EXT_shader_atomic_float2[]
628  * [[VUID-{refpage}-None-06280]]
629    <<features-shaderBufferFloat32Atomics,shaderBufferFloat32Atomics>>, or
630    <<features-shaderBufferFloat32AtomicAdd,shaderBufferFloat32AtomicAdd>>,
631    or <<features-shaderBufferFloat64Atomics,shaderBufferFloat64Atomics>>,
632    or
633    <<features-shaderBufferFloat64AtomicAdd,shaderBufferFloat64AtomicAdd>>
634    must: be enabled for floating-point atomic operations to be supported on
635    a _Pointer_ with a *Storage Class* of *StorageBuffer*.
636  * [[VUID-{refpage}-None-06281]]
637    <<features-shaderSharedFloat32Atomics,shaderSharedFloat32Atomics>>, or
638    <<features-shaderSharedFloat32AtomicAdd,shaderSharedFloat32AtomicAdd>>,
639    or <<features-shaderSharedFloat64Atomics,shaderSharedFloat64Atomics>>,
640    or
641    <<features-shaderSharedFloat64AtomicAdd,shaderSharedFloat64AtomicAdd>>
642    must: be enabled for floating-point atomic operations to be supported on
643    a _Pointer_ with a *Storage Class* of *Workgroup*.
644  * [[VUID-{refpage}-None-06282]]
645    <<features-shaderImageFloat32Atomics,shaderImageFloat32Atomics>> or
646    <<features-shaderImageFloat32AtomicAdd,shaderImageFloat32AtomicAdd>>
647    must: be enabled for 32-bit floating-point atomic operations to be
648    supported on a _Pointer_ with a *Storage Class* of *Image*.
649  * [[VUID-{refpage}-None-06283]]
650    <<features-sparseImageFloat32Atomics,sparseImageFloat32Atomics>> or
651    <<features-sparseImageFloat32AtomicAdd,sparseImageFloat32AtomicAdd>>
652    must: be enabled for 32-bit floating-point atomics to be supported on
653    sparse images.
654endif::VK_EXT_shader_atomic_float2[]
655endif::VK_EXT_shader_atomic_float[]
656ifdef::VK_EXT_shader_atomic_float2[]
657  * [[VUID-{refpage}-None-06284]]
658    <<features-shaderBufferFloat32Atomics,shaderBufferFloat32Atomics>>, or
659    <<features-shaderBufferFloat32AtomicAdd,shaderBufferFloat32AtomicAdd>>,
660    or <<features-shaderBufferFloat64Atomics,shaderBufferFloat64Atomics>>,
661    or
662    <<features-shaderBufferFloat64AtomicAdd,shaderBufferFloat64AtomicAdd>>,
663    or
664    <<features-shaderBufferFloat16AtomicMinMax,shaderBufferFloat16Atomics>>,
665    or
666    <<features-shaderBufferFloat16AtomicMinMax,shaderBufferFloat16AtomicAdd>>,
667    or
668    <<features-shaderBufferFloat16AtomicMinMax,shaderBufferFloat16AtomicMinMax>>,
669    or
670    <<features-shaderBufferFloat32AtomicMinMax,shaderBufferFloat32AtomicMinMax>>,
671    or
672    <<features-shaderBufferFloat64AtomicMinMax,shaderBufferFloat64AtomicMinMax>>
673    must: be enabled for floating-point atomic operations to be supported on
674    a _Pointer_ with a *Storage Class* of *StorageBuffer*.
675  * [[VUID-{refpage}-None-06285]]
676    <<features-shaderSharedFloat32Atomics,shaderSharedFloat32Atomics>>, or
677    <<features-shaderSharedFloat32AtomicAdd,shaderSharedFloat32AtomicAdd>>,
678    or <<features-shaderSharedFloat64Atomics,shaderSharedFloat64Atomics>>,
679    or
680    <<features-shaderSharedFloat64AtomicAdd,shaderSharedFloat64AtomicAdd>>,
681    or
682    <<features-shaderBufferFloat16AtomicMinMax,shaderSharedFloat16Atomics>>,
683    or
684    <<features-shaderBufferFloat16AtomicMinMax,shaderSharedFloat16AtomicAdd>>,
685    or
686    <<features-shaderBufferFloat16AtomicMinMax,shaderSharedFloat16AtomicMinMax>>,
687    or
688    <<features-shaderSharedFloat32AtomicMinMax,shaderSharedFloat32AtomicMinMax>>,
689    or
690    <<features-shaderSharedFloat64AtomicMinMax,shaderSharedFloat64AtomicMinMax>>
691    must: be enabled for floating-point atomic operations to be supported on
692    a _Pointer_ with a *Storage Class* of *Workgroup*.
693  * [[VUID-{refpage}-None-06286]]
694    <<features-shaderImageFloat32Atomics,shaderImageFloat32Atomics>>, or
695    <<features-shaderImageFloat32AtomicAdd,shaderImageFloat32AtomicAdd>>, or
696    <<features-shaderImageFloat32AtomicMinMax,shaderImageFloat32AtomicMinMax>>
697    must: be enabled for 32-bit floating-point atomic operations to be
698    supported on a _Pointer_ with a *Storage Class* of *Image*.
699  * [[VUID-{refpage}-None-06287]]
700    <<features-sparseImageFloat32Atomics,sparseImageFloat32Atomics>>, or
701    <<features-sparseImageFloat32AtomicAdd,sparseImageFloat32AtomicAdd>>, or
702    <<features-sparseImageFloat32AtomicMinMax,sparseImageFloat32AtomicMinMax>>
703    must: be enabled for 32-bit floating-point atomics to be supported on
704    sparse images.
705endif::VK_EXT_shader_atomic_float2[]
706ifdef::VK_EXT_shader_image_atomic_int64[]
707  * [[VUID-{refpage}-None-06288]]
708    <<features-shaderImageInt64Atomics,shaderImageInt64Atomics>> must: be
709    enabled for 64-bit integer atomic operations to be supported on a
710    _Pointer_ with a *Storage Class* of *Image*.
711endif::VK_EXT_shader_image_atomic_int64[]
712ifdef::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
713  * [[VUID-{refpage}-denormBehaviorIndependence-06289]]
714    If
715    <<features-denormBehaviorIndependence,pname:denormBehaviorIndependence>>
716    is ename:VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY, then the
717    entry point must: use the same denormals execution mode for both 16-bit
718    and 64-bit floating-point types.
719  * [[VUID-{refpage}-denormBehaviorIndependence-06290]]
720    If
721    <<features-denormBehaviorIndependence,pname:denormBehaviorIndependence>>
722    is ename:VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE, then the entry
723    point must: use the same denormals execution mode for all floating-point
724    types.
725  * [[VUID-{refpage}-roundingModeIndependence-06291]]
726    If <<features-roundingModeIndependence,pname:roundingModeIndependence>>
727    is ename:VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY, then the
728    entry point must: use the same rounding execution mode for both 16-bit
729    and 64-bit floating-point types.
730  * [[VUID-{refpage}-roundingModeIndependence-06292]]
731    If <<features-roundingModeIndependence,pname:roundingModeIndependence>>
732    is ename:VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE, then the entry
733    point must: use the same rounding execution mode for all floating-point
734    types.
735  * [[VUID-{refpage}-shaderSignedZeroInfNanPreserveFloat16-06293]]
736    If
737    <<limits-shaderSignedZeroInfNanPreserveFloat16,pname:shaderSignedZeroInfNanPreserveFloat16>>
738    is ename:VK_FALSE, then code:SignedZeroInfNanPreserve for 16-bit
739    floating-point type must: not be used.
740  * [[VUID-{refpage}-shaderSignedZeroInfNanPreserveFloat32-06294]]
741    If
742    <<limits-shaderSignedZeroInfNanPreserveFloat32,pname:shaderSignedZeroInfNanPreserveFloat32>>
743    is ename:VK_FALSE, then code:SignedZeroInfNanPreserve for 32-bit
744    floating-point type must: not be used.
745  * [[VUID-{refpage}-shaderSignedZeroInfNanPreserveFloat64-06295]]
746    If
747    <<limits-shaderSignedZeroInfNanPreserveFloat64,pname:shaderSignedZeroInfNanPreserveFloat64>>
748    is ename:VK_FALSE, then code:SignedZeroInfNanPreserve for 64-bit
749    floating-point type must: not be used.
750  * [[VUID-{refpage}-shaderDenormPreserveFloat16-06296]]
751    If
752    <<limits-shaderDenormPreserveFloat16,pname:shaderDenormPreserveFloat16>>
753    is ename:VK_FALSE, then code:DenormPreserve for 16-bit floating-point
754    type must: not be used.
755  * [[VUID-{refpage}-shaderDenormPreserveFloat32-06297]]
756    If
757    <<limits-shaderDenormPreserveFloat32,pname:shaderDenormPreserveFloat32>>
758    is ename:VK_FALSE, then code:DenormPreserve for 32-bit floating-point
759    type must: not be used.
760  * [[VUID-{refpage}-shaderDenormPreserveFloat64-06298]]
761    If
762    <<limits-shaderDenormPreserveFloat64,pname:shaderDenormPreserveFloat64>>
763    is ename:VK_FALSE, then code:DenormPreserve for 64-bit floating-point
764    type must: not be used.
765  * [[VUID-{refpage}-shaderDenormFlushToZeroFloat16-06299]]
766    If
767    <<limits-shaderDenormFlushToZeroFloat16,pname:shaderDenormFlushToZeroFloat16>>
768    is ename:VK_FALSE, then code:DenormFlushToZero for 16-bit floating-point
769    type must: not be used.
770  * [[VUID-{refpage}-shaderDenormFlushToZeroFloat32-06300]]
771    If
772    <<limits-shaderDenormFlushToZeroFloat32,pname:shaderDenormFlushToZeroFloat32>>
773    is ename:VK_FALSE, then code:DenormFlushToZero for 32-bit floating-point
774    type must: not be used.
775  * [[VUID-{refpage}-shaderDenormFlushToZeroFloat64-06301]]
776    If
777    <<limits-shaderDenormFlushToZeroFloat64,pname:shaderDenormFlushToZeroFloat64>>
778    is ename:VK_FALSE, then code:DenormFlushToZero for 64-bit floating-point
779    type must: not be used.
780  * [[VUID-{refpage}-shaderRoundingModeRTEFloat16-06302]]
781    If
782    <<limits-shaderRoundingModeRTEFloat16,pname:shaderRoundingModeRTEFloat16>>
783    is ename:VK_FALSE, then code:RoundingModeRTE for 16-bit floating-point
784    type must: not be used.
785  * [[VUID-{refpage}-shaderRoundingModeRTEFloat32-06303]]
786    If
787    <<limits-shaderRoundingModeRTEFloat32,pname:shaderRoundingModeRTEFloat32>>
788    is ename:VK_FALSE, then code:RoundingModeRTE for 32-bit floating-point
789    type must: not be used.
790  * [[VUID-{refpage}-shaderRoundingModeRTEFloat64-06304]]
791    If
792    <<limits-shaderRoundingModeRTEFloat64,pname:shaderRoundingModeRTEFloat64>>
793    is ename:VK_FALSE, then code:RoundingModeRTE for 64-bit floating-point
794    type must: not be used.
795  * [[VUID-{refpage}-shaderRoundingModeRTZFloat16-06305]]
796    If
797    <<limits-shaderRoundingModeRTZFloat16,pname:shaderRoundingModeRTZFloat16>>
798    is ename:VK_FALSE, then code:RoundingModeRTZ for 16-bit floating-point
799    type must: not be used.
800  * [[VUID-{refpage}-shaderRoundingModeRTZFloat32-06306]]
801    If
802    <<limits-shaderRoundingModeRTZFloat32,pname:shaderRoundingModeRTZFloat32>>
803    is ename:VK_FALSE, then code:RoundingModeRTZ for 32-bit floating-point
804    type must: not be used.
805  * [[VUID-{refpage}-shaderRoundingModeRTZFloat64-06307]]
806    If
807    <<limits-shaderRoundingModeRTZFloat64,pname:shaderRoundingModeRTZFloat64>>
808    is ename:VK_FALSE, then code:RoundingModeRTZ for 64-bit floating-point
809    type must: not be used.
810endif::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
811ifdef::VK_EXT_transform_feedback[]
812  * [[VUID-{refpage}-Offset-06308]]
813    The code:Offset plus size of the type of each variable, in the output
814    interface of the entry point being compiled, decorated with
815    code:XfbBuffer must: not be greater than
816    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackBufferDataSize
817  * [[VUID-{refpage}-XfbBuffer-06309]]
818    For any given code:XfbBuffer value, define the buffer data size to be
819    smallest number of bytes such that, for all outputs decorated with the
820    same code:XfbBuffer value, the size of the output interface variable
821    plus the code:Offset is less than or equal to the buffer data size.
822    For a given code:Stream, the sum of all the buffer data sizes for all
823    buffers writing to that stream the must: not exceed
824    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackStreamDataSize
825  * [[VUID-{refpage}-OpEmitStreamVertex-06310]]
826    The Stream value to code:OpEmitStreamVertex and
827    code:OpEndStreamPrimitive must: be less than
828    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackStreams
829  * [[VUID-{refpage}-transformFeedbackStreamsLinesTriangles-06311]]
830    If the geometry shader emits to more than one vertex stream and
831    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:transformFeedbackStreamsLinesTriangles
832    is ename:VK_FALSE, then execution mode must: be code:OutputPoints
833  * [[VUID-{refpage}-Stream-06312]]
834    The stream number value to code:Stream must: be less than
835    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackStreams
836  * [[VUID-{refpage}-XfbStride-06313]]
837    The XFB Stride value to code:XfbStride must: be less than or equal to
838    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackBufferDataStride
839endif::VK_EXT_transform_feedback[]
840ifdef::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_KHR_buffer_device_address[]
841  * [[VUID-{refpage}-PhysicalStorageBuffer64-06314]]
842    If the code:PhysicalStorageBuffer64 addressing model is enabled any load
843    or store through a physical pointer type must: be aligned to a multiple
844    of the size of the largest scalar type in the pointed-to type.
845  * [[VUID-{refpage}-PhysicalStorageBuffer64-06315]]
846    If the code:PhysicalStorageBuffer64 addressing model is enabled the
847    pointer value of a memory access instruction must: be at least as
848    aligned as specified by the code:Aligned memory access operand.
849endif::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_KHR_buffer_device_address[]
850ifdef::VK_NV_cooperative_matrix[]
851  * [[VUID-{refpage}-OpTypeCooperativeMatrixNV-06316]]
852    For code:OpTypeCooperativeMatrixNV, the component type, scope, number of
853    rows, and number of columns must: match one of the matrices in any of
854    the supported slink:VkCooperativeMatrixPropertiesNV.
855  * [[VUID-{refpage}-OpCooperativeMatrixMulAddNV-06317]]
856    For code:OpCooperativeMatrixMulAddNV, the type of code:A must: have
857    slink:VkCooperativeMatrixPropertiesNV::pname:MSize rows and
858    slink:VkCooperativeMatrixPropertiesNV::pname:KSize columns and have a
859    component type that matches
860    slink:VkCooperativeMatrixPropertiesNV::pname:AType.
861  * [[VUID-{refpage}-OpCooperativeMatrixMulAddNV-06318]]
862    For code:OpCooperativeMatrixMulAddNV, the type of code:B must: have
863    slink:VkCooperativeMatrixPropertiesNV::pname:KSize rows and
864    slink:VkCooperativeMatrixPropertiesNV::pname:NSize columns and have a
865    component type that matches
866    slink:VkCooperativeMatrixPropertiesNV::pname:BType.
867  * [[VUID-{refpage}-OpCooperativeMatrixMulAddNV-06319]]
868    For code:OpCooperativeMatrixMulAddNV, the type of code:C must: have
869    slink:VkCooperativeMatrixPropertiesNV::pname:MSize rows and
870    slink:VkCooperativeMatrixPropertiesNV::pname:NSize columns and have a
871    component type that matches
872    slink:VkCooperativeMatrixPropertiesNV::pname:CType.
873  * [[VUID-{refpage}-OpCooperativeMatrixMulAddNV-06320]]
874    For code:OpCooperativeMatrixMulAddNV, the type of code:Result must: have
875    slink:VkCooperativeMatrixPropertiesNV::pname:MSize rows and
876    slink:VkCooperativeMatrixPropertiesNV::pname:NSize columns and have a
877    component type that matches
878    slink:VkCooperativeMatrixPropertiesNV::pname:DType.
879  * [[VUID-{refpage}-OpCooperativeMatrixMulAddNV-06321]]
880    For code:OpCooperativeMatrixMulAddNV, the type of code:A, code:B,
881    code:C, and code:Result must: all have a scope of pname:scope.
882  * [[VUID-{refpage}-OpTypeCooperativeMatrixNV-06322]]
883    code:OpTypeCooperativeMatrixNV and code:OpCooperativeMatrix*
884    instructions must: not be used in shader stages not included in
885    slink:VkPhysicalDeviceCooperativeMatrixPropertiesNV::pname:cooperativeMatrixSupportedStages.
886endif::VK_NV_cooperative_matrix[]
887  * [[VUID-{refpage}-DescriptorSet-06323]]
888    code:DescriptorSet and code:Binding decorations must: obey the
889    constraints on storage class, type, and descriptor type described in
890    <<interfaces-resources-setandbinding,DescriptorSet and Binding
891    Assignment>>
892ifdef::VK_NV_cooperative_matrix[]
893  * [[VUID-{refpage}-OpCooperativeMatrixLoadNV-06324]]
894    For code:OpCooperativeMatrixLoadNV and code:OpCooperativeMatrixStoreNV
895    instructions, the code:Pointer and code:Stride operands must: be aligned
896    to at least the lesser of 16 bytes or the natural alignment of a row or
897    column (depending on code:ColumnMajor) of the matrix (where the natural
898    alignment is the number of columns/rows multiplied by the component
899    size).
900endif::VK_NV_cooperative_matrix[]
901ifdef::VK_KHR_portability_subset[]
902  * [[VUID-{refpage}-shaderSampleRateInterpolationFunctions-06325]]
903    If the `apiext:VK_KHR_portability_subset` extension is enabled, and
904    slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:shaderSampleRateInterpolationFunctions
905    is ename:VK_FALSE, then `GLSL.std.450` fragment interpolation functions
906    are not supported by the implementation and code:OpCapability must: not
907    be set to code:InterpolationFunction.
908  * [[VUID-{refpage}-tessellationShader-06326]]
909    If <<features-tessellationShader,pname:tessellationShader>> is enabled,
910    and the `apiext:VK_KHR_portability_subset` extension is enabled, and
911    slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:tessellationIsolines
912    is ename:VK_FALSE, then code:OpExecutionMode must: not be set to
913    code:IsoLines.
914  * [[VUID-{refpage}-tessellationShader-06327]]
915    If <<features-tessellationShader,pname:tessellationShader>> is enabled,
916    and the `apiext:VK_KHR_portability_subset` extension is enabled, and
917    slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:tessellationPointMode
918    is ename:VK_FALSE, then code:OpExecutionMode must: not be set to
919    code:PointMode.
920endif::VK_KHR_portability_subset[]
921ifdef::VK_KHR_8bit_storage[]
922  * [[VUID-{refpage}-storageBuffer8BitAccess-06328]]
923    If <<features-storageBuffer8BitAccess,pname:storageBuffer8BitAccess>> is
924    ename:VK_FALSE, then objects containing an 8-bit integer element must:
925    not have storage class of *StorageBuffer*, *ShaderRecordBufferKHR*, or
926    *PhysicalStorageBuffer*.
927  * [[VUID-{refpage}-uniformAndStorageBuffer8BitAccess-06329]]
928    If
929    <<features-uniformAndStorageBuffer8BitAccess,pname:uniformAndStorageBuffer8BitAccess>>
930    is ename:VK_FALSE, then objects in the *Uniform* storage class with the
931    *Block* decoration must: not have an 8-bit integer member.
932  * [[VUID-{refpage}-storagePushConstant8-06330]]
933    If <<features-storagePushConstant8,pname:storagePushConstant8>> is
934    ename:VK_FALSE, then objects containing an 8-bit integer element must:
935    not have storage class of *PushConstant*.
936endif::VK_KHR_8bit_storage[]
937ifdef::VK_KHR_16bit_storage[]
938  * [[VUID-{refpage}-storageBuffer16BitAccess-06331]]
939    If <<features-storageBuffer16BitAccess,pname:storageBuffer16BitAccess>>
940    is ename:VK_FALSE, then objects containing 16-bit integer or 16-bit
941    floating-point elements must: not have storage class of *StorageBuffer*,
942    *ShaderRecordBufferKHR*, or *PhysicalStorageBuffer*.
943  * [[VUID-{refpage}-uniformAndStorageBuffer16BitAccess-06332]]
944    If
945    <<features-uniformAndStorageBuffer16BitAccess,pname:uniformAndStorageBuffer16BitAccess>>
946    is ename:VK_FALSE, then objects in the *Uniform* storage class with the
947    *Block* decoration must: not have 16-bit integer or 16-bit
948    floating-point members.
949  * [[VUID-{refpage}-storagePushConstant16-06333]]
950    If <<features-storagePushConstant16,pname:storagePushConstant16>> is
951    ename:VK_FALSE, then objects containing 16-bit integer or 16-bit
952    floating-point elements must: not have storage class of *PushConstant*.
953  * [[VUID-{refpage}-storageInputOutput16-06334]]
954    If <<features-storageInputOutput16,pname:storageInputOutput16>> is
955    ename:VK_FALSE, then objects containing 16-bit integer or 16-bit
956    floating-point elements must: not have storage class of *Input* or
957    *Output*.
958endif::VK_KHR_16bit_storage[]
959ifdef::VK_EXT_shader_atomic_float[]
960ifndef::VK_EXT_shader_atomic_float2[]
961  * [[VUID-{refpage}-None-06335]]
962    <<features-shaderBufferFloat32Atomics,shaderBufferFloat32Atomics>>, or
963    <<features-shaderBufferFloat32AtomicAdd,shaderBufferFloat32AtomicAdd>>,
964    or <<features-shaderSharedFloat32Atomics,shaderSharedFloat32Atomics>>,
965    or
966    <<features-shaderSharedFloat32AtomicAdd,shaderSharedFloat32AtomicAdd>>,
967    or <<features-shaderImageFloat32Atomics,shaderImageFloat32Atomics>>, or
968    <<features-shaderImageFloat32AtomicAdd,shaderImageFloat32AtomicAdd>>
969    must: be enabled for 32-bit floating point atomic operations
970  * [[VUID-{refpage}-None-06336]]
971    <<features-shaderBufferFloat64Atomics,shaderBufferFloat64Atomics>>, or
972    <<features-shaderBufferFloat64AtomicAdd,shaderBufferFloat64AtomicAdd>>,
973    or <<features-shaderSharedFloat64Atomics,shaderSharedFloat64Atomics>>,
974    or
975    <<features-shaderSharedFloat64AtomicAdd,shaderSharedFloat64AtomicAdd>>
976    must: be enabled for 64-bit floating point atomic operations
977endif::VK_EXT_shader_atomic_float2[]
978endif::VK_EXT_shader_atomic_float[]
979ifdef::VK_EXT_shader_atomic_float2[]
980  * [[VUID-{refpage}-None-06337]]
981    <<features-shaderBufferFloat16Atomics,shaderBufferFloat16Atomics>>, or
982    <<features-shaderBufferFloat16AtomicAdd,shaderBufferFloat16AtomicAdd>>,
983    or
984    <<features-shaderBufferFloat16AtomicMinMax,shaderBufferFloat16AtomicMinMax>>,
985    or <<features-shaderSharedFloat16Atomics,shaderSharedFloat16Atomics>>,
986    or
987    <<features-shaderSharedFloat16AtomicAdd,shaderSharedFloat16AtomicAdd>>,
988    or
989    <<features-shaderSharedFloat16AtomicMinMax,shaderSharedFloat16AtomicMinMax>>
990    must: be enabled for 16-bit floating point atomic operations
991  * [[VUID-{refpage}-None-06338]]
992    <<features-shaderBufferFloat32Atomics,shaderBufferFloat32Atomics>>, or
993    <<features-shaderBufferFloat32AtomicAdd,shaderBufferFloat32AtomicAdd>>,
994    or <<features-shaderSharedFloat32Atomics,shaderSharedFloat32Atomics>>,
995    or
996    <<features-shaderSharedFloat32AtomicAdd,shaderSharedFloat32AtomicAdd>>,
997    or <<features-shaderImageFloat32Atomics,shaderImageFloat32Atomics>>, or
998    <<features-shaderImageFloat32AtomicAdd,shaderImageFloat32AtomicAdd>> or
999    <<features-shaderBufferFloat32AtomicMinMax,shaderBufferFloat32AtomicMinMax>>,
1000    or
1001    <<features-shaderSharedFloat32AtomicMinMax,shaderSharedFloat32AtomicMinMax>>,
1002    or
1003    <<features-shaderImageFloat32AtomicMinMax,shaderImageFloat32AtomicMinMax>>
1004    must: be enabled for 32-bit floating point atomic operations
1005  * [[VUID-{refpage}-None-06339]]
1006    <<features-shaderBufferFloat64Atomics,shaderBufferFloat64Atomics>>, or
1007    <<features-shaderBufferFloat64AtomicAdd,shaderBufferFloat64AtomicAdd>>,
1008    or <<features-shaderSharedFloat64Atomics,shaderSharedFloat64Atomics>>,
1009    or
1010    <<features-shaderSharedFloat64AtomicAdd,shaderSharedFloat64AtomicAdd>>,
1011    or
1012    <<features-shaderBufferFloat64AtomicMinMax,shaderBufferFloat64AtomicMinMax>>,
1013    or
1014    <<features-shaderSharedFloat64AtomicMinMax,shaderSharedFloat64AtomicMinMax>>,
1015    must: be enabled for 64-bit floating point atomic operations
1016endif::VK_EXT_shader_atomic_float2[]
1017  * [[VUID-{refpage}-NonWritable-06340]]
1018    If <<features-fragmentStoresAndAtomics, fragmentStoresAndAtomics>> is
1019    not enabled, then all storage image, storage texel buffer, and storage
1020    buffer variables in the fragment stage must: be decorated with the
1021    code:NonWritable decoration.
1022  * [[VUID-{refpage}-NonWritable-06341]]
1023    If <<features-vertexPipelineStoresAndAtomics,
1024    vertexPipelineStoresAndAtomics>> is not enabled, then all storage image,
1025    storage texel buffer, and storage buffer variables in the vertex,
1026    tessellation, and geometry stages must: be decorated with the
1027    code:NonWritable decoration.
1028  * [[VUID-{refpage}-None-06342]]
1029    If <<limits-subgroupQuadOperationsInAllStages,
1030    subgroupQuadOperationsInAllStages>> is ename:VK_FALSE, then
1031    <<features-subgroup-quad,quad subgroup operations>> must: not be used
1032    except for in fragment and compute stages.
1033ifdef::VK_VERSION_1_1[]
1034  * [[VUID-{refpage}-None-06343]]
1035    <<shaders-group-operations,Group operations>> with
1036    <<shaders-scope-subgroup, subgroup scope>> must: not be used if the
1037    shader stage is not in <<limits-subgroupSupportedStages,
1038    subgroupSupportedStages>>.
1039endif::VK_VERSION_1_1[]
1040  * [[VUID-{refpage}-Offset-06344]]
1041    The first element of the code:Offset operand of code:InterpolateAtOffset
1042    must: be greater than or equal to:
1043    {empty}:: [eq]#frag~width~ {times} <<limits-minInterpolationOffset,
1044              pname:minInterpolationOffset>>#
1045+
1046where [eq]#frag~width~# is the width of the current fragment in pixels.
1047  * [[VUID-{refpage}-Offset-06345]]
1048    The first element of the code:Offset operand of code:InterpolateAtOffset
1049    must: be less than or equal to:
1050    {empty}:: [eq]#frag~width~ {times} (<<limits-maxInterpolationOffset,
1051              pname:maxInterpolationOffset>> {plus} ULP ) - ULP#
1052+
1053where [eq]#frag~width~# is the width of the current fragment in pixels and
1054[eq]#ULP = 1 /
10552^<<limits-subPixelInterpolationOffsetBits,pname:subPixelInterpolationOffsetBits>>^#.
1056  * [[VUID-{refpage}-Offset-06346]]
1057    The second element of the code:Offset operand of
1058    code:InterpolateAtOffset must: be greater than or equal to:
1059    {empty}:: [eq]#frag~height~ {times} <<limits-minInterpolationOffset,
1060              pname:minInterpolationOffset>>#
1061+
1062where [eq]#frag~height~# is the height of the current fragment in pixels.
1063  * [[VUID-{refpage}-Offset-06347]]
1064    The second element of the code:Offset operand of
1065    code:InterpolateAtOffset must: be less than or equal to:
1066    {empty}:: [eq]#frag~height~ {times} (<<limits-maxInterpolationOffset,
1067              pname:maxInterpolationOffset>> {plus} ULP ) - ULP#
1068+
1069where [eq]#frag~height~# is the height of the current fragment in pixels and
1070[eq]#ULP = 1 /
10712^<<limits-subPixelInterpolationOffsetBits,pname:subPixelInterpolationOffsetBits>>^#.
1072
1073ifdef::VK_KHR_ray_query[]
1074  * [[VUID-{refpage}-OpRayQueryInitializeKHR-06348]]
1075    For code:OpRayQueryInitializeKHR instructions, all components of the
1076    code:RayOrigin and code:RayDirection operands must: be finite
1077    floating-point values.
1078  * [[VUID-{refpage}-OpRayQueryInitializeKHR-06349]]
1079    For code:OpRayQueryInitializeKHR instructions, the code:RayTmin and
1080    code:RayTmax operands must: be non-negative floating-point values.
1081  * [[VUID-{refpage}-OpRayQueryInitializeKHR-06350]]
1082    For code:OpRayQueryInitializeKHR instructions, the code:RayTmin operand
1083    must: be less than or equal to the code:RayTmax operand.
1084  * [[VUID-{refpage}-OpRayQueryInitializeKHR-06351]]
1085    For code:OpRayQueryInitializeKHR instructions, code:RayOrigin,
1086    code:RayDirection, code:RayTmin, and code:RayTmax operands must: not
1087    contain NaNs.
1088  * [[VUID-{refpage}-OpRayQueryInitializeKHR-06352]]
1089    For code:OpRayQueryInitializeKHR instructions, code:Acceleration
1090    code:Structure must: be an acceleration structure built as a
1091    <<acceleration-structure-top-level, top-level acceleration structure>>.
1092  * [[VUID-{refpage}-OpRayQueryGenerateIntersectionKHR-06353]]
1093    For code:OpRayQueryGenerateIntersectionKHR instructions, code:Hit code:T
1094    must: satisfy the condition [eq]##code:RayTmin {leq} code:Hit code:T
1095    {leq} code:RayTmax##, where code:RayTmin is equal to the value returned
1096    by code:OpRayQueryGetRayTMinKHR with the same ray query object, and
1097    code:RayTmax is equal to the value of code:OpRayQueryGetIntersectionTKHR
1098    for the current committed intersection with the same ray query object.
1099ifdef::VK_NV_ray_tracing_motion_blur[]
1100  * [[VUID-{refpage}-OpRayQueryGenerateIntersectionKHR-06354]]
1101    For code:OpRayQueryGenerateIntersectionKHR instructions,
1102    code:Acceleration code:Structure must: not be built with
1103    ename:VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV in pname:flags.
1104endif::VK_NV_ray_tracing_motion_blur[]
1105endif::VK_KHR_ray_query[]
1106ifdef::VK_KHR_ray_tracing_pipeline[]
1107  * [[VUID-{refpage}-OpTraceRayKHR-06355]]
1108    For code:OpTraceRayKHR instructions, all components of the
1109    code:RayOrigin and code:RayDirection operands must: be finite
1110    floating-point values.
1111  * [[VUID-{refpage}-OpTraceRayKHR-06356]]
1112    For code:OpTraceRayKHR instructions, the code:RayTmin and code:RayTmax
1113    operands must: be non-negative floating-point values.
1114  * [[VUID-{refpage}-OpTraceRayKHR-06357]]
1115    For code:OpTraceRayKHR instructions, the code:RayTmin operand must: be
1116    less than or equal to the code:RayTmax operand.
1117  * [[VUID-{refpage}-OpTraceRayKHR-06358]]
1118    For code:OpTraceRayKHR instructions, code:RayOrigin, code:RayDirection,
1119    code:RayTmin, and code:RayTmax operands must: not contain NaNs.
1120  * [[VUID-{refpage}-OpTraceRayKHR-06359]]
1121    For code:OpTraceRayKHR instructions, code:Acceleration code:Structure
1122    must: be an acceleration structure built as a
1123    <<acceleration-structure-top-level, top-level acceleration structure>>.
1124endif::VK_KHR_ray_tracing_pipeline[]
1125ifdef::VK_NV_ray_tracing_motion_blur[]
1126  * [[VUID-{refpage}-OpTraceRayKHR-06360]]
1127    For code:OpTraceRayKHR instructions, if code:Acceleration code:Structure
1128    was built with ename:VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV in
1129    pname:flags, the pipeline must: have been created with
1130    ename:VK_PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NV set
1131  * [[VUID-{refpage}-OpTraceRayMotionNV-06361]]
1132    For code:OpTraceRayMotionNV instructions, all components of the
1133    code:RayOrigin and code:RayDirection operands must: be finite
1134    floating-point values.
1135  * [[VUID-{refpage}-OpTraceRayMotionNV-06362]]
1136    For code:OpTraceRayMotionNV instructions, the code:RayTmin and
1137    code:RayTmax operands must: be non-negative floating-point values.
1138  * [[VUID-{refpage}-OpTraceRayMotionNV-06363]]
1139    For code:OpTraceRayMotionNV instructions, the code:RayTmin operand must:
1140    be less than or equal to the code:RayTmax operand.
1141  * [[VUID-{refpage}-OpTraceRayMotionNV-06364]]
1142    For code:OpTraceRayMotionNV instructions, code:RayOrigin,
1143    code:RayDirection, code:RayTmin, and code:RayTmax operands must: not
1144    contain NaNs.
1145  * [[VUID-{refpage}-OpTraceRayMotionNV-06365]]
1146    For code:OpTraceRayMotionNV instructions, code:Acceleration
1147    code:Structure must: be an acceleration structure built as a
1148    <<acceleration-structure-top-level, top-level acceleration structure>>
1149    with ename:VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV in pname:flags
1150  * [[VUID-{refpage}-OpTraceRayMotionNV-06366]]
1151    For code:OpTraceRayMotionNV instructions the code:time operand must: be
1152    between 0.0 and 1.0
1153  * [[VUID-{refpage}-OpTraceRayMotionNV-06367]]
1154    For code:OpTraceRayMotionNV instructions the pipeline must: have been
1155    created with ename:VK_PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NV
1156    set
1157endif::VK_NV_ray_tracing_motion_blur[]
1158  * [[VUID-{refpage}-x-06429]]
1159    The pname:x size in code:LocalSize or code:LocalSizeId must: be less
1160    than or equal to
1161    sname:VkPhysicalDeviceLimits::pname:maxComputeWorkGroupSize[0]
1162  * [[VUID-{refpage}-y-06430]]
1163    The pname:y size in code:LocalSize or code:LocalSizeId must: be less
1164    than or equal to
1165    sname:VkPhysicalDeviceLimits::pname:maxComputeWorkGroupSize[1]
1166  * [[VUID-{refpage}-z-06431]]
1167    The pname:z size in code:LocalSize or code:LocalSizeId must: be less
1168    than or equal to
1169    sname:VkPhysicalDeviceLimits::pname:maxComputeWorkGroupSize[2]
1170  * [[VUID-{refpage}-x-06432]]
1171    The product of pname:x size, pname:y size, and pname:z size in
1172    code:LocalSize or code:LocalSizeId must: be less than or equal to
1173    sname:VkPhysicalDeviceLimits::pname:maxComputeWorkGroupInvocations
1174ifndef::VK_KHR_maintenance4[]
1175  * [[VUID-{refpage}-LocalSizeId-06433]]
1176    The execution mode code:LocalSizeId must: not be used
1177endif::VK_KHR_maintenance4[]
1178ifdef::VK_KHR_maintenance4[]
1179  * [[VUID-{refpage}-LocalSizeId-06434]]
1180    if execution mode code:LocalSizeId is used, <<features-maintenance4,
1181    pname:maintenance4>> must: be enabled
1182endif::VK_KHR_maintenance4[]
1183ifdef::VK_KHR_zero_initialize_workgroup_memory[]
1184  * [[VUID-{refpage}-shaderZeroInitializeWorkgroupMemory-06372]]
1185    If
1186    <<features-shaderZeroInitializeWorkgroupMemory,pname:shaderZeroInitializeWorkgroupMemory>>
1187    is not enabled, any code:OpVariable with *Workgroup* as its *Storage
1188    Class* must: not have an code:Initializer operand
1189endif::VK_KHR_zero_initialize_workgroup_memory[]
1190ifndef::VK_KHR_zero_initialize_workgroup_memory[]
1191  * [[VUID-{refpage}-OpVariable-06373]]
1192    Any code:OpVariable with *Workgroup* as its *Storage Class* must: not
1193    have an code:Initializer operand
1194endif::VK_KHR_zero_initialize_workgroup_memory[]
1195  * [[VUID-{refpage}-OpImage-06376]]
1196    If an code:OpImage*Gather operation has an image operand of code:Offset,
1197    code:ConstOffset, or code:ConstOffsets the offset value must: be greater
1198    than or equal to <<limits-minTexelGatherOffset,minTexelGatherOffset>>
1199  * [[VUID-{refpage}-OpImage-06377]]
1200    If an code:OpImage*Gather operation has an image operand of code:Offset,
1201    code:ConstOffset, or code:ConstOffsets the offset value must: be less
1202    than or equal to <<limits-maxTexelGatherOffset,maxTexelGatherOffset>>
1203  * [[VUID-{refpage}-OpImageSample-06435]]
1204    If an code:OpImageSample* or code:OpImageFetch* operation has an image
1205    operand of code:ConstOffset then the offset value must: be greater than
1206    or equal to <<limits-minTexelOffset,minTexelOffset>>
1207  * [[VUID-{refpage}-OpImageSample-06436]]
1208    If an code:OpImageSample* or code:OpImageFetch* operation has an image
1209    operand of code:ConstOffset then the offset value must: be less than or
1210    equal to <<limits-maxTexelOffset,maxTexelOffset>>
1211ifdef::VK_QCOM_render_pass_shader_resolve[]
1212  * [[VUID-{refpage}-SampleRateShading-06378]]
1213    If the subpass description contains
1214    ename:VK_SUBPASS_DESCRIPTION_FRAGMENT_REGION_BIT_QCOM, then the SPIR-V
1215    fragment shader Capability code:SampleRateShading must: not be enabled.
1216endif::VK_QCOM_render_pass_shader_resolve[]
1217ifdef::VK_KHR_shader_subgroup_uniform_control_flow[]
1218  * [[VUID-{refpage}-SubgroupUniformControlFlowKHR-06379]]
1219    The execution mode code:SubgroupUniformControlFlowKHR must: not be
1220    applied to an entry point unless
1221    <<features-shaderSubgroupUniformControlFlow,
1222    pname:shaderSubgroupUniformControlFlow>> is enabled and the
1223    corresponding shader stage bit is set in subgroup
1224    <<limits-subgroup-supportedStages, pname:supportedStages>> and the entry
1225    point does not execute any <<ray-tracing-repack,_invocation repack
1226    instructions_>>.
1227endif::VK_KHR_shader_subgroup_uniform_control_flow[]
1228****
1229--
1230
1231[[spirvenv-precision-operation]]
1232== Precision and Operation of SPIR-V Instructions
1233
1234The following rules apply to half, single, and double-precision floating
1235point instructions:
1236
1237  * Positive and negative infinities and positive and negative zeros are
1238    generated as dictated by <<ieee-754,IEEE 754>>, but subject to the
1239    precisions allowed in the following table.
1240  * Dividing a non-zero by a zero results in the appropriately signed
1241    <<ieee-754,IEEE 754>> infinity.
1242  * Signaling [eq]##NaN##s are not required to be generated and exceptions
1243    are never raised.
1244    Signaling [eq]##NaN## may: be converted to quiet [eq]##NaN##s values by
1245    any floating point instruction.
1246  * By default, the implementation may: perform optimizations on half,
1247    single, or double-precision floating-point instructions that ignore sign
1248    of a zero, or assume that arguments and results are not NaNs or
1249    infinities.
1250ifdef::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
1251    If the entry point is declared with the code:SignedZeroInfNanPreserve
1252    execution mode, then NaNs, infinities, and the sign of zero must: not be
1253    ignored.
1254  ** The following core SPIR-V instructions must: respect the
1255     code:SignedZeroInfNanPreserve execution mode: code:OpPhi,
1256     code:OpSelect, code:OpReturnValue, code:OpVectorExtractDynamic,
1257     code:OpVectorInsertDynamic, code:OpVectorShuffle,
1258     code:OpCompositeConstruct, code:OpCompositeExtract,
1259     code:OpCompositeInsert, code:OpCopyObject, code:OpTranspose,
1260     code:OpFConvert, code:OpFNegate, code:OpFAdd, code:OpFSub, code:OpFMul,
1261     code:OpStore.
1262     This execution mode must: also be respected by code:OpLoad except for
1263     loads from the code:Input storage class in the fragment shader stage
1264     with the floating-point result type.
1265     Other SPIR-V instructions may: also respect the
1266     code:SignedZeroInfNanPreserve execution mode.
1267endif::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
1268  * The following instructions must: not flush denormalized values:
1269    code:OpConstant, code:OpConstantComposite, code:OpSpecConstant,
1270    code:OpSpecConstantComposite, code:OpLoad, code:OpStore, code:OpBitcast,
1271    code:OpPhi, code:OpSelect, code:OpFunctionCall, code:OpReturnValue,
1272    code:OpVectorExtractDynamic, code:OpVectorInsertDynamic,
1273    code:OpVectorShuffle, code:OpCompositeConstruct,
1274    code:OpCompositeExtract, code:OpCompositeInsert, code:OpCopyMemory,
1275    code:OpCopyObject.
1276ifndef::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
1277  * Any denormalized value input into a shader or potentially generated by
1278    any instruction in a shader (except those listed above) may: be flushed
1279    to 0.
1280  * The rounding mode cannot: be set, and results will be
1281    <<spirvenv-correctly-rounded, correctly rounded>>, as described below.
1282  * [eq]##NaN##s may: not be generated.
1283    Instructions that operate on a [eq]#NaN# may: not result in a [eq]#NaN#.
1284endif::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
1285ifdef::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
1286  * Denormalized values are supported.
1287  ** By default, any half, single, or double-precision denormalized value
1288     input into a shader or potentially generated by any instruction (except
1289     those listed above) or any extended instructions for GLSL in a shader
1290     may: be flushed to zero.
1291  ** If the entry point is declared with the code:DenormFlushToZero
1292     execution mode then for the affected instuctions the denormalized
1293     result must: be flushed to zero and the denormalized operands may: be
1294     flushed to zero.
1295     Denormalized values obtained via unpacking an integer into a vector of
1296     values with smaller bit width and interpreting those values as
1297     floating-point numbers must: be flushed to zero.
1298  ** The following core SPIR-V instructions must: respect the
1299     code:DenormFlushToZero execution mode: code:OpSpecConstantOp (with
1300     opcode code:OpFConvert), code:OpFConvert, code:OpFNegate, code:OpFAdd,
1301     code:OpFSub, code:OpFMul, code:OpFDiv, code:OpFRem, code:OpFMod,
1302     code:OpVectorTimesScalar, code:OpMatrixTimesScalar,
1303     code:OpVectorTimesMatrix, code:OpMatrixTimesVector,
1304     code:OpMatrixTimesMatrix, code:OpOuterProduct, code:OpDot; and the
1305     following extended instructions for GLSL: code:Round, code:RoundEven,
1306     code:Trunc, code:FAbs, code:Floor, code:Ceil, code:Fract, code:Radians,
1307     code:Degrees, code:Sin, code:Cos, code:Tan, code:Asin, code:Acos,
1308     code:Atan, code:Sinh, code:Cosh, code:Tanh, code:Asinh, code:Acosh,
1309     code:Atanh, code:Atan2, code:Pow, code:Exp, code:Log, code:Exp2,
1310     code:Log2, code:Sqrt, code:InverseSqrt, code:Determinant,
1311     code:MatrixInverse, code:Modf, code:ModfStruct, code:FMin, code:FMax,
1312     code:FClamp, code:FMix, code:Step, code:SmoothStep, code:Fma,
1313     code:UnpackHalf2x16, code:UnpackDouble2x32, code:Length, code:Distance,
1314     code:Cross, code:Normalize, code:FaceForward, code:Reflect,
1315     code:Refract, code:NMin, code:NMax, code:NClamp.
1316     Other SPIR-V instructions (except those excluded above) may: also flush
1317     denormalized values.
1318  ** The following core SPIR-V instructions must: respect the
1319     code:DenormPreserve execution mode: code:OpTranspose,
1320     code:OpSpecConstantOp, code:OpFConvert, code:OpFNegate, code:OpFAdd,
1321     code:OpFSub, code:OpFMul, code:OpVectorTimesScalar,
1322     code:OpMatrixTimesScalar, code:OpVectorTimesMatrix,
1323     code:OpMatrixTimesVector, code:OpMatrixTimesMatrix,
1324     code:OpOuterProduct, code:OpDot, code:OpFOrdEqual, code:OpFUnordEqual,
1325     code:OpFOrdNotEqual, code:OpFUnordNotEqual, code:OpFOrdLessThan,
1326     code:OpFUnordLessThan, code:OpFOrdGreaterThan,
1327     code:OpFUnordGreaterThan, code:OpFOrdLessThanEqual,
1328     code:OpFUnordLessThanEqual, code:OpFOrdGreaterThanEqual,
1329     code:OpFUnordGreaterThanEqual; and the following extended instructions
1330     for GLSL: code:FAbs, code:FSign, code:Radians, code:Degrees, code:FMin,
1331     code:FMax, code:FClamp, code:FMix, code:Fma, code:PackHalf2x16,
1332     code:PackDouble2x32, code:UnpackHalf2x16, code:UnpackDouble2x32,
1333     code:NMin, code:NMax, code:NClamp.
1334     Other SPIR-V instructions may: also preserve denorm values.
1335endif::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
1336
1337The precision of double-precision instructions is at least that of single
1338precision.
1339
1340The precision of operations is defined either in terms of rounding, as an
1341error bound in ULP, or as inherited from a formula as follows.
1342
1343[[spirvenv-correctly-rounded]]
1344.Correctly Rounded
1345Operations described as "`correctly rounded`" will return the infinitely
1346precise result, [eq]#x#, rounded so as to be representable in
1347floating-point.
1348ifdef::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
1349The rounding mode is not specified, unless the entry point is declared with
1350the code:RoundingModeRTE or the code:RoundingModeRTZ execution mode.
1351These execution modes affect only correctly rounded SPIR-V instructions.
1352These execution modes do not affect code:OpQuantizeToF16.
1353If the rounding mode is not specified then this rounding is implementation
1354specific, subject to the following rules.
1355endif::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
1356ifndef::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
1357The rounding mode used is not defined but must: obey the following rules.
1358endif::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
1359If [eq]#x# is exactly representable then [eq]#x# will be returned.
1360Otherwise, either the floating-point value closest to and no less than
1361[eq]#x# or the value closest to and no greater than [eq]#x# will be
1362returned.
1363
1364.ULP
1365Where an error bound of [eq]#n# ULP (units in the last place) is given, for
1366an operation with infinitely precise result #x# the value returned must: be
1367in the range [eq]#[x - n {times} ulp(x), x {plus} n {times} ulp(x)]#.
1368The function [eq]#ulp(x)# is defined as follows:
1369
1370  {empty}:: If there exist non-equal floating-point numbers #a# and #b# such
1371    that [eq]#a {leq} x {leq} b# then [eq]#ulp(x)# is the minimum possible
1372    distance between such numbers, latexmath:[ulp(x) = \mathrm{min}_{a,b} |
1373    b - a |].
1374    If such numbers do not exist then [eq]#ulp(x)# is defined to be the
1375    difference between the two finite floating-point numbers nearest to
1376    [eq]#x#.
1377
1378Where the range of allowed return values includes any value of magnitude
1379larger than that of the largest representable finite floating-point number,
1380operations may:, additionally, return either an infinity of the appropriate
1381sign or the finite number with the largest magnitude of the appropriate
1382sign.
1383If the infinitely precise result of the operation is not mathematically
1384defined then the value returned is undefined:.
1385
1386.Inherited From ...
1387Where an operation's precision is described as being inherited from a
1388formula, the result returned must: be at least as accurate as the result of
1389computing an approximation to [eq]#x# using a formula equivalent to the
1390given formula applied to the supplied inputs.
1391Specifically, the formula given may be transformed using the mathematical
1392associativity, commutativity and distributivity of the operators involved to
1393yield an equivalent formula.
1394The SPIR-V precision rules, when applied to each such formula and the given
1395input values, define a range of permitted values.
1396If [eq]#NaN# is one of the permitted values then the operation may return
1397any result, otherwise let the largest permitted value in any of the ranges
1398be [eq]#F~max~# and the smallest be [eq]#F~min~#.
1399The operation must: return a value in the range [eq]#[x - E, x {plus} E]#
1400where latexmath:[E = \mathrm{max} \left( | x - F_{\mathrm{min}} |, | x -
1401F_{\mathrm{max}} | \right) ].
1402ifdef::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
1403If the entry point is declared with the code:DenormFlushToZero execution
1404mode, then any intermediate denormal value(s) while evaluating the formula
1405may: be flushed to zero.
1406Denormal final results must: be flushed to zero.
1407If the entry point is declared with the code:DenormPreserve execution mode,
1408then denormals must: be preserved throughout the formula.
1409endif::VK_VERSION_1_2,VK_KHR_shader_float_controls[]
1410
1411ifdef::VK_VERSION_1_2,VK_KHR_shader_float16_int8[]
1412For half- (16 bit) and single- (32 bit) precision instructions, precisions
1413are required: to be at least as follows:
1414
1415.Precision of core SPIR-V Instructions
1416[options="header", cols=",,"]
1417|====
1418| Instruction
1419 | Single precision, unless decorated with RelaxedPrecision | Half precision
1420| code:OpFAdd
14212+| Correctly rounded.
1422| code:OpFSub
14232+| Correctly rounded.
1424| code:OpFMul, code:OpVectorTimesScalar, code:OpMatrixTimesScalar
14252+| Correctly rounded.
1426| code:OpDot(x, y)
14272+a| Inherited from latexmath:[\sum_{i = 0}^{n - 1} x_{i} \times y_{i}].
1428| code:OpFOrdEqual, code:OpFUnordEqual
14292+| Correct result.
1430| code:OpFOrdLessThan, code:OpFUnordLessThan
14312+| Correct result.
1432| code:OpFOrdGreaterThan, code:OpFUnordGreaterThan
14332+| Correct result.
1434| code:OpFOrdLessThanEqual, code:OpFUnordLessThanEqual
14352+| Correct result.
1436| code:OpFOrdGreaterThanEqual, code:OpFUnordGreaterThanEqual
14372+| Correct result.
1438| code:OpFDiv(x,y)
1439 | 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^].
1440| code:OpFRem(x,y)
14412+| Inherited from [eq]#x - y {times} trunc(x/y)#.
1442| code:OpFMod(x,y)
14432+| Inherited from [eq]#x - y {times} floor(x/y)#.
1444| conversions between types
14452+| Correctly rounded.
1446|====
1447
1448[NOTE]
1449.Note
1450====
1451The code:OpFRem and code:OpFMod instructions use cheap approximations of
1452remainder, and the error can be large due to the discontinuity in trunc()
1453and floor().
1454This can produce mathematically unexpected results in some cases, such as
1455FMod(x,x) computing x rather than 0, and can also cause the result to have a
1456different sign than the infinitely precise result.
1457====
1458
1459.Precision of GLSL.std.450 Instructions
1460[options="header", cols=",,"]
1461|====
1462|Instruction
1463  | Single precision, unless decorated with RelaxedPrecision | Half precision
1464| code:fma()
14652+| Inherited from code:OpFMul followed by code:OpFAdd.
1466| code:exp(x),  code:exp2(x)
1467 a| latexmath:[3 + 2 \times \vert x \vert] ULP.             a| latexmath:[1 + 2 \times \vert x \vert] ULP.
1468| code:log(),  code:log2()
1469 a| 3 ULP outside the range latexmath:[[0.5, 2.0\]]. Absolute error < latexmath:[2^{-21}] inside the range latexmath:[[0.5, 2.0\]].
1470 a| 3 ULP outside the range latexmath:[[0.5, 2.0\]]. Absolute error < latexmath:[2^{-7}] inside the range latexmath:[[0.5, 2.0\]].
1471| code:pow(x, y)
14722+| Inherited from code:exp2(y {times} code:log2(x)).
1473| code:sqrt()
14742+| Inherited from 1.0 / code:inversesqrt().
1475| code:inversesqrt()
14762+| 2 ULP.
1477| code:radians(x)
14782+a| Inherited from latexmath:[x \times \frac{\pi}{180}].
1479| code:degrees(x)
14802+a| Inherited from latexmath:[x \times \frac{180}{\pi}].
1481| code:sin()
1482  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\]].
1483| code:cos()
1484  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\]].
1485| code:tan()
14862+a| Inherited from latexmath:[\frac{\sin()}{\cos()}].
1487| code:asin(x)
14882+a| Inherited from latexmath:[\mathrm{atan2}(x, sqrt(1.0 - x \times x))].
1489| code:acos(x)
14902+a| Inherited from latexmath:[\mathrm{atan2}(sqrt(1.0 - x \times x), x)].
1491| code:atan(), code:atan2()
1492   | 4096 ULP                                                      | 5 ULP.
1493| code:sinh(x)
14942+a| Inherited from latexmath:[(\exp(x) - \exp(-x)) \times 0.5].
1495| code:cosh(x)
14962+a| Inherited from latexmath:[(\exp(x) + \exp(-x)) \times 0.5].
1497| code:tanh()
14982+a| Inherited from latexmath:[\frac{\sinh()}{\cosh()}].
1499| code:asinh(x)
15002+a| Inherited from latexmath:[\log(x + sqrt(x \times x + 1.0))].
1501| code:acosh(x)
15022+a| Inherited from latexmath:[\log(x + sqrt(x \times x - 1.0))].
1503| code:atanh(x)
15042+a| Inherited from latexmath:[\log(\frac{1.0 + x}{1.0 - x}) \times 0.5].
1505| code:frexp()
15062+| Correctly rounded.
1507| code:ldexp()
15082+| Correctly rounded.
1509| code:length(x)
15102+a| Inherited from latexmath:[sqrt(dot(x, x))].
1511| code:distance(x, y)
15122+a| Inherited from latexmath:[length(x - y)].
1513| code:cross()
15142+| Inherited from [eq]#code:OpFSub(code:OpFMul, code:OpFMul)#.
1515| code:normalize(x)
15162+a| Inherited from latexmath:[\frac{x}{length(x)}].
1517| code:faceforward(N, I, NRef)
15182+| Inherited from [eq]#code:dot(NRef, I) < 0.0 ? N : -N#.
1519| code:reflect(x, y)
15202+| Inherited from [eq]#x - 2.0 {times} code:dot(y, x) {times} y#.
1521| code:refract(I, N, eta)
15222+| Inherited from [eq]#k < 0.0 ? 0.0 : eta {times} I - (eta {times} code:dot(N, I) {plus} code:sqrt(k)) {times} N#, where [eq]#k = 1 - eta {times} eta {times} (1.0 - code:dot(N, I) {times} code:dot(N, I))#.
1523| code:round
15242+| Correctly rounded.
1525| code:roundEven
15262+| Correctly rounded.
1527| code:trunc
15282+| Correctly rounded.
1529| code:fabs
15302+| Correctly rounded.
1531| code:fsign
15322+| Correctly rounded.
1533| code:floor
15342+| Correctly rounded.
1535| code:ceil
15362+| Correctly rounded.
1537| code:fract
15382+| Correctly rounded.
1539| code:modf
15402+| Correctly rounded.
1541| code:fmin
15422+| Correctly rounded.
1543| code:fmax
15442+| Correctly rounded.
1545| code:fclamp
15462+| Correctly rounded.
1547| code:fmix(x, y, a)
15482+a| Inherited from latexmath:[x \times (1.0 - a) + y \times a].
1549| code:step
15502+| Correctly rounded.
1551| code:smoothStep(edge0, edge1, x)
15522+a| Inherited from latexmath:[t \times t \times (3.0 - 2.0 \times t)],
1553where latexmath:[t = clamp(\frac{x - edge0}{edge1 - edge0}, 0.0, 1.0)].
1554| code:nmin
15552+| Correctly rounded.
1556| code:nmax
15572+| Correctly rounded.
1558| code:nclamp
15592+| Correctly rounded.
1560|====
1561endif::VK_VERSION_1_2,VK_KHR_shader_float16_int8[]
1562
1563ifndef::VK_VERSION_1_2,VK_KHR_shader_float16_int8[]
1564For single precision (32 bit) instructions, precisions are required: to be
1565at least as follows, unless decorated with RelaxedPrecision:
1566
1567.Precision of core SPIR-V Instructions
1568[options="header"]
1569|====
1570| Instruction                                                     | Precision
1571| code:OpFAdd                                                     | Correctly rounded.
1572| code:OpFSub                                                     | Correctly rounded.
1573| code:OpFMul, code:OpVectorTimesScalar, code:OpMatrixTimesScalar | Correctly rounded.
1574| code:OpFOrdEqual, code:OpFUnordEqual                            | Correct result.
1575| code:OpFOrdLessThan, code:OpFUnordLessThan                      | Correct result.
1576| code:OpFOrdGreaterThan, code:OpFUnordGreaterThan                | Correct result.
1577| code:OpFOrdLessThanEqual, code:OpFUnordLessThanEqual            | Correct result.
1578| code:OpFOrdGreaterThanEqual, code:OpFUnordGreaterThanEqual      | Correct result.
1579| code:OpFDiv(x,y)                                                | 2.5 ULP for [eq]#{vert}y{vert}# in the range [2^-126^, 2^126^].
1580| conversions between types                                       | Correctly rounded.
1581|====
1582
1583.Precision of GLSL.std.450 Instructions
1584[options="header"]
1585|====
1586|Instruction                 | Precision
1587| code:fma()                 | Inherited from code:OpFMul followed by code:OpFAdd.
1588| code:exp(x),  code:exp2(x) | [eq]#3 {plus} 2 {times} {vert}x{vert}# ULP.
1589| 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]#.
1590| code:pow(x, y)             | Inherited from code:exp2(y {times} code:log2(x)).
1591| code:sqrt()                | Inherited from 1.0 / code:inversesqrt().
1592| code:inversesqrt()         | 2 ULP.
1593|====
1594endif::VK_VERSION_1_2,VK_KHR_shader_float16_int8[]
1595
1596GLSL.std.450 extended instructions specifically defined in terms of the
1597above instructions inherit the above errors.
1598GLSL.std.450 extended instructions not listed above and not defined in terms
1599of the above have undefined: precision.
1600
1601For the code:OpSRem and code:OpSMod instructions, if either operand is
1602negative the result is undefined:.
1603
1604[NOTE]
1605.Note
1606====
1607While the code:OpSRem and code:OpSMod instructions are supported by the
1608Vulkan environment, they require non-negative values and thus do not enable
1609additional functionality beyond what code:OpUMod provides.
1610====
1611
1612ifdef::VK_NV_cooperative_matrix[]
1613code:OpCooperativeMatrixMulAddNV performs its operations in an
1614implementation-dependent order and internal precision.
1615endif::VK_NV_cooperative_matrix[]
1616
1617[[spirvenv-image-signedness]]
1618== Signedness of SPIR-V Image Accesses
1619
1620SPIR-V associates a signedness with all integer image accesses.
1621This is required in certain parts of the SPIR-V and the Vulkan image access
1622pipeline to ensure defined results.
1623The signedness is determined from a combination of the access instruction's
1624code:Image code:Operands and the underlying image's code:Sampled code:Type
1625as follows:
1626
1627 1. If the instruction's code:Image code:Operands contains the
1628    code:SignExtend operand then the access is signed.
1629 2. If the instruction's code:Image code:Operands contains the
1630    code:ZeroExtend operand then the access is unsigned.
1631 3. Otherwise, the image accesses signedness matches that of the
1632    code:Sampled code:Type of the code:OpTypeImage being accessed.
1633
1634[[spirvenv-format-type-matching]]
1635== Image Format and Type Matching
1636
1637When specifying the code:Image code:Format of an code:OpTypeImage, the
1638converted bit width and type, as shown in the table below, must: match the
1639code:Sampled code:Type.
1640The signedness must: match the <<spirvenv-image-signedness,signedness of any
1641access>> to the image.
1642
1643[NOTE]
1644.Note
1645====
1646Formatted accesses are always converted from a shader readable type to the
1647resource's format or vice versa via <<textures-format-conversion>> for reads
1648and <<textures-output-format-conversion>> for writes.
1649As such, the bit width and format below do not necessarily match 1:1 with
1650what might be expected for some formats.
1651====
1652
1653For a given code:Image code:Format, the code:Sampled code:Type must: be the
1654type described in the _Type_ column of the below table, with its
1655code:Literal code:Width set to that in the _Bit Width_ column.
1656Every access that is made to the image must: have a signedness equal to that
1657in the _Signedness_ column (where applicable).
1658
1659[options="autowidth"]
1660|===
1661| Image Format       | Type                 | Bit Width | Signedness
1662
1663| code:Unknown       | Any                  | Any       | Any
1664| code:Rgba32f   .20+| code:OpTypeFloat .20+| 32    .20+| N/A
1665| code:Rg32f
1666| code:R32f
1667| code:Rgba16f
1668| code:Rg16f
1669| code:R16f
1670| code:Rgba16
1671| code:Rg16
1672| code:R16
1673| code:Rgba16Snorm
1674| code:Rg16Snorm
1675| code:R16Snorm
1676| code:Rgb10A2
1677| code:R11fG11fB10f
1678| code:Rgba8
1679| code:Rg8
1680| code:R8
1681| code:Rgba8Snorm
1682| code:Rg8Snorm
1683| code:R8Snorm
1684| code:Rgba32i   .19+| code:OpTypeInt   .19+| 32     .9+| 1
1685| code:Rg32i
1686| code:R32i
1687| code:Rgba16i
1688| code:Rg16i
1689| code:R16i
1690| code:Rgba8i
1691| code:Rg8i
1692| code:R8i
1693| code:Rgba32ui                                     .10+| 0
1694| code:Rg32ui
1695| code:R32ui
1696| code:Rgba16ui
1697| code:Rg16ui
1698| code:R16ui
1699| code:Rgb10a2ui
1700| code:Rgba8ui
1701| code:Rg8ui
1702| code:R8ui
1703| code:R64i       .2+| code:OpTypeInt    .2+| 64        | 1
1704| code:R64ui                                            | 0
1705|===
1706
1707[[spirvenv-image-formats]]
1708== Compatibility Between SPIR-V Image Formats And Vulkan Formats
1709
1710SPIR-V code:Image code:Format values are compatible with elink:VkFormat
1711values as defined below:
1712
1713.SPIR-V and Vulkan Image Format Compatibility
1714[cols="2*", options="header"]
1715|====
1716|SPIR-V Image Format    |Compatible Vulkan Format
1717|code:Unknown           |Any
1718|code:Rgba32f           |ename:VK_FORMAT_R32G32B32A32_SFLOAT
1719|code:Rgba16f           |ename:VK_FORMAT_R16G16B16A16_SFLOAT
1720|code:R32f              |ename:VK_FORMAT_R32_SFLOAT
1721|code:Rgba8             |ename:VK_FORMAT_R8G8B8A8_UNORM
1722|code:Rgba8Snorm        |ename:VK_FORMAT_R8G8B8A8_SNORM
1723|code:Rg32f             |ename:VK_FORMAT_R32G32_SFLOAT
1724|code:Rg16f             |ename:VK_FORMAT_R16G16_SFLOAT
1725|code:R11fG11fB10f      |ename:VK_FORMAT_B10G11R11_UFLOAT_PACK32
1726|code:R16f              |ename:VK_FORMAT_R16_SFLOAT
1727|code:Rgba16            |ename:VK_FORMAT_R16G16B16A16_UNORM
1728|code:Rgb10A2           |ename:VK_FORMAT_A2B10G10R10_UNORM_PACK32
1729|code:Rg16              |ename:VK_FORMAT_R16G16_UNORM
1730|code:Rg8               |ename:VK_FORMAT_R8G8_UNORM
1731|code:R16               |ename:VK_FORMAT_R16_UNORM
1732|code:R8                |ename:VK_FORMAT_R8_UNORM
1733|code:Rgba16Snorm       |ename:VK_FORMAT_R16G16B16A16_SNORM
1734|code:Rg16Snorm         |ename:VK_FORMAT_R16G16_SNORM
1735|code:Rg8Snorm          |ename:VK_FORMAT_R8G8_SNORM
1736|code:R16Snorm          |ename:VK_FORMAT_R16_SNORM
1737|code:R8Snorm           |ename:VK_FORMAT_R8_SNORM
1738|code:Rgba32i           |ename:VK_FORMAT_R32G32B32A32_SINT
1739|code:Rgba16i           |ename:VK_FORMAT_R16G16B16A16_SINT
1740|code:Rgba8i            |ename:VK_FORMAT_R8G8B8A8_SINT
1741|code:R32i              |ename:VK_FORMAT_R32_SINT
1742|code:Rg32i             |ename:VK_FORMAT_R32G32_SINT
1743|code:Rg16i             |ename:VK_FORMAT_R16G16_SINT
1744|code:Rg8i              |ename:VK_FORMAT_R8G8_SINT
1745|code:R16i              |ename:VK_FORMAT_R16_SINT
1746|code:R8i               |ename:VK_FORMAT_R8_SINT
1747|code:Rgba32ui          |ename:VK_FORMAT_R32G32B32A32_UINT
1748|code:Rgba16ui          |ename:VK_FORMAT_R16G16B16A16_UINT
1749|code:Rgba8ui           |ename:VK_FORMAT_R8G8B8A8_UINT
1750|code:R32ui             |ename:VK_FORMAT_R32_UINT
1751|code:Rgb10a2ui         |ename:VK_FORMAT_A2B10G10R10_UINT_PACK32
1752|code:Rg32ui            |ename:VK_FORMAT_R32G32_UINT
1753|code:Rg16ui            |ename:VK_FORMAT_R16G16_UINT
1754|code:Rg8ui             |ename:VK_FORMAT_R8G8_UINT
1755|code:R16ui             |ename:VK_FORMAT_R16_UINT
1756|code:R8ui              |ename:VK_FORMAT_R8_UINT
1757|code:R64i              |ename:VK_FORMAT_R64_SINT
1758|code:R64ui             |ename:VK_FORMAT_R64_UINT
1759|====
1760