Fix stale rendering after shared texture atlas page merges
Merged
AN
4mo ago+266+266+012345678901234567890123456789-12-12-01234567890123456789
Part of: https://github.com/xtermjs/xterm.js/issues/6038
Related: https://github.com/microsoft/vscode/issues/322756
- Add a focused Chromium WebGL regression test for terminals sharing one texture atlas.
- Keep each terminal rendering correctly when another terminal sharing the same texture atlas triggers a page merge.
- Replace the shared consume-once atlas invalidation signal with a monotonic
pageLayoutVersion. - Track
_lastSeenPageLayoutVersionperGlyphRendererso every WebGL renderer independently refreshes cached glyph page mappings. - Reset the renderer's last-seen page layout version when its atlas is replaced.
TDD:
780cbef3fails the focused repro with rendered signature drift while terminal B's buffer text remains correct.9559005passes the same focused Chromium WebGL integration test.
Verification:
npm run buildnpm run esbuildnpm run test-integration -- --suite=addon-webgl --project=Chromium addons/addon-webgl/test/WebglSharedAtlasGarble.test.tsnpm run lint-changes
Inspirations from:
- The full-model refresh behavior after atlas changes comes from
WebglRenderer.renderRows. - The stale shared-state bug is in the old consume-once atlas invalidation contract:
TextureAtlas.beginFrame, page merge invalidation, and oversized-page invalidation. - The renderer-side check preserves the existing
GlyphRenderer.beginFramecall site while moving acknowledgement state per renderer:GlyphRenderer.beginFrame.