Skip to content

perf(glass,dock): audit fixes + on/off resource benchmark - #21

Merged
arcultus merged 2 commits into
mainfrom
audit/fluctus-dock-glass
Nov 29, 2026
Merged

arcultus merged 2 commits into
mainfrom
audit/fluctus-dock-glass

Conversation

@arcultus

Copy link
Copy Markdown
Contributor

Summary

An audit of Fluctus Dock, the Fluctus Glass KWin effect and the liquidglass renderer, the fixes it led to, and a benchmark that measures what glass costs against stock Blur.

Benchmark (just glass bench)

  • Switches only the fluctusglass effect on and off; stock Blur stays loaded.
  • Runs four scripted tests (idle, window dragged behind the dock, video behind the dock, pointer over the dock) using mpv windows and KWin scripts.
  • Records KWin and plasmashell CPU time, memory, and NVIDIA board power.
  • Before-and-after results are in glass/docs/performance.md; raw data is under glass/tools/bench/results/.

Glass effect and renderer

  • No texture reallocation every frame. The backdrop copy stays aligned to the screen, with spare room around the glass. When it does have to reallocate, it keeps the pixels that still overlap. This also fixes black or misplaced pixels in the refraction near the edges.
  • Blur textures cached in the GL renderer by size, format and pass count. Before, there was one shared set, which every draw with a different size tore down and reallocated.
  • Cheaper blur sampling. The blur chain ends with a full-resolution upsample, so the glass shader reads the blur once (an explicit level-0 sample) instead of running an 8-tap filter for every sample.
  • Fewer repaints. Glass is redrawn for another window's change only where the frame actually repainted the area the refraction samples, not on any change anywhere in an overlapping window.
  • Smaller fixes:
    • Only shapes with frost are blurred.
    • Set() calls that change nothing are ignored.
    • Backdrop textures of windows not drawn for 5 seconds are freed.
    • Converted materials are cached.
    • The renderer restores UBO binding 0, and never reads a host pixel-unpack buffer when allocating textures.
  • No KWin crash on a Rust panic. The FFI catches panics and returns an error. This needs the new release-ffi profile, because the workspace release profile aborts on panic.
  • No duplicate maths. The C++ side takes the Kawase and margin calculations from the renderer instead of keeping its own copy.
  • Behaviour change in global mode: pointer effects are now off on application windows by default. The new PointerEffectsOnWindows setting, with a checkbox in the Glass settings, turns them back on.

Dock

  • Model updates are cheaper. Role ids are cached, and dataChanged for roles the dock doesn't use is ignored. Window drags no longer re-sync every dock icon on each frame.
  • Fewer messages to KWin. Icon minimise geometry is sent only when it changes. The glass region goes over D-Bus only once the animation settles.
  • Per-frame property writes use cached handles instead of looking properties up by name.
  • Settle bug fixed. The settle check now uses the same auto-scaled sizes as step(), so the hover animation always comes fully to rest. A new regression test fails on the old code, where the dock stopped at 2.7% magnification.
  • Sharper icons. Higher-resolution icon sources with mipmapping.
  • Faster startup. Glass detection no longer blocks plasmashell startup for up to 500 ms.

Test plan

  • just test (Rust tests, headless GPU visual parity test, all C++ tests)
  • just test-san (AddressSanitizer + UBSan)
  • just lint: clippy is clean; clang-tidy shows 4 style warnings on changed lines, of kinds the existing code already has
  • Installed locally (just glass update, just dock update): no errors in the KWin or plasmashell log, and the dock glass shape is registered
  • Ran the benchmark before and after the fixes

🤖 Generated with Claude Code

arcultus and others added 2 commits November 29, 2026 18:28
`just glass bench` toggles only the fluctusglass effect (stock Blur stays
loaded), drives idle / window drag / video / pointer scenarios with mpv and
KWin scripts, and records kwin and plasmashell CPU time, memory and NVIDIA
board power. Results from before and after the audit fixes are in
glass/docs/performance.md, raw data under glass/tools/bench/results/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Glass effect / liquidglass:
- Keep the backdrop capture registered to screen coordinates with slack, and
  carry overlapping pixels over on reallocation: no per-frame texture churn
  while the dock pill grows or a window moves, no black edge refraction.
- Cache blur chains by size/format/iterations in the GL renderer instead of
  one shared chain thrashed by every differently sized draw.
- Finish the Kawase chain with a full-resolution upsample so the glass shader
  reads the blur with one level-0 tap instead of an 8-tap filter per sample.
- Repaint glass for another window's damage only where the frame really
  repainted its sampling margin, not on any damage of an overlapping window.
- Blur only frosted shapes; skip no-op Set() calls; free idle capture
  textures; cache color-mapped materials; restore UBO binding 0 and avoid
  reading a host PBO when allocating.
- Catch Rust panics at the FFI boundary (new release-ffi profile unwinds) and
  take Kawase/margin math from the renderer instead of duplicating it in C++.
- Global mode: pointer response off on application windows by default
  (new PointerEffectsOnWindows setting).

Dock:
- Cache role ids and ignore dataChanged for roles the dock does not use
  (window drags no longer resync delegates every frame).
- Publish minimize geometry only when it changes; cache per-frame property
  handles; send the glass region over D-Bus only once animations settle.
- Settle check uses the resolved (auto-scaled) metrics like step(), so the
  hover spring always reaches rest (new regression test).
- Higher-resolution icon sources with mipmapping; non-blocking startup glass
  detection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arcultus
arcultus merged commit 981e75a into main Nov 29, 2026
2 checks passed
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.

1 participant