Fix stale rendering after shared texture atlas page merges

Merged
AN
4mo ago
+266-12

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 _lastSeenPageLayoutVersion per GlyphRenderer so every WebGL renderer independently refreshes cached glyph page mappings.
  • Reset the renderer's last-seen page layout version when its atlas is replaced.

TDD:

  • 780cbef3 fails the focused repro with rendered signature drift while terminal B's buffer text remains correct.
  • 9559005 passes the same focused Chromium WebGL integration test.

Verification:

  • npm run build
  • npm run esbuild
  • npm run test-integration -- --suite=addon-webgl --project=Chromium addons/addon-webgl/test/WebglSharedAtlasGarble.test.ts
  • npm 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.beginFrame call site while moving acknowledgement state per renderer: GlyphRenderer.beginFrame.