Runtime
Interface in Runtime
The program runtime: a device, and everything a program needs on it.
import type { Runtime } from 'typeshade/runtime'
The signature, the description and the examples come from the compiler's own source at commit af54ddad5.
Syntax
interface Runtime<D extends object = object> { readonly info: DeviceInfo; readonly device: D; readonly tier: RuntimeTier; readonly limits: Readonly<Record<string, number>>; load<E extends PackBindings>(program: Pack<E>, options?: LoadOptions): Program<E>; texture(options: TextureOptions | object): Texture; sampler(options?: SamplerOptions | object): Sampler; frame(): Frame; submit(...encoders: readonly object[]): ReturnType<Frame['submit']>; destroy(): void;}Instance properties
inforead onlyDeviceInfoFrozen historical metadata of this runtime’s actual device or context (change 0083). Readable after destruction or device loss; it makes no claim of current availability.
deviceread onlyDThe
GPUDeviceor theWebGL2RenderingContext: the host’s, or the one the runtime requested or made. Escape hatch (Rule 11.17): the device itself, for the host’s own calls on it.tierread onlyRuntimeTierThe tier the runtime runs on:
'webgpu', or'webgl2', where a dispatch runs as the pass program the manifest carries (Pack.gl.computes, change 0054).limitsread onlyReadonly<Record<string, number>>The device’s WebGPU limits, by their names in
GPUSupportedLimits, copied when the runtime was made (change 0051). Frozen. Empty on the WebGL2 tier, which has no WebGPU limits.
Instance methods
load<E extends PackBindings>(program: Pack<E>, options?: LoadOptions): Program<E>Load a program from its manifest. A typed manifest, a module’s default export, types the program’s draws and dispatches with the bindings each entry reaches (change 0030).
texture(options: TextureOptions | object): Texturesampler(options?: SamplerOptions | object): Samplerframe(): Framesubmit(...encoders: readonly object[]): ReturnType<Frame['submit']>Submit the host’s own encoders, after copying back the console buffers of the dispatches and draws recorded since the last submit; resolves once the lines are delivered, to what those buffers held, as
Frame.submit()does: the queue is given the encoders before the promise is returned. Escape hatch (Rule 11.17): the host’s ownGPUCommandEncoders, which this submits; a WebGL2 runtime rejects.destroy(): voidRelease what the runtime made. The host’s device is left as it is.
Source
src/runtime/runtime.ts, line 226, at commit af54ddad5