WgslBuiltinName
타입, 레이아웃 분류
Every @builtin(<name>) id WGSL defines.
import type { WgslBuiltinName } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
type WgslBuiltinName = | 'vertex_index' | 'instance_index' | 'position' | 'front_facing' | 'frag_depth' | 'sample_index' | 'sample_mask' | 'primitive_index' | 'local_invocation_id' | 'local_invocation_index' | 'global_invocation_id' | 'workgroup_id' | 'num_workgroups' | 'subgroup_invocation_id' | 'subgroup_size' | 'clip_distances';설명
The builtin vocabulary is WGSL’s, and each
backend spells the id for its target: a fragment-input position reads as gl_FragCoord
on GLSL. builtin takes its name from this union, so a misspelled name or a GLSL
spelling ('vertex_idx', 'frag_coord', 'point_size') is a tsc error at the
authoring line. Ids that need a feature (subgroup_*, clip_distances, primitive_index)
and ids with no GLSL mapping (sample_index, the compute family on WebGL2) are included:
the type says which names are WGSL builtins, and whether a target supports one is checked
at emit — an id behind an extension derives its enable and its host feature from use
(§50), so naming one here is not a claim that every adapter has it.
global_invocation_index and workgroup_index are deliberately not here. Both are in the
WGSL text, and neither is in the builtin vocabulary the Tint the compile gate runs accepts:
a module naming one dies with expected builtin value name at createShaderModule
(measured 2026-09-21), so admitting them would only move the failure further from the
author.
관련 가이드
함께 보기
소스
src/core/sot.ts, 131행, 커밋 c66579bf 기준