fix: panes keep their WebGL renderer, and give the context back when they lose it - #39
Merged
Conversation
ba2slk
force-pushed
the
fix/webgl-context-release
branch
from
August 18, 2026 08:03
932bdad to
29da362
Compare
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.
Two things a scroll or a switch could leave on screen. First, a pane already in view turned white with a sad-face icon in its corner: Chromium's drawing for a canvas whose WebGL context is lost.
WebglAddon.dispose()removes the canvas but leaves the context alive until garbage collection, and Chromium counts it against its per-page cap until then, so panes leaving the screen left dead contexts behind, the browser saw more than sixteen, and it force-lost the oldest live one until the garbage was collected. Detaching now loses the context explicitly throughWEBGL_lose_context; eight switches between a fourteen-pane and a nine-pane session, screencast at device pixels, went from 13 white frames of 87 to 0 of 83. Second, a long scroll or a held Alt+→ across a wide canvas ended on one blank frame in the panes that arrived: they had given their renderer back on leaving the visible band and took a fresh one on return, which paints a frame late. The budget now keeps the renderer of a pane out of view while there is room under the cap and gives idle ones up least recently seen first only when a visible pane needs the slot; four end-to-end round trips over a 5600px canvas went from 40 renderer attaches to 0 after first sight. The self-check counts WebGL canvases specifically and asserts that no canvas still in the document loses its context during the held-key burst. Details are indocs/engineering-notes.md.Generated with Claude Code