TS8029
On this page

TS8029

Front-end code STRUCT_FIELD_MISSING_ATTR

A field of a struct used as an entry function's parameter or return type carries neither @builtin(...) nor @location(...): WGSL rejects an entry-IO struct member with no attribute, so this is caught at the front end instead of reaching the backend as invalid emitted WGSL.

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

Example

example.shade.ts
"use typeshade"
class FsIn {
@builtin("position") pos: vec4
uv: vec2
}
@fragment
export function main(v: FsIn): vec4 {
return vec4(v.uv, 0., 1.)
}

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

TS8029 error, line 9: Struct "FsIn" field "uv" is used as a fragment input but has neither @builtin(...) nor @location(...): WGSL requires every entry input struct member to declare one.

How to fix it

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

example.shade.ts
"use typeshade"
class FsIn {
@builtin("position") pos: vec4
@location(0) uv: vec2
}
@fragment
export function main(v: FsIn): vec4 {
return vec4(v.uv, 0., 1.)
}

The rules 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.
Rule 12.6 Test
A requirement the front end can check must be checked at the front end, in the author’s words, and not left to Tint or a driver.

See also

Source

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

Edit this page Report a problem