Repository navigation
feat(desktop-gpui): Cap Glass, a cross-platform glass material - #3442
Open
richiemcilroy wants to merge 29 commits into
Open
richiemcilroy wants to merge 29 commits into
richiemcilroy wants to merge 29 commits into
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…indow by area on X11
…and its edge hairline
…e grey axis to Apple's
richiemcilroy
changed the base branch from
main
to
feat/gpui-window-arrange-focus
October 27, 2026 03:17
Member
Author
|
hey @greptileai, please re-review the PR |
richiemcilroy
marked this pull request as ready for review
October 27, 2026 21:32
This branch was successfully deployed
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.
Stacked on #3454. Part of the picker stack: #3441, #3450, #3452, #3454, this, #3456.
What this adds
Cap Glass is a glass material for the GPUI app. It renders the same on macOS, Windows and Linux, and was fitted against Apple's
NSGlassEffectView.Renderer (
apps/desktop-gpui/patches/zed-glass.patch)The gpui fork's
BackdropBlurexisted only in the Metal renderer. This patch extends it with aGlassStyleand implements it in all three renderers: Metal (shaders.metal), DirectX 11 (shaders.hlsl) and wgpu (shaders.wgsl).Per pane, the renderer:
Window::paint_glasswraps the pass in its own scene layer, so the glass draws even when nothing else is painted above it.prepare-gpui-dependency.shapplies the patch like the others.Package (
apps/desktop-gpui/glass, cratecap-glass)model.rsis a CPU model of the same material. It is the reference the GPU output is checked against.presets.jsonholds the four fitted materials: Regular and Clear, each in light and dark.glass-fitfits a material to reference captures, at whatever backing scale they were taken. The colour transform is linear in its coefficients, so each evaluation solves it exactly by weighted least squares (neutral scenes weighted 12x). Nelder-Mead searches only blur, lensing and lighting.src/ui/glass.rsis the app API:glass::pane(kind, dark, radius)gives aDivwhose first child is the glass, so content paints on it.Reference captures (
scripts/glass-reference/reference.swift)The script draws 13 scenes (flat greys, black, white, text, dense text, checker, grid, stripes, dots, saturated blobs, hues, a UV ramp, a split field). It puts
NSGlassEffectViewpanes over them in each style and appearance, at several sizes and radii, and captures them.The references were captured on a MacBook Pro (M4 Max, macOS 27). CI VMs render Liquid Glass in a reduced form, so references must come from real hardware. To regenerate them, run the script on a Mac with Screen Recording access, then
glass-fit <dir> <out>.Fit against Apple
Per preset, over the 13 scenes, inside the glass:
Notes on the table:
tests/presets.rspins this.GPU against the model, on every OS
The glass probe (
CAP_GLASS_PROBE_OUTPUT,.github/workflows/glass-probe.yml) runs on all three OSes:On Windows and Linux it captures the window's screen area. Hosted Windows runners have no window capture, and Cap's own windows aren't in the X11 window list.
It passes at SSIM ≥ 0.97 and mean ΔE ≤ 2.
Cost
cap-glassbuilds atopt-level = 3in dev, so the probe and the fitter run at full speed.Testing
cargo test -p cap-glassruns the preset calibration against Apple's flat values (wired intoci.yml).node --test scripts/prepare-gpui-dependency.test.mjscovers the new patch's place in the patch list.

Confidence Score: 5/5
The PR appears safe to merge, with three non-blocking issues still open in the CPU reference and scaled X11 probe.Findings
Fix with agent prompt
Summary
Adds Cap Glass across Metal, DirectX 11, and wgpu.
Reviews (7) · Last reviewed commit: "Merge feat/gpui-window-arrange-focus int..." · Reviewed by Greptile