perf(ui): skip the destination read-modify-write on empty tiles (#127) #144
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics!144
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-127"
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?
Summary
The standalone per-category UI compute shaders —
ui-quads,ui-circles,ui-images,ui-text— unconditionallyimageLoadthe destination pixel at the top ofmain()andimageStoreit at the end. On a sparse UI most 8×8 tiles are touched by no item in a given category, so this is a wasted full read-modify-write of the swapchain image per empty tile. The fused uber-kernel (ui-fused) already amortizes a single load/store across all four categories; the standaloneDispatch*path has no such umbrella and pays per pass.Fix
Defer the
imageLoaduntil just before the first surviving blend (gated by aloadedflag) and skip the trailingimageStoreunless at least one item actually blended.Output is bit-identical:
dstis never read (uiBlendOveris the only consumer), so loading it lazily changes nothing.Applied to all four standalone shaders; the fused kernel is unchanged.
Testing
crafter-build test— 23/23 passing. The build recompiles all five UI shaders through glslang, andUIFusedShaderrevalidates the fused kernel; no GLSL or push-constant regressions.No visible change (pure load/store-traffic reduction), so no screenshot.
Resolves #127