perf(gpu): #1145 keep mask alphas in GpuStages

The GPU stage cache mirrors the CPU's: per-mask alpha buffers keyed by
masks::alpha_key, copied into the combined alpha buffer on a hit (no
readback for CPU-evaluated shapes). GpuStages::bytes counts them and the
chromaticity buffer it left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chad Elliott
2026-10-11 16:52:12 -05:00
co-authored by Claude Opus 5.5
parent 2d85c4a39d
commit 99b89cd986
3 changed files with 101 additions and 6 deletions
+8
View File
@@ -150,6 +150,14 @@ walks the drive.
- Stage cache: `GpuStages` mirrors `StageCache` (same keys: source identity + `geo`, `lin_key`,
per-plane radii) and lives in it as an extension, so the UI needs no change. The uploaded source is
kept per view. A tone / colour / exposure drag re-runs one dispatch of `finish` plus the readback.
Mask alphas are cached too, on both sides (`masks::AlphaCache`, one plane per visible mask of the
last render), each keyed by `masks::alpha_key`: the mask's components, Refine Edges, Invert and
Amount, `geo`, plus `lin_key` when it reads the image (range masks, Sky / Subject / Background
heuristics, Auto Mask brushes, Refine Edges) and the exposure when it reads that (luminance and
colour range, Sky). An Exposure drag over gradient and brush masks, or a drag of a mask's own
sliders, evaluates no mask; a cached alpha is the buffer a fresh evaluation produced, so warm and
fresh renders stay bit-identical. Both caches' `bytes()` count the alphas and the blurred
chromaticity.
- One command encoder per render; the only mid-render readback is the airlight samples (dehaze, when
the dark channel is recomputed). Dropped buffers are recycled (exact size, ≤ 2 GB pool) once the
thread that dropped them has submitted — allocating and zero-filling fresh 100–300 MB buffers