Skip to content

glass: the test bed has a shadow scene that proves one shadow on GPU pixels - #1148

Merged
fizzy-publish[bot] merged 3 commits into
mainfrom
glass/testbed-shadow
Nov 6, 2026
Merged

fizzy-publish[bot] merged 3 commits into
mainfrom
glass/testbed-shadow

Conversation

@fizzy-publish

@fizzy-publish fizzy-publish Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

glass: the test bed measures the shadow joined glass casts

In plain words

When two pieces of glass run together in fizzy, they should cast one soft shadow, the way one piece would. The glass test bed now has a second scene that draws the same outline as one piece and as two joined pieces, on the real graphics path, and measures how much darker the joined version is. A shadow that doubles up, or a ring left inside the glass, shows up as a number instead of something a person has to spot.

What changes

  • The test bed takes a scene name: pair (the drop meeting the bar, unchanged) or the new shadow.
  • The shadow scene has two pictures: a small drop sitting inside the bar, and two boxes overlapping by 40 pt. Each is compared with the single piece of glass that has the same outline.
  • For each, it writes how much darker the joined picture is in the place a doubled shadow would land: round the drop inside the bar, and in the band under the overlap.
pub const Scene = enum { pair, shadow };
pub const Config = struct { scene: Scene, dir: []const u8 };
pub fn steps(scene: Scene) usize {
    return switch (scene) {
        .pair => 26,
        .shadow => std.enums.values(ShadowCase).len,
    };
}

What you will notice

Nothing visible: internal. It lets a change to the glass shadow be checked on rendered pixels, with a number to hold it to, rather than by eye.

How we know it works

New unit tests check that both scene names are read and an empty output path is refused, the step count for each scene, that the hole in the measured area is skipped, and that each measured area has pixels in it. For the overlap they also check that no corner of the area is covered by the joined glass. The rendered measurement itself (scripts/glass-testbed.sh shadow) could not be run in the worker's sandbox, which blocks starting the app under a virtual display. Its rows are still to be pasted here (see below).

How this serves fizzy

It holds the glass's shadow to a measured number, so it stays right as the glass changes: Fast, and measured applied to materials and polish.

For agents: technical summary

Goal

SH1 (#1137) proves "one shadow" on the CPU mirror (LiquidField.sampleWith). This proves it on GPU pixels, through core.dialogs.glassBubbles with .merge = 12, .shadow = 1.

What changed and why

  • src/editor/GlassTestbed.zig: Config has scene: Scene (pair, shadow). parse reads <scene>:<dir>. steps is now steps(scene) (pair 26, shadow 2). The pair scene's pictures, options and rows are as before. The bar field became region (plus hole).
  • shadowPictures(case, window, fade, offset) gives A, B and the region in points:
    • inside: A is the 340×64 bar (r 24). B is the bar plus a 40×40 drop (r 20) centred in it. Region: the drop outset by surfaceShadow().fade, intersected with the bar, with the drop as a hole.
    • overlap: A is one 160×60 box (r 20). B is two 100×60 boxes (r 20) at x 0 and x 60, same top. Region: x 60…100, from the bottom edge down by fade + offset.y.
  • ghostMax takes an optional hole and skips pixels inside it, outset by ghost_inset (2 px, the same as the rect's inset). Pair passes null, so its numbers don't change.
  • Shadow rows: {"scene":"shadow","case":"inside"|"overlap","dark_max":D,"x":..,"y":..}, with D = ghostMax(B, A, region, hole), how much darker B is than A.
  • scripts/glass-testbed.sh accepts shadow. It prints the row with the largest ghost_max (pair) or dark_max (shadow).

How it was verified

  • scripts/zb build, scripts/zb build test (217/217 steps, fizzy-glass-testbed-tests 5/5), scripts/zb build test-integration (110/110 steps), scripts/zb build lint, scripts/zb build check-web: all pass. zig fmt --check is clean on both Zig files. The sandbox refused to run scripts/check-fmt.sh. The slot reruns it.
  • Spec 3's tests are in fizzy-glass-testbed-tests, which build/app.zig puts in zig build test, not test-integration. They pass there. For overlap, sampleWith(...).coverage == 0 at the four corners of the measured area (the region inset by ghost_inset) with B's field at scale 1 and merge 12.
  • Not measured: the GPU rows. The worker's sandbox refused scripts/glass-testbed.sh shadow and a direct xvfb-run of the built binary. So these are still to be pasted:
    • main after SH1: both rows, expected dark_max ≤ 2/255 (≈ 0.0078).
    • SH1 reverted locally: both rows, expected > 10/255 (≈ 0.039).
  • If work#946 has not merged, its dark ghost of a drop can show in the inside region (the ring round the drop, inside the bar). That would raise the "case":"inside" row on main without SH1 being at fault. Whether linux: work-525 #946 has merged was not checked: the worker may not call GitHub.

Not done / follow-ups

  • Paste both runs' rows (main, and SH1 reverted) from a machine that can run the test bed.

🤖 Generated with Claude Code

Part of fizzyedit/work#1006

…pixels

Signed-off-by: fizzy pop-os-claude-1 <slot+pop-os-claude-1@fizzy.invalid>
@fizzy-publish fizzy-publish Bot added kind:claude agent kind that wrote the PR (new workflow) area:editor work area lock labels Nov 6, 2026
@fizzy-ops fizzy-ops Bot added the pm:review one assigned reviewer reviews label Nov 6, 2026
@fizzy-ops

fizzy-ops Bot commented Nov 6, 2026

Copy link
Copy Markdown

TRIAGE @76bc41f3 auto: mechanical rules met (fizzy-* app author, names work#1006, 166 non-test lines <= 400, no risky path). Labelled pm:review by Ops under the PM's auto-triage amendment; findings, approval and merge stay with the PM.

@fizzy-pm fizzy-pm Bot added the reviewer:linux-codex the PM assigned linux/codex to review this PR label Nov 6, 2026
@fizzy-pm

fizzy-pm Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Where this PR stands

Stage: Author's turn
Next: Author should add the gates you ran, and their result, to the body

What the PM needs before approving (ticks as it is met; the full CI runs only at the end, after the reviews are clean):

  • The body names its basis (Part of fizzyedit/work#N or a plan step)
  • Within the size limit: 176 of 800 lines outside tests and docs
  • The body shows which gates the author ran
  • No open findings at this commit
  • Every earlier finding was answered in a FIXES comment
  • Clean reviews at this commit from 1 kind: slot/codex (has 1)
  • Marked ready, which starts the full CI (the PM does this the moment the items above are met)
  • The full CI passes at this commit (CI is green)
  • The PM's final okay (pm-approval)

Reviews at the current commit (8c4b3b9):

Reviewer Verdict Findings
slot/codex clean none

2 earlier reviews are for older commits and will be redone.

Updated 2026-11-06 18:48 UTC by the PM. This comment is edited in place.

Signed-off-by: fizzy pop-os-claude-1 <slot+pop-os-claude-1@fizzy.invalid>
@fizzy-publish fizzy-publish Bot added the rework:1 rework round label Nov 6, 2026
@fizzy-publish

fizzy-publish Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Rework published.

Signed-off-by: fizzy foxnne-desktop-claude-2 <slot+foxnne-desktop-claude-2@fizzy.invalid>
@fizzy-windows fizzy-windows Bot added the rework:2 rework round label Nov 6, 2026
@fizzy-windows

fizzy-windows Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Rework published.

@fizzy-pm fizzy-pm Bot removed pm:review one assigned reviewer reviews reviewer:linux-codex the PM assigned linux/codex to review this PR labels Nov 6, 2026
@fizzy-publish
fizzy-publish Bot added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit 562b160 Nov 6, 2026
19 checks passed
@fizzy-publish
fizzy-publish Bot deleted the glass/testbed-shadow branch November 6, 2026 19:05

This branch was successfully deployed

1 active deployment
bridge — 8c4b3b9f Deployed Nov 6, 2026 by fizzy-publish[bot] via bridge #4248
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:editor work area lock kind:claude agent kind that wrote the PR (new workflow) rework:1 rework round rework:2 rework round

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants