From 3ae3f44f83541f2c3fc11251e243a9819e4043e4 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 8 Oct 2026 16:54:35 -0700 Subject: [PATCH 1/3] quest: settle the WebGPU renderer's surface after device loss A canvas that held a webgpu context never returns a 2d one. The renderer fails loud with out.error and recovers on a fresh canvas input; the elements swap their canvas themselves. Co-Authored-By: Claude Opus 5.5 --- quest/m1/webgpu-renderer.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/quest/m1/webgpu-renderer.md b/quest/m1/webgpu-renderer.md index 2e9b17c4895..8aa282ca078 100644 --- a/quest/m1/webgpu-renderer.md +++ b/quest/m1/webgpu-renderer.md @@ -40,13 +40,16 @@ added this quest). Re-planned from issue #703, whose stub quest the default) picks WebGPU where supported, else Canvas2D, and logs the choice. An explicit `"webgpu"` where it is missing refuses loudly; only `"auto"` falls back. -- Device loss: request a new device and rebuild the pipeline. If no adapter - comes back, `"auto"` switches to Canvas2D (logged) rather than going black. - A canvas that acquired a `webgpu` context never returns a `2d` one, even - after device loss, and the canvas is caller-owned (the `` child of - `` or ``, or a transferred `OffscreenCanvas`). Open: - who supplies the replacement surface for this fallback, including in the - worker. Settle it with the maintainer before building the fallback. +- Device loss: request a new device and rebuild the pipeline. A canvas that + acquired a `webgpu` context never returns a `2d` one, and the canvas is + caller-owned, so when no adapter comes back the renderer fails loud: + rendering stops and `out.error` reports a surface-lost error. Recovery is a + fresh canvas on the existing `canvas` input; with `"auto"` the renderer + then re-selects (Canvas2D if WebGPU is still gone). `` and + `` do this themselves by swapping their `` child for a + fresh one with the same attributes. In the worker, the main thread + transfers a new `OffscreenCanvas`. Decided 2026-10-08. Rejected: a canvas + factory input (a callback), and a dead renderer the app must rebuild. - The renderer takes an `HTMLCanvasElement` or an `OffscreenCanvas`, so the [watch worker](/quest/m1/watch-worker.md) move transfers the canvas and carries this renderer over unchanged. This lands first, on the main thread, @@ -65,10 +68,11 @@ added this quest). Re-planned from issue #703, whose stub quest the `"webgpu"` refuses where missing), rotation and flip parity between the two paths, device-loss recovery, and the preview's rotation. The fallback test runs in a real browser: paint with WebGPU, lose the device with no - adapter to recover, then check Canvas2D actually paints. + adapter to recover, check `out.error` reports it, then check the element's + swapped canvas actually paints through Canvas2D. Public API: new `@moq/video` package; a `renderer` attribute and option on -`` and ``; the publish preview's renderer moves to +`` and ``; the renderer's `out.error` output; the publish preview's renderer moves to the shared one. Wire: none. ## Closes From f20c3b4ccc65e4bb18a0492577acd7051e1e3810 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 8 Oct 2026 16:55:37 -0700 Subject: [PATCH 2/3] quest: rewrap the WebGPU renderer's public API line Co-Authored-By: Claude Opus 5.5 --- quest/m1/webgpu-renderer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quest/m1/webgpu-renderer.md b/quest/m1/webgpu-renderer.md index 8aa282ca078..c518bfb6ef8 100644 --- a/quest/m1/webgpu-renderer.md +++ b/quest/m1/webgpu-renderer.md @@ -72,8 +72,8 @@ added this quest). Re-planned from issue #703, whose stub quest the swapped canvas actually paints through Canvas2D. Public API: new `@moq/video` package; a `renderer` attribute and option on -`` and ``; the renderer's `out.error` output; the publish preview's renderer moves to -the shared one. Wire: none. +`` and ``; the renderer's `out.error` output; the +publish preview's renderer moves to the shared one. Wire: none. ## Closes From dc3fec6521e2a62181376fb746347119ae874913 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 8 Oct 2026 17:03:51 -0700 Subject: [PATCH 3/3] quest: pin the WebGPU renderer's out.error shape and reset Co-Authored-By: Claude Opus 5.5 --- quest/m1/webgpu-renderer.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/quest/m1/webgpu-renderer.md b/quest/m1/webgpu-renderer.md index c518bfb6ef8..a2ce61ae3c7 100644 --- a/quest/m1/webgpu-renderer.md +++ b/quest/m1/webgpu-renderer.md @@ -43,9 +43,11 @@ added this quest). Re-planned from issue #703, whose stub quest the - Device loss: request a new device and rebuild the pipeline. A canvas that acquired a `webgpu` context never returns a `2d` one, and the canvas is caller-owned, so when no adapter comes back the renderer fails loud: - rendering stops and `out.error` reports a surface-lost error. Recovery is a - fresh canvas on the existing `canvas` input; with `"auto"` the renderer - then re-selects (Canvas2D if WebGPU is still gone). `` and + rendering stops and `out.error` reports `"surface-lost"`. Like the video + source's `out.error`, it is a string union, `undefined` while healthy. + Recovery is a fresh canvas on the existing `canvas` input, which clears + the error; with `"auto"` the renderer then re-selects (Canvas2D if WebGPU + is still gone). `` and `` do this themselves by swapping their `` child for a fresh one with the same attributes. In the worker, the main thread transfers a new `OffscreenCanvas`. Decided 2026-10-08. Rejected: a canvas