Repository navigation
Skip rasterizing dirty tiles outside the viewport - #1606
Merged
Merged
Conversation
…n scrolled back into view.
Hparty
requested review from
domchen,
richardshan0614 and
shlzxjp
as code owners
October 29, 2026 06:56
shlzxjp
previously approved these changes
Oct 29, 2026
shlzxjp
approved these changes
Oct 29, 2026
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.
What
In
RenderMode::Tiled, dirty regions were mapped to the current zoom-space cache without any viewport clipping, so a dirty region extending beyond the viewport re-rasterized cached off-screen tiles (including their background captures). The partial path already clips with&surfaceRect; the tiled path did not.DisplayList::invalidateCurrentTileCache()now compares the tiles it reaches against the viewport:Invalidated tiles are rasterized again by
collectScreenTasks()once the viewport reaches them. Note that this re-rasterization goes through the missing-tile path, so inTileUpdateMode::Smooth/Fastthose tiles are subject to the per-frame budget and may briefly show fallback content, where previously they were already valid because they had been redrawn off-screen.Test plan
LayerTest.TiledDirtyRegionOutsideViewport: pans a tiled display list, changes a layer whose bounds cover both sides of the viewport, then checks (a) the off-screen part of a tile straddling the viewport edge and (b) a tile that was fully off-screen, both after panning back. Removing either the invalidation or the unclipped draw rect makes the corresponding assertion fail with stale pixels.Note
The tile seam pixel itself is not asserted: on the SwiftShader backends the pixel exactly on the boundary between a live tile and an invalidated one keeps ~2/255 of the previous colour (measured: only that single pixel of the row differs, and it follows the old colour, e.g.
fffd0200when the old colour was green). Every native backend reproduces the pixel exactly. It is a sub-texel sampling leak from the stale atlas cell that the invalidated tile keeps; clearing the cell on invalidation would remove it at the cost of a tile-sized fill, so it is left for a follow-up. The test probes 4px inside the sliver to stay off that seam.