TS8028
On this page

TS8028

Front-end code ATTRIBUTE_NAME

A decorator or an entry form that this surface does not read: an identifier outside the attribute vocabulary (@vertex, @fragment, @compute, @builtin, @location), such as a misspelled @vertx; a WGSL attribute that the surface writes another way or does not borrow, such as a written @diagnostic(…); a stage written as a call, such as vertex(f); an entry that is written in a form that Rule 8.1 refuses, such as export default; or a decorator on a declaration or in a place that takes none (Rule 6.7). Without this code the decorated function or field would silently stop being an entry point or an I/O field.

The registry has no documentation comment for this constant, so the line above is written by this site from the messages the compiler raises it with.

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

Example

example.shade.ts
"use typeshade"
export const main = fragment(function main(uv: location<0, vec2>): vec4 {
return vec4(uv, 0., 1.)
});

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

TS8028 error, line 3: a stage is an attribute on the function declaration: write "@fragment export function main(…)", or run "tshc migrate" (change 0130)

How to fix it

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

example.shade.ts
"use typeshade"
@fragment
export function main(uv: location<0, vec2>): vec4 {
return vec4(uv, 0., 1.)
}

The rules this enforces

Rule 1.4 Test
Where ECMAScript has a form that carries the GPU meaning, the surface must borrow TypeScript’s spelling; a WGSL spelling is borrowed only where no ECMAScript spelling carries the meaning, and the borrowing must keep every WGSL capability reachable (Rule 11.14).
Rule 1.8 Test
A construct of the language is written in the language’s own syntax: the directive, a type of the surface, or an attribute @name or @name(…) on the declaration it marks.
Rule 6.6 Test
An entry point’s inputs and outputs are explicit parameters and return values.
Rule 6.7 Test
The attribute names the compiler reads are vertex, fragment, compute, workgroup_size, builtin, location, interpolate, invariant and blend_src (the last three since #168, surface §53).
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 @location inputs tightly packed in the order written and numbered in that order where no location<n, T> states the number (Rule 6.6), which reflect().vertex and the manifest both report.
Rule 8.1 Test
An entry point is a function declaration at the top of the file or of a namespace, exported or not, with exactly one stage attribute written before the declaration: @vertex export function vs(…), @fragment …, or @compute([x, y?, z?]) ….
Rule 8.5 Test
A collective operation (a derivative, an implicit-LOD texture sample, a barrier) must be in uniform control flow.
Rule 8.22 Test
A kernel function is an exported function that is not an entry point, a function declaration, and takes at least one array with no size (array<T>) or one 2D storage texture (texture_storage_2d<F, A>, change 0077), or returns an array with no size that its body makes (Rule 8.23, change 0114, S5); a sampled texture alone does not make one, so an exported helper that reads one stays a helper an entry calls; its candidate loops are the for and for…of statements at the top level of its body, and no other loop is ever a candidate.
Rule 8.25 Test
An object parameter that its function writes is the caller’s object, and the call passes the variable itself, unmarked: reading the parameter reads that object, and assigning to a field or an element of it writes it, for the call (change 0142).

See also

Source

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

Edit this page Report a problem