---
title: "Program: interface in Runtime, TypeShade API reference"
description: "Program, an interface in Runtime. A program loaded on a runtime: its manifest and its pipelines."
url: https://typeshade.dev/api/program/
language: en
---

# `Program`

Interface in Runtime

A program loaded on a runtime: its manifest and its pipelines.

`import type { Program } from 'typeshade/runtime'`

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

## Syntax

```ts
interface Program<E extends PackBindings = PackBindings> {
  readonly manifest: Pack<E>;
  readonly recording: boolean;
  compute<K extends keyof E & string = keyof E & string>( entry?: K, options?: { readonly constants?: Constants }, ): Promise<ComputePipeline<E[K]>>;
  render<const S extends RenderState & EntryNames<E> = Record<never, never>>( state?: S, ): Promise<RenderPipeline<RenderBindings<E, S>>>;
}
```

## Description

`E` is the bindings each entry reaches, from the manifest’s type (change 0030); an untyped manifest takes any.

## Instance properties

**`manifest` read only `Pack<E>`**

**`recording` read only `boolean`**

Whether its entries record their `console.*` calls.

## Instance methods

**`compute` `<K extends keyof E & string = keyof E & string>(entry?: K, options?: { readonly constants?: Constants }): Promise<ComputePipeline<E[K]>>`**

The pipeline of a `@compute` entry, cached: the program’s only one when `entry` is omitted. `options.constants` sets the program’s overrides for this pipeline, as `RenderState.constants` does for a render pipeline (an override it leaves out takes its declared default), and two sets of values are two pipelines. The pipeline’s dispatches take the bindings the entry reaches.

**`render` `<const S extends RenderState & EntryNames<E> = Record<never, never>>(state?: S): Promise<RenderPipeline<RenderBindings<E, S>>>`**

The pipeline of a vertex entry and a fragment entry under `state`, cached. `state` defaults to `{}`: the program’s only vertex and fragment entry, and every other field at its default. The pipeline’s draws take the bindings its two entries reach. A draw sets the pipeline’s `blendConstant` when it declares one. Before a draw whose pipeline declares none, and that follows a draw that did, the runtime sets the pass value again. A draw of a pipeline with `depth.stencil` sets its `depth.stencil.reference` when it declares one, and the pass value of `setStencilReference` otherwise. A draw of a pipeline without `depth.stencil` sets no reference. Two states that differ only in `blendConstant` or in `depth.stencil.reference` give two pipelines over one GPU pipeline.

## Source

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