unpack2x16snorm
Function
Normalized packing maps a bounded floating-point interval onto integer fields.
Related names in other languages
These related operations can differ in arguments, support, and semantics. The foreign names are not accepted TypeShade aliases. Check the target forms and restrictions.
- GLSL:
unpackSnorm2x16
Compare examples
Compare the components, hexadecimal word, and recovered values. Notice which component occupies the low field.
Example 1unpack2x16snorm(0x7fff8001)
-11 - Result
[-1, 1]
2147450881Example 2unpack2x16snorm(0x00000000)
00 - Result
[0, 0]
0Example 3unpack2x16snorm(0x20002000)
0.25000760.2500076 - Result
[0.2500076, 0.2500076]
536879104The examples are calculation models and do not run GPU work. The reference below gives the complete call signatures. Decimal results are rounded for display. The stated assumptions determine each example; actual shader results follow the target precision and execution rules.
When to use it
Use it to reduce storage or bandwidth when the reduced precision is acceptable.
Inputs and limits
Packing clamps to the normalized interval and quantizes values. Unpacking approximates the original value; the low field belongs to the first component.
For shader input rules and precision, consult WGSL and GLSL ES 3.00.
Related functions
- WGSL
unpack2x16snorm(a)- GLSL ES 3.00
unpackSnorm2x16(a)
The signature, the sentence and any message are the compiler's own text at commit af54ddad5.
Unpacks the two signed 16-bit halves of a u32 into a vec2 of values in [-1, 1], the low 16 bits into component 0.
Syntax
declare function unpack2x16snorm(a0: u32): vec2declare function unpack2x16snorm(e: u32): vec2Parameters
-
eu32
Return value
Description
unpackSnorm2x16 on GLSL ES 3.00.
Targets
- WGSL
-
unpack2x16snorm(a) - GLSL ES 3.00
-
unpackSnorm2x16(a)