Pack
On this page

Pack

Interface in Reflection

The serialisable result of buildManifest: see there.

import type { Pack } from 'typeshade'
import type { Pack } from 'typeshade/runtime'

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

Syntax

interface Pack<E extends PackBindings = PackBindings> {
readonly schema: typeof PACK_SCHEMA;
readonly compiler: string;
readonly emit?: { readonly level?: 'O0' | 'O1' | 'O2'; readonly parens?: 'full' | 'minimal'; readonly fp64Flavor?: 'float' | 'integer'; };
readonly wgsl: string;
readonly glsl?: { readonly vertex: string; readonly fragment: string };
readonly bindings: readonly PackBinding[];
readonly vertexLayout?: GpuVertexLayout;
readonly entries: readonly PackEntry[];
readonly structs: readonly { readonly name: string; readonly emitted: string; readonly fields: readonly { name: string; emitted: string; type: string }[]; }[];
readonly overrides: readonly PackOverride[];
readonly features: readonly string[];
readonly console?: PackConsole;
readonly variants?: { readonly console?: PackConsole };
readonly ir?: PortableIr;
readonly gl?: { /** Each vertex entry's vertex program on WebGL2 (change 0054), or why it has none. */ readonly vertices?: Readonly<Record<string, PackGlVertex | { readonly none: string }>>; /** Each fragment entry's fragment program on WebGL2, or why it has none: a render * pipeline links it with a vertex entry's, and a full-screen draw with the tier's own. */ readonly draws?: Readonly<Record<string, PackGlDraw | { readonly none: string }>>; /** Each compute entry's pass program on WebGL2 (change 0054), or why it has none. */ readonly computes?: Readonly<Record<string, PackGlCompute | { readonly none: string }>>; };
readonly [entryBindings]?: E;
}

Description

E is the bindings each entry reaches (change 0030). The host view of a module types its default export with them, and the program runtime carries them to each draw and dispatch. A manifest read from JSON, or built at run time, is Pack with no argument, which takes any bindings. Nothing at run time holds E.

Instance properties

schemaread only typeof PACK_SCHEMA

The manifest’s schema, which a reader checks first (Rule 11.10).

compilerread only string

The package version that wrote it.

emitoptionalread only { readonly level?: 'O0' | 'O1' | 'O2'; readonly parens?: 'full' | 'minimal'; readonly fp64Flavor?: 'float' | 'integer'; }

The options the program was emitted under, when the build gave any of the three a manifest can record (packModule(m, { emit }), its plugins apart, which it cannot): the optimization level, the parens and the fp64Flavor. Each option the build did not provide is absent and uses its default ('O2', 'full' and 'float'), and a manifest built with none has no emit. The load-time emitter emits the program again under them (Rule 11.10).

wgslread only string
glsloptionalread only { readonly vertex: string; readonly fragment: string }
bindingsread only readonly PackBinding[]
vertexLayoutoptionalread only GpuVertexLayout

The first vertex entry’s vertex buffer, as entries[].vertex gives each.

entriesread only readonly PackEntry[]
structsread only readonly { readonly name: string; readonly emitted: string; readonly fields: readonly { name: string; emitted: string; type: string }[]; }[]
overridesread only readonly PackOverride[]
featuresread only readonly string[]

The GPUFeatureNames a device must have to create the program’s pipelines.

consoleoptionalread only PackConsole

Recorded variant enabled by default. Retained for legacy recorded builds.

variantsoptionalread only { readonly console?: PackConsole }

Available variants, selected explicitly at load time. Their presence enables nothing.

iroptionalread only PortableIr

The program as portable IR, when the build asked for it: what repack() emits again. Only the package version that wrote it reads it.

gloptionalread only { /** Each vertex entry's vertex program on WebGL2 (change 0054), or why it has none. */ readonly vertices?: Readonly<Record<string, PackGlVertex | { readonly none: string }>>; /** Each fragment entry's fragment program on WebGL2, or why it has none: a render * pipeline links it with a vertex entry's, and a full-screen draw with the tier's own. */ readonly draws?: Readonly<Record<string, PackGlDraw | { readonly none: string }>>; /** Each compute entry's pass program on WebGL2 (change 0054), or why it has none. */ readonly computes?: Readonly<Record<string, PackGlCompute | { readonly none: string }>>; }

What the WebGL2 tier uses: each full-screen fragment entry’s draw, or why it has none.

Source

src/core/manifest-types.ts, line 292, at commit af54ddad5

Edit this page Report a problem