Cheaper frosted-glass blurs: sigma 4 and one backdrop read per bar

Blur sigma 16 -> 4 keeps CanvasKit on its direct blur path; under the 84%
fill the look is unchanged (max 13/255 inside the pieces). SegmentedBar's
pieces share a BackdropGroup so Impeller reads the content behind them once.
Adds a scroll frame-time bench, a backdrop census and filler rows to the
full-app probe. CPU CanvasKit, 560x900: run timeline p50 31.8 -> 22.1 ms,
runs list 25.3 -> 19.9 ms.
This commit is contained in:
2026-11-02 00:58:23 +00:00
parent bdf70af7e8
commit b90c7e2d1d
8 changed files with 455 additions and 5 deletions
+48
View File
@@ -0,0 +1,48 @@
# Frosted-glass chrome: cheaper blurs
Every `GlassPill` (top bar pieces, status strip, page and main tab bars, chat
composer, expanded run title) is one `BackdropFilter`. While content scrolls
behind the bars, each re-blurs it every frame.
## Change
- `GlassPill.blurSigma` 16 -> 4. Under the 84% fill the larger radius adds
nothing visible, but above about 4 Skia (CanvasKit) downscales, blurs and
upscales each piece every frame.
- `GlassPill` uses `BackdropFilter.grouped`; `SegmentedBar` puts its row of
pieces in one `BackdropGroup` so Impeller reads the content behind them once
instead of once per piece. The expanded title (drawn in the overlay, over
the content below the bar) gets its own key. The web renderer ignores
backdrop keys.
## Measurement
`tool/perf/glass_scroll_bench.mjs` over the release probe build
(`?runs=400`, `?steps=400` filler rows), 560x900, Material light. Interleaved
rounds against a `main` build because other agents loaded the machine. Medians
of 6 rounds of 4 s each, CPU CanvasKit (no WebGL):
| scenario | blurs on screen | frame p50 | frame p90 | missed vsyncs |
| --- | --- | --- | --- | --- |
| Runs list, before | 3 | 25.3 ms | 50.0 ms | 129 |
| Runs list, after | 3 (2 reads) | 19.9 ms | 38.9 ms | 102 |
| Run timeline, before | 5 | 31.8 ms | 58.6 ms | 159 |
| Run timeline, after | 5 (3 reads) | 22.1 ms | 33.1 ms | 91 |
Without any blur the same frames take about 10-12 ms, so blur was most of the
frame. With the M2 Pro GPU (`--gpu`) frames take about 2-3 ms before and after:
the GPU path is not blur-bound on this machine. Android (Impeller) was not
measured on a device.
Tried and dropped:
- Sigma 6 or 8: no measurable gain over 16 on CPU CanvasKit.
- One backdrop per bar, clipped to the union of its pieces (a custom render
object): 5 -> 3 backdrop layers on the run timeline, but no measurable gain
over per-piece blurs at sigma 4, so not worth the code.
- `RepaintBoundary` around the bars: scrolling repaints only the viewport (a
repaint boundary already), so the bars are not repainted.
Pixels (`tool/perf/compare_shots.mjs`, before vs after at a fixed scroll, both
platforms and themes): no pixel differs by more than 13/255, and 0-0.6% differ
by more than 2/255. The differences are only inside the pieces.