Frame
Interface in Runtime
One command encoder's work: dispatches and render passes, submitted together.
import type { Frame } from 'typeshade/runtime'
The signature, the description and the examples come from the compiler's own source at commit af54ddad5.
Syntax
interface Frame { readonly encoder: object; dispatch<B>( pipeline: ComputePipeline<B>, bindings: NoInfer<B>, workgroups: number | readonly number[], ): void; pass(targets: PassTargets, record: (pass: RenderPass) => void): void; submit(): Promise<{ readonly console: readonly { readonly entry: string; readonly lines: number; readonly dropped: number; }[]; }>;}Instance properties
encoderread onlyobjectThe
GPUCommandEncoder, for the host’s own commands between the frame’s. Escape hatch (Rule 11.17): the encoder itself, for the host’s WebGPU calls (WebGL2 throws).
Instance methods
dispatch<B>(pipeline: ComputePipeline<B>, bindings: NoInfer<B>, workgroups: number | readonly number[]): voidRecord a dispatch:
bindingsare the ones the pipeline’s entry reaches (change 0030).pass(targets: PassTargets, record: (pass: RenderPass) => void): voidsubmit(): Promise<{ readonly console: readonly { readonly entry: string; readonly lines: number; readonly dropped: number; }[]; }>Submit the frame. The queue is given its commands before
submit()returns its promise, so a texture read started right after it, while the promise is pending, reads the frame (Texture.read). It resolves with the result below once the queue has run the frame and the console output from its entries has been delivered, printed or handed to the runtime’s sink:{ console: [{ entry, lines, dropped }, …] }, a row for each dispatch and draw of the frame that recorded, in the order they were recorded, and none when nothing did.entrynames what the buffer recorded for (the compute entry, or the fragment entry of a draw),linesthe number ofconsole.*calls it kept, each printed or handed to the sink, anddroppedthe calls that had no room inconsoleBytes. A runtime that prints warns of the dropped calls; one given a sink prints nothing, so its host reads the count here. It rejects with the validation error the frame raised, if any.
Source
src/runtime/runtime.ts, line 191, at commit af54ddad5