pack2x16unorm
On this page

pack2x16unorm()

Function in Builtins

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

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

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

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

Syntax

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

Parameters

v ReadonlyNode<'vec2<f32>'>

Return value

Node<'u32'>

Description

The 16-bit step up from the 8-bit channels of pack4x8unorm. Spelled packUnorm2x16 on GLSL ES 3.00.

Targets

TargetSupportNotes
WGSL (WebGPU) Supported

pack2x16unorm(v).

GLSL ES 3.00 (WebGL2) Supported

packUnorm2x16(v).

CPU oracle Supported

Evaluated in f64 by the oracle.

See also

Source

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

Edit this page Report a problem