@pbroom/color-kit/computeScheduling
runPlaneCompute
Runs a batch of plane queries on a backend and returns packed results with timings.
import { runPlaneCompute } from '@pbroom/color-kit/compute';index.ts:88function 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
- request
PlaneComputeRequest - 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
- When a query result contains non-finite values (see
packPlaneQueryResults).
Example
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)