Renderer · interface

ComputeDefinition

Explained in Hello world.

interface ComputeDefinition
import type { ComputeDefinition } from '@driftengine/core';

Properties

NameTypeDescription
labelreadonlystringFor diagnostics, and for the label the backend gives the encoder and the pass.

Methods

initoptional

init?(device: ComputeDevice): void

Build pipelines and buffers. Called once, when the definition is registered.

ParameterTypeDescription
deviceComputeDevice

dispatch

dispatch(ctx: ComputeContext): void

Set a pipeline, set bind groups, and call dispatchWorkgroups.

ParameterTypeDescription
ctxComputeContext
More

The workgroup count is yours and does not cross the surface, exactly as a contributed pass issues its own draw calls. The count comes from data the definition owns — a light count, a cluster count — so a renderer-side (x, y, z) would be one fact in two places, and the renderer's copy would be the one nobody updated.

Allocates nothing. This is a per-frame path and the house rule about them binds a contributor exactly as it binds the renderer.

disposeoptional

dispose?(device: ComputeDevice): void

Release what init built. Called on unregisterCompute and when the renderer is disposed.

ParameterTypeDescription
deviceComputeDevice