SurfacePreparation

class SurfacePreparation
packages/workers/src/surfacePreparation.ts:59

Members

constructor

constructor(pool: WorkerPool | null, resolution: number) → SurfacePreparation
poolWorkerPool | null
Undocumented
resolutionnumber
Undocumented

clear

clear() → void

Cancel the preparations in flight. The world they were for is gone, and a job left running is a worker the new world's ground queues behind.

holding

holding(source: ArchivedSource) → ArchivedSource

A source whose requests wait for their surface to be prepared.

For a producer that reads the field on this thread — the GPU producer packs the surface for its kernel, and the pack reads the graph. The pool needs none of this: a worker builds its own graph, off this thread.

sourceArchivedSource
Undocumented

prepare

prepare(surface: SurfaceParameters) → Prepared | null

The surface, once this thread can read it; null while a worker prepares it. Asking is what starts the preparation, and asking again is free.

Synchronous with no pool — the headless runner, the tests and the Node benchmarks, none of which have frames to drop.

surfaceSurfaceParameters
Undocumented

whenPrepared

whenPrepared(surface: SurfaceParameters) → Promise<Prepared | null>

Settles with the answer once prepare has one for surface, and starts the preparation if nothing has. It never rejects.

Settles with null when clear cancels the preparation: the world it was asked for is gone, and the waiter asks again about whatever its address names now. Left pending instead, a waiter on a replaced world's surface waits for an answer nothing will ever ask for.

Never settles after the pool is terminated — there is no frame left to spend an answer on — nor for a surface neither thread could prepare, whose field throws for every reader.

surfaceSurfaceParameters
Undocumented