Repository navigation
fix(core): color grading rebuilds the graded clips when a lost WebGL context is restored - #6177
Conversation
…context is restored A clip shown while the context was lost never got an entry.
Edit accuracy: accurate 271 (base branch 271), smooth 155 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 1 important · 0 nits · head 4950fdc3
- important: the
Commentsratchet is red on this head because the fix adds a comment line tocolorGrading.ts:3870(43/4247 lines vs 42/4245 at the base). It isn't a required check, so it doesn't gate the merge. Dropping that comment line, or putting the reason in the test name (it's already there), turns it green.
Scope
Calling refresh() on restore is the same idempotent scan the MutationObserver already runs. Existing entries go through upsert's redraw path, scheduleVideoDraw won't double-schedule (it checks videoFrameHandle/animationFrame), drawEntry returns early while contextLost, and destroyed short-circuits after destroy(). Red-green confirmed locally: with the two lines removed, the new test fails with expected 'unavailable' to be 'active', and all 104 tests in the file pass at the head. Out of scope: live (setGrading) clips shown during the loss still aren't recreated, because there's no attribute to rescan. All required CI checks pass.
What
After a WebGL context is lost and restored, every graded clip is graded again, including a clip that came on screen while the context was gone.
Why
On loss the runtime marks its entries lost, and on restore it rebuilds the programs of the entries it still has. A graded clip that became visible during the loss tried to build an entry on a dead context, got none, and was never revisited: it reported "WebGL unavailable" and showed ungraded until some later scan, which does not run for a paused playhead. Restore now runs the same scan that creates entries from the
data-color-gradingattribute, so every shown graded clip gets one.Reproduced in headless Chrome on a project with three graded clips, calling
WEBGL_lose_contextloseContext(), seeking to the second clip while lost, thenrestoreContext(): the second clip stayed "WebGL unavailable" before the change (also at the next seek) and is "Shader active" after.Test plan
colorGrading.test.ts: a clip shown while the context is lost has no entry; after the restore event both clips are active. It fails on main and passes here (104 tests in the file pass).