Program
Interface in Runtime
A program loaded on a runtime: its manifest and its pipelines.
import type { Program } from 'typeshade/runtime'
The signature, the description and the examples come from the compiler's own source at commit af54ddad5.
Syntax
interface Program<E extends PackBindings = PackBindings> { readonly manifest: Pack<E>; readonly recording: boolean; compute<K extends keyof E & string = keyof E & string>( entry?: K, options?: { readonly constants?: Constants }, ): Promise<ComputePipeline<E[K]>>; render<const S extends RenderState & EntryNames<E> = Record<never, never>>( state?: S, ): Promise<RenderPipeline<RenderBindings<E, S>>>;}Description
E is the bindings each entry
reaches, from the manifest’s type (change 0030); an untyped manifest takes any.
Instance properties
manifestread onlyPack<E>recordingread onlybooleanWhether its entries record their
console.*calls.
Instance methods
compute<K extends keyof E & string = keyof E & string>(entry?: K, options?: { readonly constants?: Constants }): Promise<ComputePipeline<E[K]>>The pipeline of a
@computeentry, cached: the program’s only one whenentryis omitted.options.constantssets the program’s overrides for this pipeline, asRenderState.constantsdoes for a render pipeline (an override it leaves out takes its declared default), and two sets of values are two pipelines. The pipeline’s dispatches take the bindings the entry reaches.render<const S extends RenderState & EntryNames<E> = Record<never, never>>(state?: S): Promise<RenderPipeline<RenderBindings<E, S>>>The pipeline of a vertex entry and a fragment entry under
state, cached.statedefaults to{}: the program’s only vertex and fragment entry, and every other field at its default. The pipeline’s draws take the bindings its two entries reach. A draw sets the pipeline’sblendConstantwhen it declares one. Before a draw whose pipeline declares none, and that follows a draw that did, the runtime sets the pass value again. A draw of a pipeline withdepth.stencilsets itsdepth.stencil.referencewhen it declares one, and the pass value ofsetStencilReferenceotherwise. A draw of a pipeline withoutdepth.stencilsets no reference. Two states that differ only inblendConstantor indepth.stencil.referencegive two pipelines over one GPU pipeline.
Source
src/runtime/program.ts, line 398, at commit af54ddad5