---
title: "Runtime: interface in Runtime, TypeShade API reference"
description: "Runtime, an interface in Runtime. The program runtime: a device, and everything a program needs on it."
url: https://typeshade.dev/api/runtime-interface/
language: en
---

# `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

```ts
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

**`info` read only `DeviceInfo`**

Frozen 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.

**`device` read only `D`**

The `GPUDevice` or the `WebGL2RenderingContext`: the host’s, or the one the runtime requested or made. Escape hatch ([Rule 11.17](https://typeshade.dev/reference/rules/11-17/)): the device itself, for the host’s own calls on it.

**`tier` read only `RuntimeTier`**

The tier the runtime runs on: `'webgpu'`, or `'webgl2'`, where a dispatch runs as the pass program the manifest carries (`Pack.gl.computes`, change 0054).

**`limits` read only `Readonly<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): Texture`**

**`sampler` `(options?: SamplerOptions | object): Sampler`**

**`frame` `(): Frame`**

**`submit` `(...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](https://typeshade.dev/reference/rules/11-17/)): the host’s own `GPUCommandEncoder`s, which this submits; a WebGL2 runtime rejects.

**`destroy` `(): void`**

Release what the runtime made. The host’s device is left as it is.

## Source

[`src/runtime/runtime.ts`, line 226](https://github.com/typeshade/typeshade/blob/af54ddad5/src/runtime/runtime.ts#L226), at commit af54ddad5
