Reflection

Reflection

26 members

What reflect() recovers from a module: bind groups, byte layouts and entry points.

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

BindEntry Interface
One resource slot in a reflected bind group: the shape of a single WGSL @group(G) @binding(B) var<space> name: T declaration, or of the sampler uniform or std140 block the GLSL ES 3.00 backend emits for it.
BindGroup Interface
The bind entries of one WGSL @group(N), sorted by binding.
EntryInfo Interface
One @vertex, @fragment or @compute entry point: its stage, its parameter and return types as DSL type keys (the strings typeKey returns), and, for a @compute entry only, its workgroup size, which defaults to 64 when the entry declares none, matching the WGSL backend's own default.
EntryIo Interface
One entry point's @location and @builtin interface: the shape a host validates a vertex/fragment pair against, builds a GPUVertexState from, or diffs as a pipeline contract.
EntryIoField Interface
One field of an entry point's stage interface: a @location(n) varying, vertex attribute or fragment draw buffer, or a @builtin(name) slot.
EntryReach Interface
What a set of entry points transitively reaches, as returned by reachFrom.
ExternRequirement Interface
One host-provided global a module expects, declared with externVar.
FieldLayout Interface
One struct field's byte layout: its name, its DSL type key (the string typeKey returns), and its offset, align and size in bytes under the LayoutKind the enclosing StructLayout was computed with.
LayoutKind Type
The byte-layout rule a struct's fields are placed under.
OverrideInfo Interface
A pipeline specialization constant the host supplies when it creates a pipeline.
Pack Interface
The serialisable result of buildManifest: see there.
PackBinding Interface
One resource slot. name, space, group, binding, access and type are the fields packModule() has always given; the rest came with schema 1.
PackEntry Interface
A shader entry point. name and stage are the fields packModule() has always given.
packJson Function
packModule already stringified, pretty-printed at two spaces, the form a build step writes to disk or embeds in a generated module.
packModule Function
The compiled module's manifest: everything a host needs to create its pipelines and bind its resources, in one plain JSON object.
PackOptions Interface
Everything packModule() adds on request.
reachFrom Function
Walk the call graph from entries and collect what they reach.
reflect Function
Recover a module's pipeline metadata from its IR.
Reflection Interface
The target-neutral pipeline metadata reflect recovers from a module: bind-group layout, every bound struct's byte layout, the vertex-attribute layout if any (vertex), every entry point's signature (entries), specialization constants (overrides), the capabilities a host must activate before pipeline creation, and the host-provided globals the module expects (requires).
ReflectOptions Interface
Options for reflect.
ResourceKind Type
What a bind entry is at the host API, independent of the WGSL address space or type that declared it.
StructLayout Interface
A struct's complete byte layout: its total size and align plus one FieldLayout per field, in declaration order.
typeLayout Function
Size + alignment (bytes) of a host-shareable type under a layout.
VertexAttr Interface
One @location-attributed parameter of the module's @vertex entry point.
VertexLayout Interface
The vertex-buffer layout for a module's @vertex entry: every @location input and the interleaved, tightly packed arrayStride they fill.
wgslLayout Function
Compute the byte layout of one struct under a LayoutKind: each field's offset, alignment and size, plus the struct's total size and alignment.

Edit this page Report a problem