Crafter.Graphics/shaders
catbot ac9180076c perf(ui): hoist loop-invariant per-item math out of the per-pixel loop (#125)
The cooperative-load section already streams each item into shared memory
once per workgroup, but the per-pixel inner loop then recomputed values
that are constant for the whole item/glyph. The compiler can't hoist them
itself — they read shared memory at a varying index.

Precompute them once per item at load time into new shared slots:

  - ui-images / ui-text / ui-fused (images+text phases): invRectSize =
    1.0/rect.zw, turning the per-pixel `(sp-rect.xy)/rect.zw` vec2 divide
    into a multiply.
  - ui-text / ui-fused (text phase): the SDF AA `band` (a vec2 divide +
    two maxes depending only on the glyph's uv span and rect size).

In ui-fused the new slots (s_inv, s_band) are reused across phases like
the existing s_v* scratch, so the LDS bump is per-category, not summed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 13:22:07 +00:00
..
ui-circles.comp.glsl perf(ui): cooperative shared-memory tile culling in UI compute shaders 2026-06-16 15:45:12 +00:00
ui-fused.comp.glsl perf(ui): hoist loop-invariant per-item math out of the per-pixel loop (#125) 2026-06-18 13:22:07 +00:00
ui-images.comp.glsl perf(ui): hoist loop-invariant per-item math out of the per-pixel loop (#125) 2026-06-18 13:22:07 +00:00
ui-quads.comp.glsl perf(ui): cooperative shared-memory tile culling in UI compute shaders 2026-06-16 15:45:12 +00:00
ui-shared.glsl Merge remote-tracking branch 'origin/master' into claude/issue-47 2026-06-16 17:09:06 +00:00
ui-text.comp.glsl perf(ui): hoist loop-invariant per-item math out of the per-pixel loop (#125) 2026-06-18 13:22:07 +00:00