---
title: "Reflection, a category in the TypeShade API reference"
description: "Reflection in the TypeShade API reference. What reflect() recovers from a module: bind groups, byte layouts and entry points."
url: https://typeshade.dev/api/reflection-api/
language: en
---

# Reflection

27 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 af54ddad5.

**[`BindEntry`](https://typeshade.dev/api/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`](https://typeshade.dev/api/bindgroup/) Interface**

The bind entries of one WGSL @group(N), sorted by binding.

**[`EntryInfo`](https://typeshade.dev/api/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`](https://typeshade.dev/api/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`](https://typeshade.dev/api/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`](https://typeshade.dev/api/entryreach/) Interface**

What a set of entry points transitively reaches, as returned by reachFrom.

**[`ExternRequirement`](https://typeshade.dev/api/externrequirement/) Interface**

One host-provided global a module expects, declared with externVar.

**[`FieldLayout`](https://typeshade.dev/api/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`](https://typeshade.dev/api/layoutkind/) Type**

The byte-layout rule a struct's fields are placed under.

**[`OverrideInfo`](https://typeshade.dev/api/overrideinfo/) Interface**

A pipeline specialization constant the host supplies when it creates a pipeline.

**[`Pack`](https://typeshade.dev/api/pack/) Interface**

The serialisable result of buildManifest: see there.

**[`PackBinding`](https://typeshade.dev/api/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`](https://typeshade.dev/api/packentry/) Interface**

A shader entry point. name and stage are the fields packModule() has always given.

**[`PackGlCompute`](https://typeshade.dev/api/packglcompute/) Interface**

A compute entry as the WebGL2 executor runs it: its pass program, a vertex stage whose records transform feedback captures, and what the executor needs to run it.

**[`packJson`](https://typeshade.dev/api/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`](https://typeshade.dev/api/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`](https://typeshade.dev/api/packoptions/) Interface**

Everything packModule() adds on request.

**[`reachFrom`](https://typeshade.dev/api/reachfrom/) Function**

Walk the call graph from entries and collect what they reach.

**[`reflect`](https://typeshade.dev/api/reflect/) Function**

Recover a module's pipeline metadata from its IR.

**[`Reflection`](https://typeshade.dev/api/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`](https://typeshade.dev/api/reflectoptions/) Interface**

Options for reflect.

**[`ResourceKind`](https://typeshade.dev/api/resourcekind/) Type**

What a bind entry is at the host API, independent of the WGSL address space or type that declared it.

**[`StructLayout`](https://typeshade.dev/api/structlayout/) Interface**

A struct's complete byte layout: its total size and align plus one FieldLayout per field, in declaration order.

**[`typeLayout`](https://typeshade.dev/api/typelayout/) Function**

Size + alignment (bytes) of a host-shareable type under a layout.

**[`VertexAttr`](https://typeshade.dev/api/vertexattr/) Interface**

One `@location` input of the module's `@vertex` entry point, from a loose parameter or a located struct field.

**[`VertexLayout`](https://typeshade.dev/api/vertexlayout/) Interface**

The vertex-buffer layout for a module's `@vertex` entry: every `@location` input and the interleaved, tightly packed arrayStride they fill.

**[`wgslLayout`](https://typeshade.dev/api/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.
