Repository navigation
Backdrop blur on the vendored gpui snapshot (WI-1349) - #17
Open
thedancingdeveloper wants to merge 3 commits into
Open
thedancingdeveloper wants to merge 3 commits into
thedancingdeveloper wants to merge 3 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 isBackgroundtagBackdropBlurplusStyled::backdrop_blur.BackgroundTag::BackdropBlur = 4incolor.rs. Tag 3 is upstream'sCheckerboard, so the patch is retargeted rather than copied.needs_backdrop(),is_transparent(), thestyle.rsborder-colour arm andStyled::backdrop_blur(radius, tint)follow.copy_texture_to_texture) into a backdrop texture bound at group 3, andfs_quadblurs it with a 13-tap cross kernel, tinted bysolid. Adjacent blur quads share one capture. The window surface requestsCOPY_SRCwhere the surface caps allow it. Where they don't, the capture is skipped and the blur reads the previous capture.draw_quadssplits at blur quads,CopyResources the back buffer into a backdrop texture att2, andquad_fragmentruns the same kernel and tint.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
Quadsbatch. 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_colordidn't fillsolidfor 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_quadis 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.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).profiler::testsandapp::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.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.-D warningsfails 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.demo_appand the tooltip on a display is not done here; that is WI-1438.Operator check
Linux:
Windows (dev box, WI-1439):