@pbroom/color-kit/computeScheduling

runPlaneCompute

Runs a batch of plane queries on a backend and returns packed results with timings.

functionimport { runPlaneCompute } from '@pbroom/color-kit/compute';index.ts:88
function runPlaneCompute(
  request: PlaneComputeRequest,
  backend?: PlaneComputeBackend,
): PlaneComputeResponse;

Runs synchronously on the calling thread; call it from a worker to keep heavy queries off the main thread, then post response.result back with getPackedPlaneQueryTransferables. No telemetry is recorded; use runScheduledPlaneCompute for that.

Parameters

requestPlaneComputeRequest
Plane, queries and optional trace options.
backend?PlaneComputeBackend
Backend to run on. Defaults to a shared JS backend created on first use.

Returns

PlaneComputeResponsePacked results, the backend kind, compute/marshal times, and debugTrace when request.trace is set.

Throws

Example

TypeScript
import { runPlaneCompute } from '@pbroom/color-kit/compute';

const response = runPlaneCompute({
  plane: { model: 'oklch', fixed: { h: 250 } },
  queries: [{ kind: 'gamutRegion', gamut: 'srgb' }],
});

response.backend; // → 'js'
response.result.queryDescriptors.map((d) => d.kind); // → ['gamutRegion']
response.debugTrace; // → undefined (set `trace` on the request to get one)

See also