we (web engine): Experimental web browser project to understand the limits of Claude

Glyph texture atlas for GPU text rendering #293

Open pierrelf.com
targeting main
Open opened by and assigned to pierrelf.com
targeting main

Summary #

Implements a shelf-packing glyph texture atlas in the render crate for GPU-accelerated text rendering (Phase 12, issue 4/7).

  • Shelf-packing allocator: Packs glyph bitmaps into R8 grayscale texture pages using a horizontal shelf algorithm. Configurable page size (default 1024×1024), with automatic overflow to new pages.
  • Font integration: On-demand glyph rasterization via the existing Font::get_glyph_bitmap() cache. Keyed by (glyph_id, quantized_size).
  • TexturedQuad API: Given a TextLine, produces positioned textured quads with UV coordinates and text color — ready for the Metal renderer to consume.
  • Dirty tracking: Pages track modification state so the GPU texture is only re-uploaded when new glyphs are added.
  • 19 unit tests covering allocation, shelf packing, page overflow, dirty flags, UV coordinates, and edge cases.

Implements issue 3mi4366fkxs2g

Test plan #

This pull request has no versions submitted yet.