Repository navigation
perf(runtime): give each graded canvas its own WebGL context in WebKit - #8848
Open
robinebers wants to merge 1 commit into
Open
robinebers wants to merge 1 commit into
robinebers wants to merge 1 commit into
Conversation
The colour grade draws every graded clip in one shared WebGL context and copies the result into each clip's 2D canvas. WebKit reads the WebGL canvas back on each such copy, so a graded video in Safari drops frames while it plays. In WebKit each graded canvas now draws with its own WebGL context, as the grading preview renderer already does, and nothing is copied. A lost context removes that clip's grade, so the source shows ungraded; a later refresh grades it again. Destroying such a renderer releases its context. Other browsers keep the shared context.
This branch has not been deployed
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.
In Safari, colour-graded video drops frames, because WebKit reads the shared WebGL canvas back on every 2D copy. This gives each graded canvas its own context in WebKit, the way the grading preview renderer already does. Other browsers keep the shared context and are not touched.
Measured in Safari 27.2 on a graded 55 s composition, three plays: 6, 5 and 3 dropped frames before, and 2, 2 and 2 after. With grading off it's 1, 1 and 1. One caveat: we measured this together with our frame-source change (separate pull request), not on a plain
<video>on its own.Destroying the renderer releases its context, and a lost context removes that clip's grade.
Test: with a Safari user agent, two graded clips get two contexts, there are no 2D copies, and both contexts are released on destroy.