From 622c288621d404b3d40a5ebccce1ce8d203746de Mon Sep 17 00:00:00 2001 From: Jeremy Hooke Date: Sat, 7 Nov 2026 11:06:06 +1100 Subject: [PATCH] LR-EDIT-EFFECTS-GRAIN: review fix (a draft waits when nothing can stand in) Co-Authored-By: Claude Opus 5.5 --- crates/pipeline/src/crystal.rs | 4 +++- docs/grain.md | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/pipeline/src/crystal.rs b/crates/pipeline/src/crystal.rs index 15f5fac6ec..325329d3ff 100644 --- a/crates/pipeline/src/crystal.rs +++ b/crates/pipeline/src/crystal.rs @@ -878,7 +878,9 @@ fn cached(cache: &Cache, key: Key) -> Option> { /// The tile of `look` and `seed`, drawn or from the cache. Unless `wait`, a tile not drawn yet /// is drawn in the background and the last one drawn for `seed` stands in for it meanwhile: a /// Size or Roughness drag doesn't wait for every step's tile (tens of milliseconds on a slow -/// CPU), and the full-quality render when it ends waits for the exact one. +/// CPU), and the full-quality render when it ends waits for the exact one. With no tile cached +/// for `seed` nothing can stand in, so even without `wait` this waits for a draw already running +/// or draws the tile. fn tile(look: CrystalLook, seed: u32, wait: bool) -> Option> { tile_in(&TILES, look, seed, wait) } diff --git a/docs/grain.md b/docs/grain.md index 5302c012f1..5e66405c6f 100644 --- a/docs/grain.md +++ b/docs/grain.md @@ -108,10 +108,12 @@ curtain; #1060: −9.3). Fine detail under the grain is kept (detail gain in bit-sliced counters, and the tiles are drawn in parallel bands. 7–15 ms on an M2 Max (12 threads), 15–33 ms on a Ryzen 5 7545U (6 cores, 12 threads; 10–20 % less than before the row masks) at any setting (`tile_timing_report`). -- **Drags.** A draft render (a slider drag) doesn't wait for a tile it hasn't got: the last tile - drawn for the photo's seed stands in while the new one is drawn in the background, on a pool of - half the cores so the drag's renders don't queue behind it, and the next render takes it. The - full-quality render when the drag ends waits for the exact tile. A Size drag on the Ryzen with its +- **Drags.** A draft render (a slider drag) doesn't wait for a tile it hasn't got if one for the + photo's seed is cached: the last one drawn stands in while the new one is drawn in the background, + on a pool of half the cores so the drag's renders don't queue behind it, and the next render takes + it. With none cached for the seed there is nothing to stand in, so the draft waits for a draw + already running or draws the tile itself. The full-quality render when the drag ends waits for the + exact tile. A Size drag on the Ryzen with its Radeon 740M (GPU, 2.5 MP preview): 13–14 ms a frame instead of 62–66 ms. (On wasm, without threads, drafts wait.) - **Drag benchmark** (`FRAMES=100 cargo run --release -p lightcraft-gpu --example grain_drag_bench`: GPU