u32
이 페이지에서

u32()

함수, 값 분류

A u32 literal node.

import { u32 } from 'typeshade'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

function u32(v: number): Node<'u32'>;
function u32(x: ReadonlyNode<ScalarCastSource>): Node<'u32'>;

매개변수

v number

반환값

Node<'u32'>

예외

TypeError

v is neither a JS number nor a scalar node.

SD0116

SD0116 when the node operand is not a scalar.

설명

Use it over the f32 default wherever WGSL demands an unsigned scalar: buffer strides, vertex and instance indices, bit-flag masks used with .bitAnd and .bitOr.

A Node argument is a cast instead: u32(x) converts, the free-function twin of x.u32(). It builds what toU32 builds, and its operand is bounded to a scalar.

예제

예제

import { u32 } from 'typeshade'
const flags = u32(4) // Node<'u32'>

대상별 지원

대상지원비고
WGSL (WebGPU) 지원

u32(a).

GLSL ES 3.00 (WebGL2) 지원

uint(a).

CPU 오라클 지원

Evaluated in f64 by the oracle.

관련 가이드

함께 보기

소스

src/core/ir/node.ts, 1019행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고