render3d/overlay: the font atlas kept as its coverage, one byte a texel

The atlas is white glyphs on alpha and the overlay reads only the coverage,
but it was uploaded RGBA8: Maroon Lake's 3072 x 2688 atlas was 43 MB of Metal
memory with its mips, the largest single thing in the launcher window.
overlay_font now keeps the alpha alone as R8 (ov_font_tex; any other PNG
shape is uploaded as before) and overlay.frag reads .r - the white fallback
texture reads 1 there as it did from .a.

Launcher window, graphics regions: the atlas 43.0 -> 11.5 MB; process
footprint at 25 s 402 -> 378 MB. The headless launcher shot is identical to
the unchanged build's (0 pixels differ; two unchanged runs differ from each
other by 1.69%, and the new one by the same against them).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 14:45:02 +03:00
parent 2bb7ae1883
commit db7c21e5d8
4 changed files with 26 additions and 3 deletions

View file

@ -1,4 +1,4 @@
// 2D overlay: an image texture, the font atlas (white glyphs on alpha) or a flat colour, times a
// 2D overlay: an image texture, the font atlas (glyph coverage, R8) or a flat colour, times a
// colour. Which one is the vertex's own: v carries 4 x the mode (0 image, 1 font, 2 flat) on top of
// its real coordinate, so text, panels and an image's quads share a draw (overlay.ludic, ov_use_tex).
in vec2 v_uv;
@ -27,7 +27,7 @@ void main() {
if (mode > 1.5) {
o_color = v_col;
} else if (mode > 0.5) {
o_color = vec4(v_col.rgb, v_col.a * texture(u_font, uv).a);
o_color = vec4(v_col.rgb, v_col.a * texture(u_font, uv).r); // the atlas is its coverage alone (R8)
} else {
vec4 t = texture(u_tex, uv);
o_color = vec4(v_col.rgb * t.rgb, v_col.a * t.a);