pack4x8unorm
Function
Packs a vec4 of values in [0, 1] into the four bytes of a u32, component 0 in the low byte.
The signature and the sentence under each name are the compiler's own text at commit 26de7be8.
Syntax
declare function pack4x8unorm(a0: vec4): u32declare function pack4x8unorm(e: vec4): u32Parameters
-
evec4
Return value
Description
Hand-inlined on GLSL ES 3.00, which has no packUnorm4x8 (that is ES 3.10).
Targets
- WGSL
-
pack4x8unorm(a) - GLSL ES 3.00
-
(uint(floor(0.5 + clamp(a.x, 0.0, 1.0) * 255.0)) | (uint(floor(0.5 + clamp(a.y, 0.0, 1.0) * 255.0)) << 8) | (uint(floor(0.5 + clamp(a.z, 0.0, 1.0) * 255.0)) << 16) | (uint(floor(0.5 + clamp(a.w, 0.0, 1.0) * 255.0)) << 24))