Repository navigation
fix: solve #3794 — allow opting out of WebGL terminal renderer - #3796
Closed
github-actions[bot] wants to merge 1 commit into
Closed
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Adds a `terminal-renderer-type` localStorage preference so users hitting WebGL texture atlas corruption can force the DOM renderer without disabling all GPU acceleration via `--disable-gpu`. Both terminal entry points (`terminal-addons.ts` and `Terminal/helpers.ts`) honor the preference. Closes #3794
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.
Root cause
The terminal renderer (xterm.js +
@xterm/addon-webgl) maintains a glyph texture atlas in GPU memory. On some GPU/driver/font combinations the atlas can become corrupted (driver issues, atlas resize races, font-fallback cache inconsistency), so characters map to the wrong texture coordinates and render as garbled glyphs while structure (layout, indentation, syntax-highlight color) remains intact. This is a partial failure — the WebGL context is still alive — soWebglAddon.onContextLossnever fires and the existing DOM fallback is bypassed.The only existing escape hatch is launching with
--disable-gpu, which kills all GPU acceleration (window compositing, CSS animations, etc.).Fix
Add a
terminal-renderer-typelocalStorage preference ("webgl"|"dom"). When set to"dom", the WebGL addon is skipped entirely — affected users get a working terminal without losing GPU acceleration elsewhere."webgl"also bypasses the in-processsuggestedRendererType = "dom"fallback for users who want to retry. Both terminal entry points (terminal-addons.tsandTerminal/helpers.ts) honor the preference.This is the immediate escape-hatch portion of the issue's suggested fix; a settings UI can land separately.
Users self-apply via DevTools:
Tests
renderer-preference.test.ts— covers stored preference parsing (dom / webgl / unset / invalid / localStorage-throws). 5 tests, all passing.Test plan
bun test apps/desktop/src/renderer/lib/terminal/renderer-preference.test.tspassesbun run typecheckpasses (verified locally forapps/desktop)localStorage.setItem("terminal-renderer-type", "dom")in the desktop app, reload, confirm WebGL addon is not loaded and terminal still rendersCloses #3794
Summary by cubic
Add an escape hatch to disable the WebGL terminal renderer so users with garbled glyphs can switch to the DOM renderer without turning off all GPU acceleration. Both terminal entry points now respect a localStorage preference.
Bug Fixes
terminal-renderer-typelocalStorage preference: set to"dom"to skip WebGL,"webgl"to force it; unset uses default behavior with DOM fallback.terminal-addons.tsandTerminal/helpers.tsto conditionally load@xterm/addon-webgl.Migration
localStorage.setItem("terminal-renderer-type", "dom")in DevTools, then reload."webgl"to force WebGL.Written for commit 4eae9e2. Summary will update on new commits. Review in cubic