Repository navigation
feat(engine): render WebGPU compositions on SwiftShader behind an opt-in - #5133
Merged
Merged
Conversation
PRODUCER_ALLOW_SOFTWARE_WEBGPU=true lets a host without a GPU render a data-requires-webgpu composition instead of refusing it. SwiftShader can draw canvas WebGPU only through its Vulkan backend with GPU compositing on, so an opted-in software launch adds the Vulkan feature and --use-vulkan=swiftshader, keeps compositing on, and the adapter check accepts the fallback adapter. Off by default; every other launch is unchanged.
Edit accuracy: accurate 2059 (base branch 2059), smooth 1489 of thoseThe gate passes. Quarantined, measured but not gated (0) |
miguel-heygen
marked this pull request as ready for review
October 7, 2026 00:18
jrusso1020
approved these changes
Oct 7, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
Checked at dd6235c.
- With the opt-in off, nothing changes:
usesSoftwareWebGpuneedsrequiresWebGpu, the flag on, nodisableGpu, and software mode. The new test asserts byte-identical Chrome args for each case where it doesn't apply. - The launch and the adapter check agree.
createCaptureSessioncomputessoftwareWebGpufrom the samegpuConfigit passes tobuildChromeArgs, and the check accepts a fallback adapter only then. A pooled browser can't be reused across the two shapes, becauseacquireBrowserkeys the pool on the args fingerprint, and--use-vulkan=swiftshader/,Vulkanchange it. - The CLI callers (validate, layout, motionShot, snapshot capture, studio thumbnails) pass only
browserGpuMode, so they keep the old launch and keep refusing a fallback adapter. - Dropping
--disable-gpu-compositingon the opt-in path is documented as a tradeoff (the HF#3049 workaround is skipped), and the code comment says SwiftShader WebGPU needs GPU compositing.
Non-blocking:
WebGpuUnavailableErroris shared with those CLI commands.hyperframes validateorlayouton a no-GPU host will now tell the user to setPRODUCER_ALLOW_SOFTWARE_WEBGPU=true, which those commands ignore. The typegpu skill line reads the same way, next to "local capture commands". Scope the hint to renders, or pass the flag through to the CLI capture paths.- On the opt-in path, GSAP yoyo stale frames (HF#3049) can come back. Worth one line in the skill doc so someone who opts in knows why.
Rames
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
An opt-in, off by default, that lets a host without a GPU render a composition declaring
data-requires-webgpu: setPRODUCER_ALLOW_SOFTWARE_WEBGPU=true. Without it, such a render is refused exactly as today.Why it works now
SwiftShader reports a WebGPU adapter, and #4091 refused it because a canvas drawn on it came out blank. Measured on a GPU-less Linux host with chrome-headless-shell 152 and 154: SwiftShader draws canvas WebGPU only through its Vulkan backend with GPU compositing on. The engine's software launch turns compositing off (
--disable-gpu-compositing, the HF#3049 workaround), and then every draw fails with "A valid external Instance reference no longer exists." (or, with the Vulkan flags alone, a blank canvas).So an opted-in launch, and only that launch:
Vulkanto--enable-featuresand--use-vulkan=swiftshader;usesSoftwareWebGpu()is the one owner of that decision: the composition requires WebGPU, the render opted in, the GPU mode resolved to software, anddisableGpuis off (SwiftShader cannot draw WebGPU at all under--disable-gpu). The Chrome flags and the capture session's adapter check both read it, so the launch and the check cannot disagree.Verification
shadersnpm library: every frame distinct, byte-identical across two runs and across 1 vs 2 workers; without the opt-in, the same refusal as before. Two of them match a Metal render of the same composition to about 1/255.packages/engine: browserManager and config tests, plus a newframeCapture-softwareWebGpu.test.tsthat drives the realcreateCaptureSession+initializeSessionand asserts the launch flags and the adapter check's arguments with the opt-in on, off, and on a GPU. Three runs each; each of the eight one-line breaks of the decision or its wiring tried in review turns a test red (dropping the check entirely fails by test timeout).main(972 flag combinations compared in review).Limits
PRODUCER_ALLOW_SOFTWARE_WEBGPU=true. A programmaticallowSoftwareWebGpu: true(in-process or serialized) does not reach the chunks; a worker without the variable fails loudly with the same error, never renders blank.hyperframes snapshot,layout,validate,checkand Studio thumbnails keep refusing WebGPU compositions on software hosts.--browser-gpu,disableGpu).Review
Independent adversarial review, one report per head. Final round at this head (dd6235c): no BLOCKERs, no MAJORs.