Repository navigation
core: Vulkan and D3D12 glass draws the lens and follows the slider - #242
Merged
Merged
Conversation
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
force-pushed
the
core/glass-programs
branch
from
October 8, 2026 16:42
84e512b to
fb422e9
Compare
foxnne
marked this pull request as ready for review
October 8, 2026 16:58
12 tasks
Collaborator
Author
|
Web / Generated by Claude Code |
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.
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 inLiquidFieldwere last compiled in #206; the HLSL changed in #227, so those two platforms kept drawing the earlier glass whateverpublishLooksaid.liquid_glass.glslandliquid_glass.metalline for line, with three deliberate, documented differences (the loop form, samples at level 0, the dither takinguv).LiquidField.sampleagrees with them on the field.dxv; the SPIR-V passesspirv-val; the interface is unchanged (two samplers, one uniform buffer, colour at location 0, uv at 1). That DXC wants clang on Linux: built with GCC 13 it corrupts its heap compiling DXIL.publishLook's comment says every form of the program draws the lens now, and that the web publishes none (Editor.zigpasses null on wasm).docs/WINDOWS_LINUX_GLASS_PLAN.mdand the "still to do" indocs/NATIVE_WINDOWS_PLAN.md's materials library are marked done.SDK impact
core. 0.2.18 (sdk: release 0.2.18, a plugin's glass over its picture and native #228,LiquidField.drawPicturefor pixi's dropper magnifier) shipped without them, so the magnifier's lens shows on Vulkan/D3D12 from the next release.sdk/src/version.zig,sdk_versionuntouched, PR labelledsdksdk_version, lists thesdkPRs since the lastsdk-v*tagVerified
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):
core, withLiquidFieldand 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).GpuRendererdraws a program (frost at sampler 0, sharp at 1, the punch and add passes), withpack+applyLookuniforms and the look fromglass_look.inAppat 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 ofliquid_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.corecompiles and its check runs on x86_64-linux. Not seen in the app.Follow-ups
corein.🤖 Generated with Claude Code
https://claude.ai/code/session_01Vci2bBhv2EH5QxygzWxmx8