pack2x16snorm
On this page

pack2x16snorm()

Function in Builtins

Pack a vec2<f32> into a u32 as two 16-bit snorm values, ⌊0.5 + 32767·clamp(x, -1, 1)⌋ per component in two's complement, component 0 in the 16 low bits.

import { pack2x16snorm } from 'typeshade/core/ir'

This export returns an IR node. A "use typeshade" file calls the builtin itself: pack2x16snorm()

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

Syntax

const pack2x16snorm: (v: ReadonlyNode<"vec2<f32>">) => Node<"u32">

Parameters

v ReadonlyNode<'vec2<f32>'>

Return value

Node<'u32'>

Description

Suited to signed normals and direction fields. Spelled packSnorm2x16 on GLSL ES 3.00.

Targets

TargetSupportNotes
WGSL (WebGPU) Supported

pack2x16snorm(v).

GLSL ES 3.00 (WebGL2) Supported

packSnorm2x16(v).

CPU oracle Supported

Evaluated in f64 by the oracle.

See also

Source

src/core/ir/node.ts, line 1672, at commit af54ddad5

Edit this page Report a problem