TS8051
Front-end code LAYOUT
A buffer binding's store type that breaks one of WGSL's host-shareable rules: a bool, alone or in a vector, in a uniform or storage binding; a runtime-sized array<T> that is not the last member of its struct; a runtime-sized array in a uniform; or a two-row matrix (mat2x2, mat3x2, mat4x2) in a uniform, which WGSL and std140 lay out at different offsets (Rule 4.8).
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
"use typeshade"
class Uniforms { on: bool gain: f32}
declare const u: uniform<Uniforms>
@fragmentexport function main(uv: location<0, vec2>): vec4 { return vec4(uv * u.gain, 0., 1.)}Compiled at build time against the pinned compiler, this program gets:
TS8051 error, line 8: "Uniforms.on" is a bool; a uniform struct holds numeric scalars only (WGSL's host-shareable rule). Use u32.
How to fix it
The same program, corrected. It compiles with no diagnostic.
"use typeshade"
class Uniforms { on: u32 gain: f32}
declare const u: uniform<Uniforms>
@fragmentexport function main(uv: location<0, vec2>): vec4 { return vec4(uv * u.gain, 0., 1.)}The rules this enforces
- Rule 4.8 Test
- Every
matCxRwithCandRin 2, 3, 4 must be a type, and a square one must also answer tomatN. - 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 and numbered in that order where nolocation<n, T>states the number (Rule 6.6), whichreflect().vertexand the manifest both report.
See also
Source
Where the compiler raises this code at commit af54ddad5, one line per file: