TS8024
On this page

TS8024

Front-end code BUILTIN_NAME

@builtin("...") names an id outside WGSL's builtin vocabulary (WgslBuiltinName in core/sot.ts).

The registry text and every compiler message on these pages are the compiler's own English.

Example

example.shade.ts
"use typeshade"
@fragment
export function main(@builtin("frag_coord") p: vec4): vec4 {
return vec4(p.xy / 512., 0., 1.)
}

Compiled at build time against the pinned compiler, this program gets:

TS8024 error, line 4: Unknown builtin "frag_coord". Supported names: 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.

How to fix it

The same program, corrected. It compiles with no diagnostic.

example.shade.ts
"use typeshade"
@fragment
export function main(@builtin("position") p: vec4): vec4 {
return vec4(p.xy / 512., 0., 1.)
}

The rule this enforces

Rule 6.6 Test
An entry point’s inputs and outputs are explicit parameters and return values; every parameter and every field of an entry I/O struct must carry @builtin("...") or @location(n), and the builtin name must be one WGSL defines for that stage and direction.

See also

Source

Where the compiler raises this code at commit 26de7be8, one line per file:

Edit this page Report a problem