Skip to content

The clip a damaged node paints within is worked out alone, not with its place and effects - #601

Merged
wingleeio merged 1 commit into
mainfrom
flush/world-clip
Oct 26, 2026
Merged

wingleeio merged 1 commit into
mainfrom
flush/world-clip

Conversation

@wingleeio

@wingleeio wingleeio commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Several callers asked Scene::world for the clip a node paints within (.2) and threw away the rest:

  • shown_context, which damage runs for every subtree damaged alone;
  • damage_node's parent clip, for a box painting past its own clip;
  • two places in resolve_moves.

world sums the node's translation and opacity over every ancestor before it works out the clip.

world_clip is world's clip loop alone, in the same shape: each clipping ancestor is taken at its box, translated by its own and its ancestors' translations summed from it upwards, with no storage. world is its translation and effects plus world_clip. The clip-only callers call world_clip. The clip is bit-for-bit what it was, so damage is unchanged.

The speed-of-light lane handed this over after #587 (one damage context shared between a setter's two damage calls). It found world at 21% of script-layout, from animated rows under clipping ancestors.

Exactness: a hash of every frame's damage rects and scroll moves over 480 frames of heavy both, stream, scroll and animate matches main.

Numbers. Exact instruction counts (arm64 cachegrind, gate flags, against main 542ad4d, which includes #587):

scene change
script-layout −7.24%
style −3.79%
anime −3.72%
animate −0.95%
heavy both / stream / scroll −0.43% / −0.41% / −0.19%
lab stream / scroll −0.02% / −0.41%
micro state / vscroll fixed / variable −0.10% / −0.29% / −0.10%
script-update −0.18%
widgets −0.03%
mount +0.02%

Mount varies by about ±0.15 M between runs of the same binary, and no zgx function in it changes.

Checks: fmt, clippy 1.99 -D warnings, and the zgx, zgx-gpu and zgx-desktop tests (1,341 passed).

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…ts place and effects

shown_context, a node's paint past its clip, and scroll moves asked world
for its clip and threw away the translation and effects it summed over
every ancestor first. world_clip is world's clip loop alone (as before:
each clipping ancestor at its box translated by its and its ancestors'
translations, summed from it upwards), and world is its translation and
effects with world_clip. Damage is the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Instruction counts (cachegrind, exact) against aaf35528; the gate fails above +1%.

scene base head change
heavy-both 1,415.7 M 1,411.8 M -0.27%
heavy-stream 1,359.3 M 1,355.8 M -0.26%
heavy-scroll 80.4 M 80.3 M -0.09%
lab-stream 462.1 M 462.3 M +0.04%
lab-scroll 70.3 M 70.1 M -0.27%
animate 397.6 M 394.8 M -0.71%
micro-state 59.7 M 59.7 M -0.06%
micro-vscroll-fixed 48.8 M 48.7 M -0.17%
micro-vscroll-variable 89.0 M 89.0 M -0.03%
micro-state-luau 82.9 M 82.9 M -0.07%
micro-vscroll-fixed-luau 66.3 M 66.2 M -0.13%
micro-vscroll-variable-luau 134.6 M 134.5 M -0.07%
mount 327.2 M 327.6 M +0.13%
script-update 1,700.2 M 1,698.2 M -0.12%
anime 4,791.6 M 4,672.7 M -2.48%
script-layout 4,001.4 M 3,767.1 M -5.85%
list-state 893.8 M 893.8 M -0.00%
style 2,146.7 M 2,084.3 M -2.91%
widgets 2,685.2 M 2,684.5 M -0.02%
app-mail 318.5 M 318.5 M -0.01%
app-chat 53.2 M 53.2 M -0.01%
app-dashboard 189.8 M 189.4 M -0.20%
app-dashboard-sort 126.5 M 126.3 M -0.18%
app-sketch 48.5 M 48.5 M -0.02%
app-code 100.0 M 99.9 M -0.10%
app-code-search 87.7 M 87.6 M -0.02%

@wingleeio
wingleeio merged commit b73e16c into main Oct 26, 2026
4 checks passed
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.

1 participant