Repository navigation
fix: composite the pattern scenes as a handful of layers - #29
Merged
Merged
Conversation
Each horizon scene's sun and moon are compositing layers on purpose: moved on the page's own layer, a masked, filtered disc left half of itself painted behind. WebKit gives every later sibling that overlaps a composited layer a layer of its own, so everything drawn in front of the disc was a separate full-viewport layer whose mask and blur the window server re-applied on every frame the page above it changed. Static dune had 52 of them. Everything in front of a disc now sits in one .scene-group (an isolated stacking context, painted as one layer), as does any still run over a moving part. Aurora's curtains and sun path move as a box that carries only its transform and opacity, with a paint child that draws the blur, masks and clip into the layer once. Window-server GPU time in WebKit (1400x900, a panel sliding over the scene): static dune 24% -> 7% (an empty page measures 7%), animated dune 52% -> 17%, animated aurora 42% -> 19%. All 48 WebKit snapshots (every scene, light and dark, both disc sides, animated scenes frozen at one instant) are pixel identical to the old build's.
Deploying sistine with
|
| Latest commit: |
1e8a52c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ba955012.sistine.pages.dev |
| Branch Preview URL: | https://weekendsuperhero-scene-compo.sistine.pages.dev |
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.
Summary
The horizon scenes were the biggest GPU cost on pages that use them, and the cause was layer count, not drawing.
.sw-sun). WebKit gives every later sibling that overlaps a composited layer a layer of its own, so the z-order holds. Everything drawn in front of the disc became a separate full-viewport layer, and the window server re-applied each one's mask and blur on every frame that the page above changed. Counted from WebKit's own layer tree, static dune had 52 of them..scene-group(isolation: isolate, same box as the scene). That stacking context paints as one layer, with its masks and blurs drawn once. The same wrapper goes around any still run over a moving part: forest's rays and middle ridge over a fog bank, aurora's sun path and haze over the water, and aurora's sky patch over the curtains. Only what moves gets a layer of its own..au-paintchild draws the rays with their blur, masks and clip, so those go into the layer once. The sun path, which moves with the disc, gets the disc's treatment the same way.Results
Window-server GPU time in WebKit (macOS, 1400×900, dark, a translucent panel sliding over the scene, only Finder visible, 10 s per run):
Extra layers while static, counted from WebKit's layer tree (
_caLayerTreeAsText), including clip layers:Notes
public/r/background-controller.json. Whichever merges second needsbun run registry:checkagain.Test plan
main's build.bun run lint,bun run typecheck,bun run test(311 tests),bun run registry:checktests/pattern-background.test.tsxpin the group and the paint children. Both fail when either structure is deliberately broken.