Skip to content

Backdrop blur on the vendored gpui snapshot (WI-1349) - #17

Open
thedancingdeveloper wants to merge 3 commits into
gpui-upstreamfrom
wi-1349-backdrop-blur
Open

thedancingdeveloper wants to merge 3 commits into
gpui-upstreamfrom
wi-1349-backdrop-blur

Conversation

@thedancingdeveloper

@thedancingdeveloper thedancingdeveloper commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

Re-applies the backdrop-blur work from the old gpui fork onto the vendored snapshot at gpui-upstream, per operator decision 4 of WI-1346. The blur is computed in the quad fragment shader from a captured copy of the colour target, not in a separate pass. The API is Background tag BackdropBlur plus Styled::backdrop_blur.

  • API (gpui). BackgroundTag::BackdropBlur = 4 in color.rs. Tag 3 is upstream's Checkerboard, so the patch is retargeted rather than copied. needs_backdrop(), is_transparent(), the style.rs border-colour arm and Styled::backdrop_blur(radius, tint) follow.
  • wgpu (Linux). A quad batch is drawn in runs that each start at a blur quad. Before each run the colour target is copied (copy_texture_to_texture) into a backdrop texture bound at group 3, and fs_quad blurs it with a 13-tap cross kernel, tinted by solid. Adjacent blur quads share one capture. The window surface requests COPY_SRC where the surface caps allow it. Where they don't, the capture is skipped and the blur reads the previous capture.
  • DirectX (Windows). Same design: draw_quads splits at blur quads, CopyResources the back buffer into a backdrop texture at t2, and quad_fragment runs the same kernel and tint.
  • Metal. Out of scope.

The earlier "known issue": root cause

The capture pass was fine. The bug was batching. The red quad and the blur quad had the same draw order, so they landed in one Quads batch. The capture ran before that batch, before the red quad was drawn, so the blur sampled the clear colour and painted opaque black over the red. That looked like the earlier draws vanishing. The fix is to split the batch at each blur quad. A second bug is also fixed: prepare_gradient_color didn't fill solid for tag 4, so the tint was dropped. The render-pass "copy" pipeline and the second sampling view are gone; a plain texture copy is enough.

Tests

  • headless_renderer_blurs_the_pixels_drawn_behind_a_quad is no longer ignored. A red backdrop shows through the blur quad (red stays red, black stays black). It now also asserts that the seam pixels are a red/black mix, which proves the backdrop is blurred, not copied.
  • New: headless_renderer_tints_a_backdrop_blur (a 50% blue tint over red comes out half and half).

Verification (this host, Linux)

  • cargo check -p gpui -p gpui_wgpu: clean.
  • cargo test -p gpui -p gpui_wgpu -- --test-threads=1: all pass (gpui 465 passed, 2 ignored; gpui_wgpu 45 passed).
    • In the default parallel run, 4 tests fail. They are in profiler::tests and app::bench_context, share global tracing state, and this PR doesn't touch them. They pass serially.
  • cargo check -p gpui_windows --target x86_64-pc-windows-msvc: compiles.
    • This host has no llvm-rc, so gpui's build script was run with a shim that writes an empty .res. That is fine for a check, which never links.
    • The HLSL is compiled by fxc only on Windows, so the shader change is not compiled here. Runtime verification is WI-1439.
  • Clippy -D warnings fails on upstream vendored code this PR doesn't touch (profiler.rs, app.rs, events.rs, ...). None of the 131 clippy findings across gpui, gpui_wgpu and gpui_windows (msvc) are on lines this PR changes.
  • The visual check of demo_app and the tooltip on a display is not done here; that is WI-1438.

Operator check

Linux:

cargo test -p gpui_wgpu --lib headless_renderer
cargo test -p gpui -p gpui_wgpu -- --test-threads=1
cargo run -p demo_app   # look at the tooltip / blur surfaces

Windows (dev box, WI-1439):

cargo check -p gpui_windows
cargo build -p demo_app && cargo run -p demo_app   # compiles shaders.hlsl via fxc; check the blur surfaces

thedancingdeveloper and others added 3 commits October 14, 2026 10:50
The Background API patch from the old fork, retargeted because upstream
added Checkerboard at tag 3 (backdrop blur takes tag 4), plus the wgpu
renderer side: a captured colour target bound on the quads pipeline and
the blur computed inside fs_quad.

The capture pass that feeds the blur is disabled. Sampling the colour
target makes the preceding pass's draws disappear, and that is not yet
explained. See the PR for WI-1349.
The capture ran before the whole quad batch, so a blur quad sharing a
batch with the quads behind it sampled the clear colour and painted it
over them. Draw the batch in runs that start at a blur quad, capture by
texture copy between runs, and drop the sampling pipeline. The surface
asks for COPY_SRC where supported. The tint now reaches the shader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mirror the wgpu path: split quad batches at blur quads, CopyResource the
render target into a backdrop texture bound at t2, and blur it in
quad_fragment with the same 13-tap kernel and tint. Record the files in
PATCHES.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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