Skip to content

Text: a glyph atlas makes its first page's CPU copy at its first mask - #830

Merged
Hona merged 1 commit into
devfrom
memory-atlas
Nov 12, 2026
Merged

Hona merged 1 commit into
devfrom
memory-atlas

Conversation

@Hona

@Hona Hona commented Nov 12, 2026

Copy link
Copy Markdown
Member

Atlas::new allocated the first glyph page's CPU copy (2048x2048, 4,194,304 B) up front, so a text system that only measures held it too. measure's thread-local TextSystem (text/measure.rs) never places a glyph, and an app gets one on every thread that calls measure. The copy is now made by Atlas::alloc when the first page takes its first mask.

  • Writes: every write to a page goes through alloc first (put, reserve, the CPU boot's mask fill), so the copy exists before any write.
  • Reads: of an empty first page read nothing: page_data returns an empty slice, and the CPU boot renderer reads it with get.
  • Examples and rune-ref that write atlas.data directly size it first.

Measured (blade, OpenCode release, measuring build, one session open)

before after
glyph atlas CPU copies (live heap by call site) 2 x 4,194,304 B 1 x 4,194,304 B

Related to #163: this removes the copy a measuring text system never uses. The window's own copy and the image pages' copies stay. Under Windfoil the window's copy mostly holds zeros where the GPU filled a mask, which is the next step.

Touched: text/atlas.rs; render/metallib.rs, examples/gpu_springs.rs, examples/text_quality.rs, rune-ref/src/gpu.rs size the copy before writing into it.

Atlas::new allocated the first 2048x2048 page's CPU copy (4 MiB) up front, so a text system that only measures held it too: measure's thread-local TextSystem, on every thread that calls measure, never places a glyph. The copy is now made by Atlas::alloc when the first page takes its first mask. Every write goes through alloc; reads of an empty first page read nothing.
Copilot AI balanced review requested due to automatic review settings November 12, 2026 21:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants