Repository navigation
feat(desktop-gpui): Cap Glass, a cross-platform glass material - #3442
Conversation
|
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
|
hey @greptileai, please re-review the PR |
| cp "$GITHUB_WORKSPACE"/target/debug/*.dll "$out/" 2>/dev/null || true | ||
| else | ||
| cp "$bin" "$out/" | ||
| cp -r "$GITHUB_WORKSPACE/target/native-deps/lib" "$out/lib" 2>/dev/null || true |
There was a problem hiding this comment.
Linux build artifact stages libs where the loader never looks
Medium Severity
The Stage the build step copies target/native-deps/lib to $out/lib, but the Linux binary is linked with -Wl,-rpath,$ORIGIN -Wl,-rpath,$ORIGIN/../lib/cap (scripts/setup.js line 332 writes those rustflags to .cargo/config.toml because the workflow runs node scripts/setup.js with RUST_TARGET_TRIPLE), and it carries DT_NEEDED entries for ffmpeg's lib*.so.N sonames (ffmpeg-next linking against FFMPEG_DIR=target/native-deps). On a GPU machine the uploaded cap-gpui-debug-linux artifact therefore dies at process start with libavcodec.so.60: cannot open shared object file: the loader searches $ORIGIN (the artifact dir, which holds only the binary) and $ORIGIN/../lib/cap (which the step never creates — it ships lib, not lib/cap), and scripts/glass-probe/run.sh sets no LD_LIBRARY_PATH; the workflow's probe step is what exports LD_LIBRARY_PATH=target/native-deps/lib:target/debug, so CI green proves nothing about the artifact. The step also omits libonnxruntime.so* entirely — setup.js stages it into native-deps/onnxruntime/lib, not native-deps/lib, while camera-effects' ort (load-dynamic) dlopens it for segmentation. setup.js already stages exactly the runtime set (the versioned soname copies and the onnxruntime copies) into apps/desktop-gpui/target/<triple>/debug, right next to the binary where $ORIGIN looks; staging those *.so* beside the binary in $out (instead of the inert $out/lib tree) makes the artifact run with no environment. The Windows branch is fine: its DLLs land beside the exe, which the loader searches first.
| cp -r "$GITHUB_WORKSPACE/target/native-deps/lib" "$out/lib" 2>/dev/null || true | |
| cp "$(dirname "$bin")"/*.so* "$out/" 2>/dev/null || true |
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