[PR #11623] [MERGED] Introduce AtlasEngine - A new text rendering prototype #28668

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/11623
Author: @lhecker
Created: 10/27/2021
Status: Merged
Merged: 11/13/2021
Merged by: @undefined

Base: mainHead: dev/lhecker/atlas-engine


📝 Commits (10+)

  • 602714c Introduce AtlasEngine - A new text rendering prototype
  • 8aef31b Merge remote-tracking branch 'origin/main' into dev/lhecker/atlas-engine
  • c1eccc9 Fix build errors, fix crashes, address comments
  • 753f6bd Fix spelling, address comments
  • d995f6d Fix build errors
  • 6fa6190 Fix build errors
  • ecc139b Fix build errors
  • 3b6d786 Merge remote-tracking branch 'origin/main' into dev/lhecker/atlas-engine
  • 0823eee Scaling fix for SwapChainPanel, Emoji alpha blending, All cursor types
  • bc6d99b Implemented font features/axes, Half of gridlines

📊 Changes

56 files changed (+3966 additions, -300 deletions)

View changed files

📝 .github/actions/spelling/allow/allow.txt (+6 -5)
📝 .github/actions/spelling/excludes.txt (+1 -0)
📝 OpenConsole.sln (+43 -0)
📝 src/cascadia/PublicTerminalCore/PublicTerminalCore.vcxproj (+3 -0)
📝 src/cascadia/TerminalControl/ControlCore.cpp (+31 -17)
📝 src/cascadia/TerminalControl/ControlCore.h (+2 -5)
📝 src/cascadia/TerminalControl/ControlInteractivity.h (+1 -0)
📝 src/cascadia/TerminalControl/IControlSettings.idl (+1 -1)
📝 src/cascadia/TerminalControl/TermControl.cpp (+32 -35)
📝 src/cascadia/TerminalControl/TermControl.h (+1 -7)
📝 src/cascadia/TerminalControl/TerminalControlLib.vcxproj (+1 -0)
📝 src/cascadia/TerminalCore/lib/terminalcore-lib.vcxproj (+3 -0)
📝 src/cascadia/TerminalSettingsEditor/Profiles.cpp (+7 -6)
📝 src/cascadia/TerminalSettingsEditor/Profiles.h (+3 -2)
📝 src/cascadia/TerminalSettingsEditor/Profiles.idl (+2 -0)
📝 src/cascadia/TerminalSettingsEditor/Profiles.xaml (+10 -1)
📝 src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw (+4 -0)
📝 src/cascadia/TerminalSettingsModel/MTSMSettings.h (+2 -1)
📝 src/cascadia/TerminalSettingsModel/Profile.idl (+1 -0)
📝 src/cascadia/TerminalSettingsModel/TerminalSettings.cpp (+1 -0)

...and 36 more files

📄 Description

This commit introduces "AtlasEngine", a new text renderer based on DxEngine.
But unlike it, DirectWrite and Direct2D are only used to rasterize glyphs.
Blending and placing these glyphs into the target view is being done using
Direct3D and a simple HLSL shader. Since this new renderer more aggressively
assumes that the text is monospace, it simplifies the implementation:
The viewport is divided into cells, and its data is stored as a simple matrix.
Modifications to this matrix involve only simple pointer arithmetic and is easy
to understand. But just like with DxEngine however, DirectWrite
related code remains extremely complex and hard to understand.

Supported features:

  • Basic text rendering with grayscale AA
  • Foreground and background colors
  • Emojis, including zero width joiners
  • Underline, dotted underline, strikethrough
  • Custom font axes and features
  • Selections
  • All cursor styles
  • Full alpha support for all colors
  • Should work with Windows 7

Unsupported features:

  • A more conservative GPU memory usage
    The backing texture atlas for glyphs is grow-only and will not shrink.
    After 256MB of memory is used up (~20k glyphs) text output
    will be broken until the renderer is restarted.
  • ClearType
  • Remaining gridlines (left, right, top, bottom, double underline)
  • Hyperlinks don't get full underlines if hovered in WT
  • Softfonts
  • Non-default line renditions

Performance:

  • Runs at up to native display refresh rate
    Unfortunately the frame rate often drops below refresh rate, due us
    fighting over the buffer lock with other parts of the application.
  • CPU consumption is up to halved compared to DxEngine
    AtlasEngine is still highly unoptimized. Glyph hashing
    consumes up to a third of the current CPU time.
  • No regressions in WT performance
    VT parsing and related buffer management takes up most of the CPU time (~85%),
    due to which the AtlasEngine can't show any further improvements.
  • ~2x improvement in raw text throughput in OpenConsole
    compared to DxEngine running at 144 FPS
  • ≥10x improvement in colored VT output in WT/OpenConsole
    compared to DxEngine running at 144 FPS

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/11623 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 10/27/2021 **Status:** ✅ Merged **Merged:** 11/13/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/atlas-engine` --- ### 📝 Commits (10+) - [`602714c`](https://github.com/microsoft/terminal/commit/602714cc429bca0cf1405c567bfa7bcef11b4a5d) Introduce AtlasEngine - A new text rendering prototype - [`8aef31b`](https://github.com/microsoft/terminal/commit/8aef31b7efae9fadf447256cd4fc72bcb6611c50) Merge remote-tracking branch 'origin/main' into dev/lhecker/atlas-engine - [`c1eccc9`](https://github.com/microsoft/terminal/commit/c1eccc99f11b128bc75bd76a485b9012785a7ea3) Fix build errors, fix crashes, address comments - [`753f6bd`](https://github.com/microsoft/terminal/commit/753f6bdba4813c481ab01d76e0c38f112e384a32) Fix spelling, address comments - [`d995f6d`](https://github.com/microsoft/terminal/commit/d995f6df53f2d133b1ed99b607244cfab9337025) Fix build errors - [`6fa6190`](https://github.com/microsoft/terminal/commit/6fa6190fa156638086473461868586a6ffca8302) Fix build errors - [`ecc139b`](https://github.com/microsoft/terminal/commit/ecc139b1d99490528e1933382ac4edfcd98d665f) Fix build errors - [`3b6d786`](https://github.com/microsoft/terminal/commit/3b6d7867d642207a273f16eba2a1c4a86da9eda9) Merge remote-tracking branch 'origin/main' into dev/lhecker/atlas-engine - [`0823eee`](https://github.com/microsoft/terminal/commit/0823eee4153ca26f25511befcdd7c96222a98173) Scaling fix for SwapChainPanel, Emoji alpha blending, All cursor types - [`bc6d99b`](https://github.com/microsoft/terminal/commit/bc6d99be16e71796ba1ab3b29d2c23732ea70152) Implemented font features/axes, Half of gridlines ### 📊 Changes **56 files changed** (+3966 additions, -300 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/allow/allow.txt` (+6 -5) 📝 `.github/actions/spelling/excludes.txt` (+1 -0) 📝 `OpenConsole.sln` (+43 -0) 📝 `src/cascadia/PublicTerminalCore/PublicTerminalCore.vcxproj` (+3 -0) 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+31 -17) 📝 `src/cascadia/TerminalControl/ControlCore.h` (+2 -5) 📝 `src/cascadia/TerminalControl/ControlInteractivity.h` (+1 -0) 📝 `src/cascadia/TerminalControl/IControlSettings.idl` (+1 -1) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+32 -35) 📝 `src/cascadia/TerminalControl/TermControl.h` (+1 -7) 📝 `src/cascadia/TerminalControl/TerminalControlLib.vcxproj` (+1 -0) 📝 `src/cascadia/TerminalCore/lib/terminalcore-lib.vcxproj` (+3 -0) 📝 `src/cascadia/TerminalSettingsEditor/Profiles.cpp` (+7 -6) 📝 `src/cascadia/TerminalSettingsEditor/Profiles.h` (+3 -2) 📝 `src/cascadia/TerminalSettingsEditor/Profiles.idl` (+2 -0) 📝 `src/cascadia/TerminalSettingsEditor/Profiles.xaml` (+10 -1) 📝 `src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw` (+4 -0) 📝 `src/cascadia/TerminalSettingsModel/MTSMSettings.h` (+2 -1) 📝 `src/cascadia/TerminalSettingsModel/Profile.idl` (+1 -0) 📝 `src/cascadia/TerminalSettingsModel/TerminalSettings.cpp` (+1 -0) _...and 36 more files_ </details> ### 📄 Description This commit introduces "AtlasEngine", a new text renderer based on DxEngine. But unlike it, DirectWrite and Direct2D are only used to rasterize glyphs. Blending and placing these glyphs into the target view is being done using Direct3D and a simple HLSL shader. Since this new renderer more aggressively assumes that the text is monospace, it simplifies the implementation: The viewport is divided into cells, and its data is stored as a simple matrix. Modifications to this matrix involve only simple pointer arithmetic and is easy to understand. But just like with DxEngine however, DirectWrite related code remains extremely complex and hard to understand. Supported features: * Basic text rendering with grayscale AA * Foreground and background colors * Emojis, including zero width joiners * Underline, dotted underline, strikethrough * Custom font axes and features * Selections * All cursor styles * Full alpha support for all colors * _Should_ work with Windows 7 Unsupported features: * A more conservative GPU memory usage The backing texture atlas for glyphs is grow-only and will not shrink. After 256MB of memory is used up (~20k glyphs) text output will be broken until the renderer is restarted. * ClearType * Remaining gridlines (left, right, top, bottom, double underline) * Hyperlinks don't get full underlines if hovered in WT * Softfonts * Non-default line renditions Performance: * Runs at up to native display refresh rate Unfortunately the frame rate often drops below refresh rate, due us fighting over the buffer lock with other parts of the application. * CPU consumption is up to halved compared to DxEngine AtlasEngine is still highly unoptimized. Glyph hashing consumes up to a third of the current CPU time. * No regressions in WT performance VT parsing and related buffer management takes up most of the CPU time (~85%), due to which the AtlasEngine can't show any further improvements. * ~2x improvement in raw text throughput in OpenConsole compared to DxEngine running at 144 FPS * ≥10x improvement in colored VT output in WT/OpenConsole compared to DxEngine running at 144 FPS --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:29:58 +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#28668