Appendix A: Vulkan Environment for SPIRV
Shaders for Vulkan are defined by the Khronos SPIRV Specification as well as the Khronos SPIRV Extended Instructions for GLSL Specification. This appendix defines additional SPIRV requirements applying to Vulkan shaders.
Versions and Formats
A Vulkan 1.2 implementation must support the 1.0, 1.1, 1.2, 1.3, 1.4, and 1.5 versions of SPIRV and the 1.0 version of the SPIRV Extended Instructions for GLSL.
A SPIRV module passed into vkCreateShaderModule is interpreted as a series of 32bit words in host endianness, with literal strings packed as described in section 2.2 of the SPIRV Specification. The first few words of the SPIRV module must be a magic number and a SPIRV version number, as described in section 2.3 of the SPIRV Specification.
Capabilities
The table below lists the set of SPIRV
capabilities that may be supported in Vulkan implementations.
The application must not use any of these capabilities in SPIRV passed to
vkCreateShaderModule unless one of the following conditions is met for
the VkDevice specified in the device
parameter of
vkCreateShaderModule:

The corresponding field in the table is blank.

Any corresponding Vulkan feature is enabled.

Any corresponding Vulkan extension is enabled.

The corresponding core version is supported (as returned by VkPhysicalDeviceProperties::
apiVersion
).
SPIRV OpCapability 
Vulkan feature, extension, or core version 








































































































































































The application must not pass a SPIRV module containing any of the following to vkCreateShaderModule:

any
OpCapability
not listed above, 
an unsupported capability, or

a capability which corresponds to a Vulkan feature or extension which has not been enabled.
SPIRV Extensions
The application can pass a SPIRV module to vkCreateShaderModule that
uses the following SPIRV extensions if one of the following conditions is
met for the VkDevice specified in the device
parameter of
vkCreateShaderModule:

Any corresponding Vulkan extension is enabled.

The corresponding core version is supported (as returned by VkPhysicalDeviceProperties::
apiVersion
).
SPIRV OpExtension 
Vulkan extension or core version 




























Validation Rules within a Module
A SPIRV module passed to vkCreateShaderModule must conform to the following rules:
Standalone SPIRV Validation
Rules which can be validated with only the SPIRV module itself and do not depend on knowledge of the implementation and its capabilities or knowledge of runtime information such as enabled features.

Every entry point must have no return value and accept no arguments.

Recursion: The static functioncall graph for an entry point must not contain cycles.

The Logical or PhysicalStorageBuffer64 addressing model must be selected.

Scope for execution must be limited to:

Workgroup

The Workgroup scope must only be used in the tessellation control, and compute execution models.


Subgroup


Scope for memory must be limited to:

Device

QueueFamily

Workgroup

The WorkGroup scope must only be used in the compute execution model(s).


ShaderCallKHR

The ShaderCallKHR scope must only be used in the ray generation, intersection, closest hit, anyhit, miss, and callable execution models.


Subgroup

Invocation

Only valid if memory semantics is None



Scope for Non Uniform Group Operations must be limited to:

Subgroup


Storage Class must be limited to:

UniformConstant

Input

Uniform

Output

The Output storage class must not be used in the RayGenerationKHR, IntersectionKHR, AnyHitKHR, ClosestHitKHR, MissKHR, or CallableKHR execution models.


Workgroup

The Workgroup storage class must only be used in the compute execution model(s).


Private

Function

PushConstant

Image

StorageBuffer

RayPayloadKHR

IncomingRayPayloadKHR

HitAttributeKHR

CallableDataKHR

IncomingCallableDataKHR

ShaderRecordBufferKHR

PhysicalStorageBuffer


Memory semantics must obey the following rules:

Acquire must not be used with
OpAtomicStore
. 
Release must not be used with
OpAtomicLoad
. 
AcquireRelease must not be used with
OpAtomicStore
orOpAtomicLoad
. 
Sequentially consistent atomics and barriers are not supported and SequentiallyConsistent is treated as AcquireRelease. SequentiallyConsistent should not be used.

OpMemoryBarrier
must use one of Acquire, Release, AcquireRelease, or SequentiallyConsistent and must include at least one storage class. 
If the semantics for
OpControlBarrier
includes one of Acquire, Release, AcquireRelease, or SequentiallyConsistent, then it must include at least one storage class. 
SubgroupMemory, CrossWorkgroupMemory, and AtomicCounterMemory are ignored.


Any
OpVariable
with anInitializer
operand must have one of the following as its Storage Class operand:
Output

Private

Function


Scope for
OpReadClockKHR
must be limited to:
Subgroup

Device


The
OriginLowerLeft
execution mode must not be used; fragment entry points must declareOriginUpperLeft
. 
The
PixelCenterInteger
execution mode must not be used. Pixels are always centered at halfinteger coordinates. 
Any variable in the
UniformConstant
storage class must be typed as either:
OpTypeImage

OpTypeSampler

OpTypeSampledImage

OpTypeAccelerationStructureKHR
, 
An array of one of these types.


Images and Samplers

OpTypeImage
must declare a scalar 32bit float or 32bit integer type for the “Sampled Type”. (RelaxedPrecision
can be applied to a sampling instruction and to the variable holding the result of a sampling instruction.) 
OpTypeImage
must have a “Sampled” operand of 1 (sampled image) or 2 (storage image). 
If an
OpImageTexelPointer
is used in an atomic operation, the image type of theimage
parameter toOpImageTexelPointer
must have an image format ofR32i
orR32ui
. 
OpImageQuerySizeLod
, andOpImageQueryLevels
must only consume an “Image” operand whose type has its “Sampled” operand set to 1. 
The (u,v) coordinates used for a
SubpassData
must be the <id> of a constant vector (0,0), or if a layer coordinate is used, must be a vector that was formed with constant 0 for the u and v components. 
The “Depth” operand of
OpTypeImage
is ignored. 
Objects of types
OpTypeImage
,OpTypeSampler
,OpTypeSampledImage
, and arrays of these types must not be stored to or modified.


Any image operation must use at most one of the
Offset
,ConstOffset
, andConstOffsets
image operands. 
Image operand
Offset
must only be used withOpImage
*Gather
instructions. 
The “Component” operand of
OpImageGather
, andOpImageSparseGather
must be the <id> of a constant instruction. 
Acceleration Structures

Objects of types
OpTypeAccelerationStructureKHR
and arrays of this type must not be stored to or modified.


The value of the “Hit Kind” operand of
OpReportIntersectionKHR
must be in the range [0,127]. 
Structure types must not contain opaque types.

Decorations

Any
BuiltIn
decoration not listed in BuiltIn Variables must not be used. 
The
GLSLShared
andGLSLPacked
decorations must not be used. 
The
Flat
,NoPerspective
,Sample
, andCentroid
decorations must not be used on variables with storage class other thanInput
or on variables used in the interface of nonfragment shader entry points. 
The
Patch
decoration must not be used on variables in the interface of a vertex, geometry, or fragment shader stage’s entry point. 
Only the roundtonearesteven and the roundtowardszero rounding modes can be used for the
FPRoundingMode
decoration. 
The
FPRoundingMode
decoration can only be used for the floatingpoint conversion instructions as described in theSPV_KHR_16bit_storage
SPIRV extension. 
Variables decorated with
Invariant
and variables with structure types that have any members decorated withInvariant
must be in theOutput
orInput
storage class.Invariant
used on anInput
storage class variable or structure member has no effect.


OpTypeRuntimeArray
must only be used for:
the last member of an
OpTypeStruct
that is in theStorageBuffer
storage class decorated asBlock
, or that is in thePhysicalStorageBuffer
storage class decorated asBlock
, or that is in theUniform
storage class decorated asBufferBlock
.


Specialization constants:

A type T that is an array sized with a specialization constant can be, or be contained in, the type of a Variable V only if:

T is the (toplevel) type of V, or

V is declared in the
Function
,Private
, orWorkgroup
storage classes, or 
V is an interface variable with an additional level of arrayness, as described in interface matching, in which case T is allowed to be the element type of the (toplevel) type of V.



If
OpControlBarrier
is used in ray generation, intersection, anyhit, closest hit, miss, fragment, vertex, tessellation evaluation, or geometry shaders, the execution Scope must beSubgroup
. 
Compute Shaders

For each compute shader entry point, either a
LocalSize
execution mode or an object decorated with theWorkgroupSize
decoration must be specified.


If
OpGroupNonUniformBallotBitCount
is used, the group operation must be one of:
Reduce

InclusiveScan

ExclusiveScan


Atomic instructions must declare a scalar 32bit integer type, or a scalar 64bit integer type if the
Int64Atomics
capability is enabled, for the value pointed to by Pointer. 
The Pointer operand of all atomic instructions must have a Storage Class limited to:

Uniform

Workgroup

Image

StorageBuffer


RayPayloadKHR
storage class must only be used in ray generation, anyhit, closest hit or miss shaders. 
IncomingRayPayloadKHR
storage class must only be used in closest hit, anyhit, or miss shaders. 
HitAttributeKHR
storage class must only be used in intersection, anyhit, or closest hit shaders. 
A variable with
HitAttributeKHR
storage class must only be written to in an intersection shader. 
CallableDataKHR
storage class must only be used in ray generation, closest hit, miss, and callable shaders. 
IncomingCallableDataKHR
storage class must only be used in callable shaders. 
The
Base
operand ofOpPtrAccessChain
must point to one of the following storage classes:
Workgroup, if
VariablePointers
is enabled. 
StorageBuffer, if
VariablePointers
orVariablePointersStorageBuffer
is enabled. 
PhysicalStorageBuffer, if the
PhysicalStorageBuffer64
addressing model is enabled.


If the
PhysicalStorageBuffer64
addressing model is enabled:
All instructions that support memory access operands and that use a physical pointer must include the
Aligned
operand. 
Any access chain instruction that accesses into a
RowMajor
matrix must only be used as thePointer
operand toOpLoad
orOpStore
. 
OpConvertUToPtr
andOpConvertPtrToU
must use an integer type whoseWidth
is 64.

Runtime SPIRV Validation
Rules which must be validated at runetime as they depend on knowledge of the implementation and its capabilities or knowledge of runtime information such as enabled features.

If
vulkanMemoryModel
is enabled andvulkanMemoryModelDeviceScope
is not enabled, Device memory scope must not be used. 
If
vulkanMemoryModel
is not enabled, Device memory scope only extends to the queue family, not the whole device. 
If
vulkanMemoryModel
is not enabled, QueueFamily memory scope must not be used. 
if
shaderSubgroupClock
is not enabled, theSubgroup
scope must not be used forOpReadClockKHR
.
Device


if
shaderDeviceClock
is not enabled, theDevice
scope must not be used forOpReadClockKHR
. 
The converted bit width, signedness, and numeric type of the
Image
Format
operand of anOpTypeImage
must match theSampled
Type
, as defined in Image Format and Type Matching. 
The
Result
Type
operand ofOpImageRead
must be a vector of four components. 
If shaderStorageImageWriteWithoutFormat is not enabled and an
OpTypeImage
has “Image Format” operand ofUnknown
, any variables created with the given type must be decorated withNonWritable
. 
If shaderStorageImageReadWithoutFormat is not enabled and an
OpTypeImage
has “Image Format” operand ofUnknown
, any variables created with the given type must be decorated withNonReadable
. 
Any
BuiltIn
decoration that corresponds only to Vulkan features or extensions that have not been enabled must not be used. 
OpTypeRuntimeArray
must only be used for an array of variables with storage classUniform
,StorageBuffer
, orUniformConstant
, or for the outermost dimension of an array of arrays of such variables if the runtimeDescriptorArray feature is enabled, 
If an instruction loads from or stores to a resource (including atomics and image instructions) and the resource descriptor being accessed is not dynamically uniform, then the operand corresponding to that resource (e.g. the pointer or sampled image operand) must be decorated with
NonUniform
. 
“Result Type” for Non Uniform Group Operations must be limited to 32bit floatingpoint, 32bit integer, boolean, or vectors of these types.

If the
Float64
capability is enabled, 64bit floatingpoint and vector of 64bit floatingpoint types are also permitted. 
If the
Int8
capability is enabled and the shaderSubgroupExtendedTypes feature isVK_TRUE
, 8bit integer and vector of 8bit integer types are also permitted. 
If the
Int16
capability is enabled and the shaderSubgroupExtendedTypes feature isVK_TRUE
, 16bit integer and vector of 16bit integer types are also permitted. 
If the
Int64
capability is enabled and the shaderSubgroupExtendedTypes feature isVK_TRUE
, 64bit integer and vector of 64bit integer types are also permitted. 
If the
Float16
capability is enabled and the shaderSubgroupExtendedTypes feature isVK_TRUE
, 16bit floatingpoint and vector of 16bit floatingpoint types are also permitted.


If
subgroupBroadcastDynamicId
isVK_TRUE
, and the shader module version is 1.5 or higher, the “Index” forOpGroupNonUniformQuadBroadcast
must be dynamically uniform within the derivative group. Otherwise, “Index” must be a constant. 
If
subgroupBroadcastDynamicId
isVK_TRUE
, and the shader module version is 1.5 or higher, the “Id” forOpGroupNonUniformBroadcast
must be dynamically uniform within the subgroup. Otherwise, “Id” must be a constant. 
shaderBufferInt64Atomics must be enabled for 64bit integer atomic operations to be supported on a Pointer with a Storage Class of StorageBuffer or Uniform.

shaderSharedInt64Atomics must be enabled for 64bit integer atomic operations to be supported on a Pointer with a Storage Class of Workgroup.

shaderBufferFloat32Atomics or shaderBufferFloat32AtomicAdd or shaderBufferFloat64Atomics or shaderBufferFloat64AtomicAdd must be enabled for floatingpoint atomic operations to be supported on a Pointer with a Storage Class of StorageBuffer.

If
denormBehaviorIndependence
isVK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY
, then the entry point must use the same denormals execution mode for both 16bit and 64bit floatingpoint types. 
If
denormBehaviorIndependence
isVK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE
, then the entry point must use the same denormals execution mode for all floatingpoint types. 
If
roundingModeIndependence
isVK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY
, then the entry point must use the same rounding execution mode for both 16bit and 64bit floatingpoint types. 
If
roundingModeIndependence
isVK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE
, then the entry point must use the same rounding execution mode for all floatingpoint types. 
If
shaderSignedZeroInfNanPreserveFloat16
isVK_FALSE
, thenSignedZeroInfNanPreserve
for 16bit floatingpoint type must not be used. 
If
shaderSignedZeroInfNanPreserveFloat32
isVK_FALSE
, thenSignedZeroInfNanPreserve
for 32bit floatingpoint type must not be used. 
If
shaderSignedZeroInfNanPreserveFloat64
isVK_FALSE
, thenSignedZeroInfNanPreserve
for 64bit floatingpoint type must not be used. 
If
shaderDenormPreserveFloat16
isVK_FALSE
, thenDenormPreserve
for 16bit floatingpoint type must not be used. 
If
shaderDenormPreserveFloat32
isVK_FALSE
, thenDenormPreserve
for 32bit floatingpoint type must not be used. 
If
shaderDenormPreserveFloat64
isVK_FALSE
, thenDenormPreserve
for 64bit floatingpoint type must not be used. 
If
shaderDenormFlushToZeroFloat16
isVK_FALSE
, thenDenormFlushToZero
for 16bit floatingpoint type must not be used. 
If
shaderDenormFlushToZeroFloat32
isVK_FALSE
, thenDenormFlushToZero
for 32bit floatingpoint type must not be used. 
If
shaderDenormFlushToZeroFloat64
isVK_FALSE
, thenDenormFlushToZero
for 64bit floatingpoint type must not be used. 
If
shaderRoundingModeRTEFloat16
isVK_FALSE
, thenRoundingModeRTE
for 16bit floatingpoint type must not be used. 
If
shaderRoundingModeRTEFloat32
isVK_FALSE
, thenRoundingModeRTE
for 32bit floatingpoint type must not be used. 
If
shaderRoundingModeRTEFloat64
isVK_FALSE
, thenRoundingModeRTE
for 64bit floatingpoint type must not be used. 
If
shaderRoundingModeRTZFloat16
isVK_FALSE
, thenRoundingModeRTZ
for 16bit floatingpoint type must not be used. 
If
shaderRoundingModeRTZFloat32
isVK_FALSE
, thenRoundingModeRTZ
for 32bit floatingpoint type must not be used. 
If
shaderRoundingModeRTZFloat64
isVK_FALSE
, thenRoundingModeRTZ
for 64bit floatingpoint type must not be used. 
If the
PhysicalStorageBuffer64
addressing model is enabled any load or store through a physical pointer type must be aligned to a multiple of the size of the largest scalar type in the pointedto type. 
If the
PhysicalStorageBuffer64
addressing model is enabled the pointer value of a memory access instruction must be at least as aligned as specified by theAligned
memory access operand. 
DescriptorSet
andBinding
decorations must obey the constraints on storage class, type, and descriptor type described in DescriptorSet and Binding Assignment
Precision and Operation of SPIRV Instructions
The following rules apply to half, single, and doubleprecision floating point instructions:

Positive and negative infinities and positive and negative zeros are generated as dictated by IEEE 754, but subject to the precisions allowed in the following table.

Dividing a nonzero by a zero results in the appropriately signed IEEE 754 infinity.

Signaling NaNs are not required to be generated and exceptions are never raised. Signaling NaN may be converted to quiet NaNs values by any floating point instruction.

By default, the implementation may perform optimizations on half, single, or doubleprecision floatingpoint instructions that ignore sign of a zero, or assume that arguments and results are not NaNs or infinities. If the entry point is declared with the
SignedZeroInfNanPreserve
execution mode, then NaNs, infinities, and the sign of zero must not be ignored.
The following core SPIRV instructions must respect the
SignedZeroInfNanPreserve
execution mode:OpPhi
,OpSelect
,OpReturnValue
,OpVectorExtractDynamic
,OpVectorInsertDynamic
,OpVectorShuffle
,OpCompositeConstruct
,OpCompositeExtract
,OpCompositeInsert
,OpCopyObject
,OpTranspose
,OpFConvert
,OpFNegate
,OpFAdd
,OpFSub
,OpFMul
,OpStore
. This execution mode must also be respected byOpLoad
except for loads from theInput
storage class in the fragment shader stage with the floatingpoint result type. Other SPIRV instructions may also respect theSignedZeroInfNanPreserve
execution mode.


The following instructions must not flush denormalized values:
OpConstant
,OpConstantComposite
,OpSpecConstant
,OpSpecConstantComposite
,OpLoad
,OpStore
,OpBitcast
,OpPhi
,OpSelect
,OpFunctionCall
,OpReturnValue
,OpVectorExtractDynamic
,OpVectorInsertDynamic
,OpVectorShuffle
,OpCompositeConstruct
,OpCompositeExtract
,OpCompositeInsert
,OpCopyMemory
,OpCopyObject
. 
Denormalized values are supported.

By default, any half, single, or doubleprecision denormalized value input into a shader or potentially generated by any instruction (except those listed above) or any extended instructions for GLSL in a shader may be flushed to zero.

If the entry point is declared with the
DenormFlushToZero
execution mode then for the affected instuctions the denormalized result must be flushed to zero and the denormalized operands may be flushed to zero. Denormalized values obtained via unpacking an integer into a vector of values with smaller bit width and interpreting those values as floatingpoint numbers must be flushed to zero. 
The following core SPIRV instructions must respect the
DenormFlushToZero
execution mode:OpSpecConstantOp
(with opcodeOpFConvert
),OpFConvert
,OpFNegate
,OpFAdd
,OpFSub
,OpFMul
,OpFDiv
,OpFRem
,OpFMod
,OpVectorTimesScalar
,OpMatrixTimesScalar
,OpVectorTimesMatrix
,OpMatrixTimesVector
,OpMatrixTimesMatrix
,OpOuterProduct
,OpDot
; and the following extended instructions for GLSL:Round
,RoundEven
,Trunc
,FAbs
,Floor
,Ceil
,Fract
,Radians
,Degrees
,Sin
,Cos
,Tan
,Asin
,Acos
,Atan
,Sinh
,Cosh
,Tanh
,Asinh
,Acosh
,Atanh
,Atan2
,Pow
,Exp
,Log
,Exp2
,Log2
,Sqrt
,InverseSqrt
,Determinant
,MatrixInverse
,Modf
,ModfStruct
,FMin
,FMax
,FClamp
,FMix
,Step
,SmoothStep
,Fma
,UnpackHalf2x16
,UnpackDouble2x32
,Length
,Distance
,Cross
,Normalize
,FaceForward
,Reflect
,Refract
,NMin
,NMax
,NClamp
. Other SPIRV instructions (except those excluded above) may also flush denormalized values. 
The following core SPIRV instructions must respect the
DenormPreserve
execution mode:OpTranspose
,OpSpecConstantOp
,OpFConvert
,OpFNegate
,OpFAdd
,OpFSub
,OpFMul
,OpVectorTimesScalar
,OpMatrixTimesScalar
,OpVectorTimesMatrix
,OpMatrixTimesVector
,OpMatrixTimesMatrix
,OpOuterProduct
,OpDot
,OpFOrdEqual
,OpFUnordEqual
,OpFOrdNotEqual
,OpFUnordNotEqual
,OpFOrdLessThan
,OpFUnordLessThan
,OpFOrdGreaterThan
,OpFUnordGreaterThan
,OpFOrdLessThanEqual
,OpFUnordLessThanEqual
,OpFOrdGreaterThanEqual
,OpFUnordGreaterThanEqual
; and the following extended instructions for GLSL:FAbs
,FSign
,Radians
,Degrees
,FMin
,FMax
,FClamp
,FMix
,Fma
,PackHalf2x16
,PackDouble2x32
,UnpackHalf2x16
,UnpackDouble2x32
,NMin
,NMax
,NClamp
. Other SPIRV instructions may also preserve denorm values.

The precision of doubleprecision instructions is at least that of single precision.
The precision of operations is defined either in terms of rounding, as an error bound in ULP, or as inherited from a formula as follows.
Operations described as “correctly rounded” will return the infinitely
precise result, x, rounded so as to be representable in
floatingpoint.
The rounding mode is not specified, unless the entry point is declared with
the RoundingModeRTE
or the RoundingModeRTZ
execution mode.
These execution modes affect only correctly rounded SPIRV instructions.
These execution modes do not affect OpQuantizeToF16
.
If the rounding mode is not specified then this rounding is implementation
specific, subject to the following rules.
If x is exactly representable then x will be returned.
Otherwise, either the floatingpoint value closest to and no less than
x or the value closest to and no greater than x will be
returned.
Where an error bound of n ULP (units in the last place) is given, for an operation with infinitely precise result x the value returned must be in the range [x  n × ulp(x), x + n × ulp(x)]. The function ulp(x) is defined as follows:

If there exist nonequal floatingpoint numbers a and b such that a ≤ x ≤ b then ulp(x) is the minimum possible distance between such numbers, $ulp(x)=min_{a,b}∣b−a∣$. If such numbers do not exist then ulp(x) is defined to be the difference between the two finite floatingpoint numbers nearest to x.
Where the range of allowed return values includes any value of magnitude larger than that of the largest representable finite floatingpoint number, operations may, additionally, return either an infinity of the appropriate sign or the finite number with the largest magnitude of the appropriate sign. If the infinitely precise result of the operation is not mathematically defined then the value returned is undefined.
Where an operation’s precision is described as being inherited from a
formula, the result returned must be at least as accurate as the result of
computing an approximation to x using a formula equivalent to the
given formula applied to the supplied inputs.
Specifically, the formula given may be transformed using the mathematical
associativity, commutativity and distributivity of the operators involved to
yield an equivalent formula.
The SPIRV precision rules, when applied to each such formula and the given
input values, define a range of permitted values.
If NaN is one of the permitted values then the operation may return
any result, otherwise let the largest permitted value in any of the ranges
be F_{max} and the smallest be F_{min}.
The operation must return a value in the range [x  E, x + E]
where $E=max(∣x−F_{min}∣,∣x−F_{max}∣)$.
If the entry point is declared with the DenormFlushToZero
execution
mode, then any intermediate denormal value(s) while evaluating the formula
may be flushed to zero.
Denormal final results must be flushed to zero.
If the entry point is declared with the DenormPreserve
execution mode,
then denormals must be preserved throughout the formula.
For half (16 bit) and single (32 bit) precision instructions, precisions are required to be at least as follows:
Instruction  Single precision, unless decorated with RelaxedPrecision  Half precision 


Correctly rounded. 


Correctly rounded. 


Correctly rounded. 


Inherited from $∑_{i=0}x_{i}×y_{i}$. 


Correct result. 


Correct result. 


Correct result. 


Correct result. 


Correct result. 


2.5 ULP for y in the range [2^{126}, 2^{126}]. 
2.5 ULP for y in the range [2^{14}, 2^{14}]. 

Inherited from x  y × trunc(x/y). 


Inherited from x  y × floor(x/y). 

conversions between types 
Correctly rounded. 
Note
The 
Instruction  Single precision, unless decorated with RelaxedPrecision  Half precision 


Inherited from 


$3+2×∣x∣$ ULP. 
$1+2×∣x∣$ ULP. 

3 ULP outside the range $[0.5,2.0]$. Absolute error < $2_{−21}$ inside the range $[0.5,2.0]$. 
3 ULP outside the range $[0.5,2.0]$. Absolute error < $2_{−7}$ inside the range $[0.5,2.0]$. 

Inherited from 


Inherited from 1.0 / 


2 ULP. 


Inherited from $x×180π $. 


Inherited from $x×π180 $. 


Absolute error $≤2_{−11}$ inside the range $[−π,π]$. 
Absolute error $≤2_{−7}$ inside the range $[−π,π]$. 

Absolute error $≤2_{−11}$ inside the range $[−π,π]$. 
Absolute error $≤2_{−7}$ inside the range $[−π,π]$. 

Inherited from $cos()sin() $. 


Inherited from $atan2(x,sqrt(1.0−x×x))$. 


Inherited from $atan2(sqrt(1.0−x×x),x)$. 


4096 ULP 
5 ULP. 

Inherited from $(exp(x)−exp(−x))×0.5$. 


Inherited from $(exp(x)+exp(−x))×0.5$. 


Inherited from $cosh()sinh() $. 


Inherited from $g(x+sqrt(x×x+1.0))$. 


Inherited from $g(x+sqrt(x×x−1.0))$. 


Inherited from $g(1.0−x1.0+x )×0.5$. 


Correctly rounded. 


Correctly rounded. 


Inherited from $sqrt(dot(x,x))$. 


Inherited from $length(x−y)$. 


Inherited from 


Inherited from $length(x)x $. 


Inherited from 


Inherited from x  2.0 × 


Inherited from k < 0.0 ? 0.0 : eta × I  (eta × 


Correctly rounded. 


Correctly rounded. 


Correctly rounded. 


Correctly rounded. 


Correctly rounded. 


Correctly rounded. 


Correctly rounded. 


Correctly rounded. 


Correctly rounded. 


Correctly rounded. 


Correctly rounded. 


Correctly rounded. 


Inherited from $x×(1.0−a)+y×a$. 


Correctly rounded. 


Inherited from $t×t×(3.0−2.0×t)$, where $t=clamp(edge1−edge0x−edge0 ,0.0,1.0)$. 


Correctly rounded. 


Correctly rounded. 


Correctly rounded. 
GLSL.std.450 extended instructions specifically defined in terms of the above instructions inherit the above errors. GLSL.std.450 extended instructions not listed above and not defined in terms of the above have undefined precision.
For the OpSRem
and OpSMod
instructions, if either operand is
negative the result is undefined.
Note
While the 
Image Format and Type Matching
When specifying the Image
Format
as anything other than
Unknown
, the converted bit width, type, and signedness as shown in the
table below, must match the Sampled
Type
.
Note
Formatted accesses are always converted from a shader readable type to the resource’s format or vice versa via Format Conversion for reads and Texel Output Format Conversion for writes. As such, the bit width and format below do not necessarily match 1:1 with what might be expected for some formats. 
For a given Image
Format
, the Sampled
Type
must be the
type described in the Type column of the below table, with its
Literal
Width
set to that in the Bit Width column, and its
Literal
Signedness
to that in the Signedness column (where
applicable).
Image Format  Type  Bit Width  Signedness 


Any 
Any 
Any 


32 
N/A 








































32 
1 

















0 


















Compatibility Between SPIRV Image Formats And Vulkan Formats
SPIRV Image
Format
values are compatible with VkFormat
values as defined below:
SPIRV Image Format  Compatible Vulkan Format 


Any 













































































