---
title: "Frame: interface in Runtime, TypeShade API reference"
description: "Frame, an interface in Runtime. One command encoder's work: dispatches and render passes, submitted together."
url: https://typeshade.dev/api/frame/
language: en
---

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

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

**`encoder` read only `object`**

The `GPUCommandEncoder`, for the host’s own commands between the frame’s. Escape hatch ([Rule 11.17](https://typeshade.dev/reference/rules/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[]): void`**

Record a dispatch: `bindings` are the ones the pipeline’s entry reaches (change 0030).

**`pass` `(targets: PassTargets, record: (pass: RenderPass) => void): void`**

**`submit` `(): 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. `entry` names what the buffer recorded for (the compute entry, or the fragment entry of a draw), `lines` the number of `console.*` calls it kept, each printed or handed to the sink, and `dropped` the calls that had no room in `consoleBytes`. 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](https://github.com/typeshade/typeshade/blob/af54ddad5/src/runtime/runtime.ts#L191), at commit af54ddad5
