TS8033
On this page

TS8033

Front-end code MODULE_VAR

A module variable declared or used where its address space forbids it: a const with an address-space wrapper, a workgroup variable with an initializer, a type that the space cannot hold (a texture, a runtime-sized array, an atomic in a per-invocation variable), an initializer that is not a constant, or a workgroup variable reached from a vertex or fragment entry. Also the retired perInvocation<T> wrapper, which a plain top-level let replaced.

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"
let tile: workgroup<array<f32, 64>>
@fragment
export function main(uv: location<0, vec2>): vec4 {
return vec4(uv, tile[0], 1.)
}

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

TS8033 error, line 7: "tile" is workgroup memory, which only a compute entry has; a fragment entry cannot read or write it.

How to fix it

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

example.shade.ts
"use typeshade"
let tile: array<f32, 64>
@fragment
export function main(uv: location<0, vec2>): vec4 {
return vec4(uv, tile[0], 1.)
}

The rules this enforces

Rule 6.1 Test
A resource must be written declare const x: uniform<T>, declare const x: storage<T>, declare const x: storage<T, "read_write">, or declare const x: <texture or sampler type>.
Rule 6.5 Test
A top-level let is a module variable in the per-invocation (private) address space; workgroup memory must be written let x: workgroup<T>; a module variable must take no declare.
Rule 8.3 Test
A builtin WGSL confines by stage may be used in an entry of a permitted stage, and in a helper that no entry of an excluded stage can reach.

See also

Source

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

Edit this page Report a problem