WgslBuiltinName
On this page

WgslBuiltinName

Type in Layout

Every @builtin(<name>) id WGSL defines.

import type { WgslBuiltinName } from 'typeshade'

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

Syntax

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';

Description

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.

In the guide

See also

Source

src/core/sot.ts, line 131, at commit 26de7be8

Edit this page Report a problem