Skip to content

ui: the underlay field: overlays inherit the page under them - #143

Merged
GLinnik21 merged 2 commits into
mainfrom
land/underlay-field
Sep 19, 2026
Merged

GLinnik21 merged 2 commits into
mainfrom
land/underlay-field

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

ui: the underlay field: overlays inherit the page under them

An overlay had two ways to relate to the page under it, and both lost the
position of the colour. A flat scrim says nothing about the page. A
four-corner envelope can say the page is greenish, but not that the green
sits on the left of the bottom edge. The underlay field is a third way: the
frame is reduced to 15x8 cells, low-passed, graded and reconstructed to
60x32, then drawn as one magnified quad. There is no blur pass.

GPU half (gfx.rs). sample_underlay_field copies the viewport, runs seven
exact 2x box passes down to 15x8, then does one 480-byte glReadPixels
per latch. It refuses to sample:

  • inside a blur source pass;
  • on a video-plane frame;
  • while the page is served from FrameCache;
  • under drawmask=field;
  • on a drawable the exact-2x chain cannot be built for.

draw_field draws through fs_field.frag (one fetch, one multiply, the
shared dither). It takes the slot of the dead fs_modal_ground.frag, so
the dithered-program count stays at three. Class::Field joins the
overdraw ledger and mask.

CPU half (ui/underlay.rs). UnderlayField exposes latch_from_frame,
latch_from_corners (the CPU source for the video plane and for frames
before Home exists), reset, sample, key and draw(Role). The
Ground grade goes through AmbientWash::keyed_one, so a 120-cell ground
and a four-corner ground share one palette. Role::Dim at weight 0, or
on an unlatched field, draws exactly the plain scrim_black rect. The
low-pass kernel is a literal table, pinned by a test against exp.

RouteGround (settings, filmography, profiles, login, onboarding) now
holds an UnderlayField in place of its private four-corner wash. It
latches once from the live frame and falls back to the authored corners
on any refusal.

Deleted, all verified dead:

  • Popover::modal_ground and the chain behind it: Glass::modal_ground,
    Painter::backdrop_blur_flat, draw_blur_snapshot_flat,
    fs_modal_ground.frag, MPROG.
  • The five MODAL_* theme tokens that only that chain read.
  • gfx::sample_modal_ambient and ModalAmbientSample.

Second of the ambient layers, after #142. Then come the modal dims, the stress bench, the panel material and the transition hitches.

🤖 Generated with Claude Code

An overlay had two ways to relate to the page under it, and both lost the
position of the colour. A flat scrim says nothing about the page. A
four-corner envelope can say the page is greenish, but not that the green
sits on the left of the bottom edge. The underlay field is a third way: the
frame is reduced to 15x8 cells, low-passed, graded and reconstructed to
60x32, then drawn as one magnified quad. There is no blur pass.

GPU half (gfx.rs). `sample_underlay_field` copies the viewport, runs seven
exact 2x box passes down to 15x8, then does one 480-byte `glReadPixels`
per latch. It refuses to sample:
- inside a blur source pass;
- on a video-plane frame;
- while the page is served from FrameCache;
- under drawmask=field;
- on a drawable the exact-2x chain cannot be built for.

`draw_field` draws through `fs_field.frag` (one fetch, one multiply, the
shared dither). It takes the slot of the dead `fs_modal_ground.frag`, so
the dithered-program count stays at three. `Class::Field` joins the
overdraw ledger and mask.

CPU half (ui/underlay.rs). `UnderlayField` exposes `latch_from_frame`,
`latch_from_corners` (the CPU source for the video plane and for frames
before Home exists), `reset`, `sample`, `key` and `draw(Role)`. The
Ground grade goes through `AmbientWash::keyed_one`, so a 120-cell ground
and a four-corner ground share one palette. `Role::Dim` at weight 0, or
on an unlatched field, draws exactly the plain `scrim_black` rect. The
low-pass kernel is a literal table, pinned by a test against `exp`.

RouteGround (settings, filmography, profiles, login, onboarding) now
holds an `UnderlayField` in place of its private four-corner wash. It
latches once from the live frame and falls back to the authored corners
on any refusal.

Deleted, all verified dead:
- `Popover::modal_ground` and the chain behind it: `Glass::modal_ground`,
  `Painter::backdrop_blur_flat`, `draw_blur_snapshot_flat`,
  `fs_modal_ground.frag`, MPROG.
- The five `MODAL_*` theme tokens that only that chain read.
- `gfx::sample_modal_ambient` and `ModalAmbientSample`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 19, 2026 06:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@GLinnik21
GLinnik21 merged commit f001220 into main Sep 19, 2026
5 checks passed
@GLinnik21
GLinnik21 deleted the land/underlay-field branch September 19, 2026 06:32
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