Skip to content

feat(gpui): render effect layers on Metal, wgpu and DirectX - #7

Closed
mateo-m wants to merge 26 commits into
remorses:gpuixfrom
mateo-m:gpui-effect-layers
Closed

mateo-m wants to merge 26 commits into
remorses:gpuixfrom
mateo-m:gpui-effect-layers

Conversation

@mateo-m

@mateo-m mateo-m commented Sep 4, 2026 •

Copy link
Copy Markdown

What this adds

An element can now draw its subtree into a texture of its own. The renderer paints that texture over the frame with a blur, a colour matrix, a mask and a blend mode. GPUIX maps filter, backdrop-filter, mask-image and mix-blend-mode onto this.

One commit per area:

  • gpui: EffectLayer in the scene, LayerEffects in style, paint_effect_layer on the window.
  • gpui_apple: the Metal passes (premask, separable blur at three levels, composite).
  • gpui_wgpu: the same passes on wgpu.
  • gpui_windows: the same passes on DirectX 11, a blind port.
  • docs: agent doc rewording, no code.

A backdrop blur under a gradient mask blurs progressively. The premask pass weighs the backdrop by the squared mask before the blur, and the composite divides the weight back out. This stops sharp content from spilling under the blurred end.

What I ran and saw

  • cargo check -p gpui -p gpui_apple passes at the branch head.
  • cargo test -p gpui_wgpu: 31 passed, 0 failed. The wgpu tests render layers headless and assert on pixels.
  • On Metal I compared the demo's blur(6px) card against headless Chrome pixel by pixel. Edge ramps match within 2 percent at every sample, corners match within 2 percent along the diagonal.
  • The progressive blur fixes (banding, spill under a sticky header) were found on screen, fixed, and re-checked on screen with cropped screenshots.

What I did not verify

  • The DirectX commit never compiled. macOS cannot build the windows crate. Treat it as a port by convention that needs a Windows build before merge.
  • No revert-and-fail cycle on the wgpu tests as a whole. The suite was written alongside the port, not after it.

Moved from the fork

The same stack, rebased onto zed-industries main, is open upstream as zed-industries#63773. This PR is the path for the GPUIX submodule, which follows the gpuix branch of this repo.

This PR was mateo-m/zed#2. The branch merged gpuix at 8802c83 before the move. One conflict, in crates/gpui_wgpu/src/wgpu_renderer.rs: upstream added surface drawing in the same match that this branch extends with the layer begin and end arms. The merge keeps both. cargo check -p gpui -p gpui_wgpu passes on the merged head.

Stacked on #6. The diff here includes that PR and #5.

mateo-m added 25 commits August 26, 2026 21:01
Taffy computes one tree at a time. The measure closure of
`Window::request_measured_layout` runs inside that computation, so an
element cannot lay a child out there, and `Window::layout_engine` is
`None` for the duration anyway. An element that wants to size itself
from content it has to measure has no way to do it.

`IsolatedLayout` holds a second tree for that content. `enter` puts it in
front of the window's tree for the duration of a closure and gives the
window its own tree back afterwards.

GPUIX needs this for a panel whose height animates to the height of its
content. The width is what the parent gives it, which taffy hands to the
measure closure, and the content has to be measured at that width for
text to wrap the way it will on screen.

Sent upstream as the same change on gpui/isolated-layout.
# Conflicts:
#	crates/gpui_wgpu/src/wgpu_renderer.rs
@mateo-m

mateo-m commented Sep 4, 2026 •

Copy link
Copy Markdown
Author

Reopened. This PR stays the path for the GPUIX submodule: AGENTS.md in remorses/gpuix asks for GPUI changes as commits on this branch before the submodule points at them. The same stack, rebased onto zed-industries main, is open as zed-industries#63773.

@mateo-m mateo-m closed this Sep 10, 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.

1 participant