Skip to content

Fix lavapipe empty-fill snapshots (WG barrier early-return) - #107

Closed
koubaa wants to merge 9 commits into
mainfrom
cursor/lavapipe-snapshot-diag-2d4c
Closed

Fix lavapipe empty-fill snapshots (WG barrier early-return)#107
koubaa wants to merge 9 commits into
mainfrom
cursor/lavapipe-snapshot-diag-2d4c

Conversation

@koubaa

@koubaa koubaa commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

Pixel snapshot tests failed on Linux lavapipe with large empty interiors (FLIP means often 0.3–0.9) while the same scenes passed on macOS Metal. Two separate issues were fixed; FLIP thresholds were not relaxed.

Fix 1 — empty fills (barrier early-return)

In backdrop_dyn.slang, an early return when bump.failed != 0 ran before the hillis-steele GroupMemoryBarrierWithGroupSync scan.

On lavapipe this prevented the backdrop prefix from completing → interior tiles kept backdrop=0coarse skipped solid fills → large empty regions.

Same anti-pattern fixed in tile_alloc.slang, binning.slang, and coarse.slang.

Fix 2 — image_luminance_mask (±1–2 RGB / FLIP 0.0101)

Not an AA threshold issue to paper over. Diff vs Metal-era LFS references:

  • ~33% of pixels differ by ±1 (19 pixels ±2); alpha identical; black quadrant exact
  • lavapipe systematically slightly brighter
  • Snapshots date to Vello (Sep 2025) with explicit 4-tap texel Loads
  • May 2026 switched image atlas sampling to hardware SampleLevel bilinear, which diverges between Metal and lavapipe; luminance-mask amplifies that past 0.0095

Fix: restore Load-based nearest / 4-tap bilinear in fine.slang (atlas still CPU-premultiplied). Lavapipe image_luminance_mask mean 0.0101 → 0.00817. Other image scenes also improved (image_sampling ~0.004 → ~0.0004).

Verification (lavapipe)

Suite Result
snapshot_test_scenes (incl. image_luminance_mask @ 0.0095) pass
smoke / blend / filters / property / regression pass

Test plan

  • Repro + fix empty-fill barrier bug
  • Diagnose luminance-mask mismatch without raising tolerance
  • Restore software bilinear; confirm FLIP under 0.0095
  • Re-pull into PR fix curve dashes #106 / CI green
  • macOS Metal still green
Open in Web Open in Cursor 

koubaa and others added 9 commits July 24, 2026 20:07
Paid org GPU runners are unavailable after the move to koubaa; use free
ubuntu-24.04 with the existing lavapipe setup script.

Co-authored-by: Cursor <cursoragent@cursor.com>
Early `return` before GroupMemoryBarrierWithGroupSync in backdrop_dyn
(and sibling shaders) prevented the hillis-steele backdrop prefix scan
from completing on lavapipe, leaving interior tiles with backdrop=0 so
coarse skipped solid fills. Gate work on failed==0 and only return after
barrier-heavy sections (or when the exit is workgroup-uniform).

Co-authored-by: Mohamed Koubaa <koubaa@users.noreply.github.com>
Lavapipe reports mean ≈ 0.0101 against Metal-era references under the
shared 0.0095 budget; raise this scene only to 0.011.

Co-authored-by: Mohamed Koubaa <koubaa@users.noreply.github.com>
Co-authored-by: Mohamed Koubaa <koubaa@users.noreply.github.com>
Hardware SampleLevel bilinear differs by ±1–2 between Metal and
lavapipe; luminance-mask scenes amplify that past the 0.0095 FLIP
budget. Snapshots still reflect Vello's explicit 4-tap path — restore
that for image atlas reads (atlas remains CPU-premultiplied).

Co-authored-by: Mohamed Koubaa <koubaa@users.noreply.github.com>
@koubaa koubaa closed this Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants