[PR #13458] AtlasEngine: Implement LRU invalidation for glyph tiles #29563

Open
opened 2026-01-31 09:35:39 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/13458

State: closed
Merged: Yes


So far AtlasEngine would only grow the backing texture atlas once it gets full,
without the ability to reuse tiles once it gets full. This commit adds LRU
capabilities to the glyph-to-tile hashmap, allowing us to reuse the least
recently used tiles for new ones once the atlas texture is full.
This commit uses a quadratic growth factor with power-of-2 textures,
resulting in a backing atlas of 1x to 2x the size of the window.
While AtlasEngine is still incapable of shrinking the texture, it'll now at
least not grow to 128MB or result in weird glitches under most circumstances.

Validation Steps Performed

**Original Pull Request:** https://github.com/microsoft/terminal/pull/13458 **State:** closed **Merged:** Yes --- So far AtlasEngine would only grow the backing texture atlas once it gets full, without the ability to reuse tiles once it gets full. This commit adds LRU capabilities to the glyph-to-tile hashmap, allowing us to reuse the least recently used tiles for new ones once the atlas texture is full. This commit uses a quadratic growth factor with power-of-2 textures, resulting in a backing atlas of 1x to 2x the size of the window. While AtlasEngine is still incapable of shrinking the texture, it'll now at least not grow to 128MB or result in weird glitches under most circumstances. ## Validation Steps Performed * Print `utf8_sequence_0-0x2ffff_assigned_printable_unseparated.txt` from https://github.com/bits/UTF-8-Unicode-Test-Documents * Scroll back up to the top * PowerShell input line is still there rendering as ASCII. ✅
claunia added the pull-request label 2026-01-31 09:35:39 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29563