TS8028
Front-end code ATTRIBUTE_NAME
A decorator identifier outside the attribute vocabulary "use typeshade" defines (@vertex, @fragment, @compute, @builtin, @location), e.g. a misspelled @vertx: without this, the decorated function or field just silently stops being an entry point or an I/O field.
The registry text and every compiler message on these pages are the compiler's own English.
When it fires
A decorator identifier outside the attribute vocabulary "use typeshade" defines (@vertex, @fragment, @compute, @builtin, @location), e.g. a misspelled @vertx: without this, the decorated function or field just silently stops being an entry point or an I/O field. A WGSL attribute the surface writes another way (@workgroup_size, @size, @group, @binding, @id, @must_use) is named as WGSL's, with where its intent goes; @size anywhere but a field and @align anywhere but a field or a class are named as a struct field's, and @std140 anywhere but a class as not applied; and any decorator nothing reads is refused (Rule 6.7): on a declaration that takes none (a binding, an override, a const or let at any depth, an enum, an interface, a type alias, a namespace, a local function or class, a class expression or a static field), on a constructor, an overload signature, an abstract member, a mixin or an index signature, one that is not a name (@N.k), and one of the list where the place does not apply it (@location on a class, @builtin on a parameter of a function that is not an entry, which Tint refuses).
Example
"use typeshade"
@fragmntexport function main(@location(0) uv: vec2): vec4 { return vec4(uv, 0., 1.)}Compiled at build time against the pinned compiler, this program gets:
TS8028 error, line 3: Unknown attribute "@fragmnt". Did you mean "@fragment"?
TS8028 error, line 4: "@location" does not apply to a parameter of a function that is not an entry: it marks an entry's input or output. Remove it.
How to fix it
The same program, corrected. It compiles with no diagnostic.
"use typeshade"
@fragmentexport function main(@location(0) uv: vec2): vec4 { return vec4(uv, 0., 1.)}The rules this enforces
- Rule 6.7 Test
- The attribute names the compiler reads are
@vertex,@fragment,@compute,@builtin,@location,@interpolate,@invariant,@blend_src, and@diagnostic(the last four since #168, surface §53 and §54); every other WGSL attribute is either inferred by the compiler or carried as an argument (@compute([64, 1, 1])carries@workgroup_size), and a decorator outside that list must be refused. - Rule 6.8 Test
- The byte layout the emitted module assumes for a resource and the layout
reflect()reports must agree byte for byte, under WGSL’s uniform and storage layout rules, and so must the layout the manifest carries (Rule 11.10); a vertex entry’s vertex buffer is one layout, its@locationinputs tightly packed in the order written, whichreflect().vertexand the manifest both report.
See also
Source
Where the compiler raises this code at commit 26de7be8, one line per file: