RenderState
Interface in Runtime
The fixed-function state of a render pipeline, which the host writes: the compiler knows its entries' inputs and outputs, and the runtime fills and checks those.
import type { RenderState } from 'typeshade/runtime'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
interface RenderState { readonly vertex?: string; readonly fragment?: string | null; readonly targets?: readonly TargetState[]; readonly depth?: { readonly format: string; readonly compare?: string; readonly write?: boolean; }; readonly primitive?: { readonly topology?: string; readonly cullMode?: 'none' | 'front' | 'back'; readonly frontFace?: 'ccw' | 'cw'; }; readonly multisample?: { readonly count?: number }; readonly constants?: Constants;}Instance properties
vertexoptionalread onlystringThe vertex entry; the program’s only one when omitted.
fragmentoptionalread onlystring | nullThe fragment entry; the program’s only one when omitted, none for a depth-only pass.
targetsoptionalread onlyreadonly TargetState[]One per colour output, by location. Omitted:
rgba8unormfor each.depthoptionalread only{ readonly format: string; readonly compare?: string; readonly write?: boolean; }The depth attachment’s format, and how the pipeline tests and writes it:
comparedefaults to'less'andwritetotrue. A reversed projection compares'greater', and a pass drawn behind everything else (a sky) compares'always'and does not write. Omitted: no depth test, for a pass with no depth attachment.primitiveoptionalread only{ readonly topology?: string; readonly cullMode?: 'none' | 'front' | 'back'; readonly frontFace?: 'ccw' | 'cw'; }What the vertices make:
topologydefaults to'triangle-list',cullModeto'none'andfrontFaceto'ccw'.multisampleoptionalread only{ readonly count?: number }The sample count of the targets it draws into: 1 when omitted, 4 for a multisampled target.
constantsoptionalread onlyConstantsThe values of the program’s overrides (surface §15), by the names the source declares:
{ quality: 3 }. The vertex and the fragment stage are each created with them, as WebGPU’sconstants. An override the record leaves out takes the default its declaration states, so omitted, every override does. Anf32takes a finite number no larger than 3.4028234663852886e38 in magnitude, ani32or au32a whole number in its range, and aboola boolean or a number, where 0 is false. A name the program does not declare is aTypeErrorthat names the program’s overrides, and a value its type cannot hold one that says what the type takes. Two states that differ in an override are two pipelines, and the same values give the same pipeline back.
Source
src/runtime/program.ts, line 64, at commit 26de7be8