pack2x16float()
함수, 내장 함수 분류
Pack a vec2<f32> into a u32 as two IEEE-754 binary16 (half) values, component 0 in the 16 low bits.
import { pack2x16float } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
const pack2x16float: (v: ReadonlyNode<"vec2<f32>">) => Node<"u32">매개변수
vReadonlyNode<'vec2<f32>'>
반환값
Node<'u32'>
설명
Native on both targets (WGSL pack2x16float, GLSL ES 3.00 packHalf2x16);
a value outside binary16’s finite range (|x| > 65504) overflows to ±∞ per IEEE conversion. A compact carrier for a pair where 8-bit unorm quantisation is too coarse and two full f32
components are too wide; unpack2x16float restores the rounded pair.
예제
예제
import { fn, pack2x16float, vec2fT } from 'typeshade'
const packed = fn('packed', { hv: vec2fT }, ({ hv }) => pack2x16float(hv))대상별 지원
| 대상 | 지원 | 비고 |
|---|---|---|
| WGSL (WebGPU) | 지원 |
|
| GLSL ES 3.00 (WebGL2) | 지원 |
|
| CPU 오라클 | 지원 | Evaluated in f64 by the oracle. |
함께 보기
소스
src/core/ir/node.ts, 1894행, 커밋 c66579bf 기준