[robustness] Font atlas has no eviction/repack; ShelfPlace fails permanently once full #55
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics#55
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Subsystem: Font / FontAtlas
Location:
implementations/Crafter.Graphics-FontAtlas.cpp:51-70, 93-98Impact: MEDIUM (robustness, not perf) · Effort: Large · Not hot path (post-fill)
Problem
One-way shelf allocator; once the 1024^2 atlas fills, new glyphs never place. For multi-font/CJK/many-size workloads the atlas silently degrades. Correction to original finding: failed glyphs are not cached as empty (
Ensurereturns at line 97 before the emplace), so every unplaceable glyph is re-rasterized viastbtt_GetCodepointSDFevery frame, never cached. The callercontinues skipping the glyph including its advance, so text collapses/shifts rather than rendering blank.Proposed fix
LRU eviction + free-list, or grow-and-repack + skyline packer. At minimum, do not re-rasterize unplaceable glyphs every frame.
Correctness caveat
A grow/repack that reallocates the image changes the descriptor the GPU samples — needs a frame-fence wait or double-buffering; naive in-place repack mid-frame is a read-during-write hazard. CPU-side repack +
dirty=true+ deferredUpdatebetween frames is safe.