Fix stale rendering after a shared texture atlas is cleared
TextureAtlas.clearTexture() wipes every page and both cache maps but never bumped _pageLayoutVersion, so it silently broke the invalidation contract that #6042 introduced for shared atlases. The atlas is shared by every terminal with an equal config (CharAtlasCache), but WebglRenderer.clearTextureAtlas() only clears the *calling* renderer's model. Every other owner keeps vertex data pointing into the rows that were just wiped, and GlyphRenderer.beginFrame() has no way to notice, so those terminals keep drawing from stale texture coords until something else happens to invalidate them. Once the clearing terminal rasterizes new glyphs into the freed rows, the siblings render whatever landed there instead of their own text. Embedders hit this whenever they force a redraw on one terminal while others are alive; VS Code calls Terminal.clearTextureAtlas() on OS resume, which is why a stale terminal there stays garbled even after opening a new one (the new terminal re-acquires the same cached atlas) and only recovers once the whole panel is closed and the last owner drops the atlas. Bump _pageLayoutVersion on clear so sibling renderers rebuild their models on their next frame, matching what page merges and evictions already do. The added test fails on master (terminal B's row renders terminal A's flood glyphs) and passes with the fix.
This commit is contained in:
@@ -145,6 +145,11 @@ export class TextureAtlas implements ITextureAtlas {
|
||||
this._cacheMap.clear();
|
||||
this._cacheMapCombined.clear();
|
||||
this._didWarmUp = false;
|
||||
|
||||
// Invalidate renderer models so all texture pages are refreshed. The atlas may be shared, in
|
||||
// which case the clearing renderer has cleared only its own model and every other owner still
|
||||
// holds texture coords into the rows just wiped.
|
||||
this._pageLayoutVersion++;
|
||||
}
|
||||
|
||||
private _createNewPage(): AtlasPage {
|
||||
|
||||
Reference in New Issue
Block a user