Skip to content

core: Vulkan and D3D12 glass draws the lens and follows the slider - #242

Merged
foxnne merged 1 commit into
mainfrom
core/glass-programs
Oct 8, 2026
Merged

foxnne merged 1 commit into
mainfrom
core/glass-programs

Conversation

@foxnne

@foxnne foxnne commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #236 (docs/WINDOWS_LINUX_GLASS_PLAN.md, step 0; no plan issue)

What changes

On Linux (Vulkan) and Windows (D3D12) the in-window glass — dialogs, menus, a drag's drops — now draws Apple's lens and follows the one window-opacity slider (glass_look), as it already does on macOS. The SPIR-V and DXIL embedded in LiquidField were last compiled in #206; the HLSL changed in #227, so those two platforms kept drawing the earlier glass whatever publishLook said.

SDK impact

  • None
  • Core-only or additive: reaches plugins at the next SDK release — the programs are embedded in core. 0.2.18 (sdk: release 0.2.18, a plugin's glass over its picture and native #228, LiquidField.drawPicture for pixi's dropper magnifier) shipped without them, so the magnifier's lens shows on Vulkan/D3D12 from the next release.
  • Fingerprint moved: recorded in sdk/src/version.zig, sdk_version untouched, PR labelled sdk
  • SDK release: bumps sdk_version, lists the sdk PRs since the last sdk-v* tag

Verified

Not yet seen in the app: the cloud session this was built in could not build fizzy (its network policy denies gitlab.freedesktop.org and sndio.org, which sdl_zig fetches from). What was checked instead (and CI on fb422e9 builds the app and passes its tests on macOS, Windows and Linux, the headless integration tests on Linux, and the Windows cross-build of fizzy's backend — that shows the new programs embed and link, not how they draw):

  • macOS: unchanged (Metal source untouched).
  • Windows: core, with LiquidField and the new DXIL embedded, compiles for x86_64-windows-gnu; the DXIL validates (dxv). Not run on D3D12 — wants a Windows machine (WARP is enough).
  • Linux: the new SPIR-V drawn through SDL_GPU on lavapipe, as GpuRenderer draws a program (frost at sampler 0, sharp at 1, the punch and add passes), with pack + applyLook uniforms and the look from glass_look.inApp at window opacity 0, 0.35, 0.7, 1 — a dialog (forText) and three drops beside a carried card (forDrops), over an opaque and a translucent window. Within 1/255 of liquid_glass.glsl (built with glslang) at every pixel of every case; with no look published, identical to the old SPIR-V; with one published, the old SPIR-V was off by up to 204/255. core compiles and its check runs on x86_64-linux. Not seen in the app.
  • Web: unchanged (GLSL untouched; the web publishes no look).

Follow-ups

  • See it in the app on Linux and Windows (a dialog, and a drag's drops, at a few window opacities).
  • The next SDK release carries these to plugins that build core in.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vci2bBhv2EH5QxygzWxmx8

Step 0 of `docs/WINDOWS_LINUX_GLASS_PLAN.md`. `compiled/{spv,dxil}/liquid_glass.fragment.*` were
last built in #206; the HLSL changed in #227 (Apple's lens, `glass_look`'s one slider), and the
binaries embedded for Vulkan and D3D12 still drew the earlier glass whatever `publishLook` said. So on
Linux and Windows the in-window glass had no lens and did not follow the slider.

The HLSL needed nothing. Apart from what each language declares for its inputs, textures and
uniforms, it is `liquid_glass.glsl` and `liquid_glass.metal` line for line, with three differences
that are deliberate and documented: the loop runs `first..first + count` (GLSL ES wants a constant
bound and skips), the samples are at level 0 (HLSL refuses an implicit level after `discard`; the
frost has no mips), and the dither's noise takes `uv` rather than the fragment position (D3D12
links inputs by register). `LiquidField.sample` agrees with them on the field — outline, coverage,
the way out, steepness, material — over every shape rather than one group's, and does not model
the lens's band, which nothing it answers depends on.

Both compiled with the commands at the top of the HLSL, by SDL_shadercross with its vendored DXC
(libsdl-org/DirectXShaderCompiler at 2c84a1c5, the submodule SDL_shadercross pins): the toolchain
#206 used, which compiles the #206 HLSL to #206's SPIR-V and DXIL byte for byte. The DXIL is signed
(validator 1.9, as before) and passes `dxv`; the SPIR-V passes `spirv-val`. The interface is
unchanged: two samplers, one uniform buffer, colour at location 0 and uv at 1. (That DXC wants
clang on Linux: built with GCC 13 it corrupts its heap compiling DXIL.)

Drawn through SDL_GPU on lavapipe, as `GpuRenderer` draws a program (frost at sampler 0, sharp at
1, the punch and add passes), with the uniforms of `pack` and `applyLook` and the look from
`glass_look.inApp` at window opacity 0, 0.35, 0.7 and 1 — a dialog (`forText`) and three drops
running together beside a carried card (`forDrops`), over an opaque window and a translucent one:
the new SPIR-V is within 1/255 of `liquid_glass.glsl` (built with glslang) at every pixel of every
case. With no look published it is the old SPIR-V exactly — the earlier glass is untouched — and
with one published the old SPIR-V was off by up to 204/255.

`publishLook`'s comment says every form of the program draws the lens now, and that the web
publishes none. Step 0 of `docs/WINDOWS_LINUX_GLASS_PLAN.md` and the "still to do" in
`docs/NATIVE_WINDOWS_PLAN.md`'s materials library are marked done.

Not seen in the app: fizzy itself was not built here (the environment's network policy denies
gitlab.freedesktop.org and sndio.org, which sdl_zig fetches from). `core`, with `LiquidField` and
the new programs embedded, compiles for x86_64-linux and x86_64-windows-gnu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vci2bBhv2EH5QxygzWxmx8
@foxnne
foxnne force-pushed the core/glass-programs branch from 84e512b to fb422e9 Compare October 8, 2026 16:42
@foxnne
foxnne marked this pull request as ready for review October 8, 2026 16:58

foxnne commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Web / build (run 37812911887) shows as cancelled, not failed: web.yml keeps one web-preview concurrency group with cancel-in-progress, and another pull request's test-copy build took the slot at 17:01. Nothing in this PR is involved, and the required check, ci-ok, passed on fb422e9. Not re-running it, so the other PR keeps the one test copy; it rebuilds here on the next push.


Generated by Claude Code

@foxnne
foxnne merged commit 73d2c41 into main Oct 8, 2026
10 of 11 checks passed
@foxnne
foxnne deleted the core/glass-programs branch October 8, 2026 17:53
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.

2 participants