Repository navigation
feat(producer): add an auto value for PRODUCER_FORCE_SCREENSHOT - #9116
jrusso1020 wants to merge 3 commits into
Conversation
auto captures as false does, except that a page holding a WebGL or WebGPU canvas is captured by screenshot when GL is software. The choice is made once, after the page opens, and a distributed plan records it for every chunk. Unset, true and false behave as before. Signed: Rames Jusso Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed: Rames Jusso Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Edit accuracy: accurate 275 (base branch 273), smooth 88 of thoseThe gate passes. Newly passing (2)
Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)
Quarantined, measured but not gated (0) |
…ess-shell Signed: Rames Jusso Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Holding this, no review ask for now. Measured on a split render of a 1080p WebGL page (450-frame chunks, software GL): with Signed: Rames Jusso |
|
Closing. The whole-chunk recapture this was meant to avoid turned out to come from supersampled renders (the plan recorded BeginFrame for a page that is always captured in screenshot mode), not from accelerated canvases, and locking screenshot for every accelerated canvas made split renders slower. A small fix for the plan follows in its own PR. Signed: Rames Jusso |
What
PRODUCER_FORCE_SCREENSHOTtakes a third value,auto: capture asfalsedoes (BeginFrame where it is available), except that a render whose page holds a WebGL or WebGPU canvas is captured by screenshot when GL is software. Unset,trueandfalsebehave as before.Why
On software GL, BeginFrame capture of a page with a WebGL canvas is slower per frame than screenshot capture, while for a plain DOM page BeginFrame is the faster of the two. A host that sets
falseto keep BeginFrame for DOM pages pays for it on WebGL pages.autopicks per render.Measured on one host with software GL, 12 s at 1080p, the build before this change (ms per frame, BeginFrame / screenshot): DOM page 4.3 / 11.2, WebGL page 78 / 49. So the expected gain for a WebGL page is about 1.6x. Two limits on that number: it has not been measured with this build yet, and a second host with software GL reads 34 for the same WebGL page, so about 1.4x of the difference between the two hosts remains that this change does not address. There is no measurement of the same pages on any other kind of host.
Related work
None open.
How
resolveConfigreadsautoas the same opt-out of the software-GL screenshot clamp thatfalseis, and marks the config (screenshotForAcceleratedCanvas).acceleratedCanvasScreenshot.Known cost and limits:
autoon software GL the probe browser is opened for every render, including one that would otherwise have skipped it. The added time has not been measured yet; it will be measured on a short render before any host is switched toauto.false. A canvas handed to an OffscreenCanvas is seen.falsebehaviour.autodecides only when the GPU mode is set tosoftwareoutright. With GPU modeauto, the mode can turn out to be software after the probe has run; such a render stays on BeginFrame, where an unsetPRODUCER_FORCE_SCREENSHOTwould have switched it to screenshot.autocarries one new optional field. An older renderer rejects config fields it does not know, so where the config is built on one host and rendered on another, the renderer has to be updated first.Test plan
Unit tests added/updated
Manual testing performed
Documentation updated (if applicable)
Comments follow CONTRIBUTING.md "Comments"
packages/engine/src/config.test.ts(130 passed):autoresolves to BeginFrame with the opt-out and the mark; unset,trueandfalseresolve as before and never carry the mark; the run-time software clamp treatsautoas an opt-out.packages/producer/src/services/render/stages/probeStage.test.ts(111 passed):auto+ software GL + canvas reopens in screenshot mode;auto+ no canvas stays BeginFrame;auto+ hardware GL stays BeginFrame without looking at the page; withoutautothe page is never asked; with screenshot already chosen the page is not asked.packages/producer/src/services/distributed/plan.test.ts, with a real browser on Linux:auto+ a page with a WebGL canvas records screenshot capture in the plan;auto+ a plain page andfalse+ the WebGL page record BeginFrame. With the plan's lock line removed this test fails.tsc --noEmitfor engine and producer,oxlintandoxfmton the changed files.Not tested here: a full render in
automode, and the in-process render's follow-through beyond the probe stage's report (it shares the two lines the first-frame fallback uses).Signed: Rames Jusso
The plan-lock test runs only when the resolved browser is chrome-headless-shell: only that browser has BeginFrame capture, so on any other browser there is no capture mode for a plan to lock and the test skips with a message.
🤖 Generated with Claude Code