You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reactive image pipeline was spending 5+ seconds on a 7-task chain because
each task (a) re-encoded its output as a base64 dataUri to "match input
form", (b) ran its inner loop in pure JS on the main thread, and (c) ran the
default deep JSON-Schema validator over the multi-megabyte Uint8ClampedArray
on every reactive run.
Changes:
- @workglow/util/media:
- Add `texture` source kind to `Image` so chained GPU tasks can pass a
`GPUTexture` along without intermediate readback. `Image.fromTexture()`,
`Image.isGpuSupported()`, and a browser-only `getTexture()` upload
on demand and cache via WeakMap.
- New `imageGpu.ts` (lazy device + pipeline cache, upload/download helpers)
and `imageGpuOps.ts` (compute shaders for sepia, invert, grayscale,
brightness, contrast, posterize, threshold, tint, transparency,
pixelate, separable box blur, flip h/v).
- Browser `getPixels` materializes texture/bitmap/canvas/videoFrame
sources directly instead of throwing, and `getImageData` short-circuits
OffscreenCanvas/ImageBitmap inputs.
- @workglow/tasks/image:
- `produceImageOutput` no longer re-encodes a dataUri output — pixels flow
between tasks as `ImageBinary`/`Image`. Display and other terminal
consumers encode lazily on demand.
- New `imageOpDispatcher.ts` routes each op to a GPU compute pipeline when
available, falling back to a tuned CPU implementation that mirrors the
prior in-task behaviour (separable blur with running sums, LUT-based
posterize/contrast, etc.).
- New `imageOps.ts` defines paired GPU+CPU implementations for each
operation, used by every task.
- New `ImageTaskBase` overrides `validateInput` to swap image-typed fields
for a tiny stand-in before delegating, so the validator exercises every
other field but skips the pixel-array walk.
- All ImageXTask files refactored to thin shims that call the dispatcher.
0 commit comments