pack4x8snorm
On this page

pack4x8snorm

Function

Packs a vec4 of values in [-1, 1] into the four bytes of a u32 as signed bytes, 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 pack4x8snorm(a0: vec4): u32
declare function pack4x8snorm(e: vec4): u32

Parameters

Return value

u32

Description

Hand-inlined on GLSL ES 3.00, which has no packSnorm4x8 (that is ES 3.10).

Targets

WGSL
pack4x8snorm(a)
GLSL ES 3.00
(uint(int(floor(0.5 + clamp(a.x, -1.0, 1.0) * 127.0)) & 0xFF) | (uint(int(floor(0.5 + clamp(a.y, -1.0, 1.0) * 127.0)) & 0xFF) << 8) | (uint(int(floor(0.5 + clamp(a.z, -1.0, 1.0) * 127.0)) & 0xFF) << 16) | (uint(int(floor(0.5 + clamp(a.w, -1.0, 1.0) * 127.0)) & 0xFF) << 24))

Examples

See also

Edit this page Report a problem