configure
On this page

configure()

Function in Runtime

Set how a kernel call or a @compute entry's call runs (Rule 11.8).

import { configure } from 'typeshade'
import { configure } from 'typeshade/runtime'

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

Syntax

function configure(options: {
readonly prefer?: readonly Tier[];
readonly runtime?: { readonly device: object } | null;
}): void

Parameters

options { readonly prefer?: readonly Tier[]; readonly runtime?: { readonly device: object } | null; }

prefer, a non-empty list of 'webgpu', 'webgl2' and 'cpu'; runtime, a runtime or null. configure({}) restores the default order.

Return value

void

Exceptions

TypeError

TypeError for an empty list, a repeated entry or an unknown tier, and for a runtime with no device.

Description

prefer is the order of the tiers it tries: WebGPU, WebGL2 and the CPU tier, the default being all three in that order. A one-entry list makes that tier required, and a call that cannot run on it throws, naming why: configure({ prefer: ['webgpu'] }).

runtime is a program runtime (createRuntime(), change 0025) whose device every call uses, so a texture or a Resident the host made on it reaches a call; null returns to the default device. Left out, each option keeps its value.

Source

src/core/resident.ts, line 264, at commit 26de7be8

Edit this page Report a problem