Repository navigation
Windows: a frame redraws and presents only what changed - #852
Merged
Merged
Conversation
- window/damage.rs: the instances that differ from the last frame's (common start and end skipped; in the middle, an instance whose bytes both lists have didn't change; reordered common instances mean everything changed), their bounds gathered into at most four rectangles; a frame draws whole when the size or clear colour changed or most of it changed. - render/damaged.rs: the renderer keeps the last frame in a texture of its own, redraws the armed rectangles into it (a clear quad, then every instance with its scissors kept inside the rectangle, ActivePass::borrowed_within) and copies it to the drawable, which wgpu treats as empty when acquired. draw (so a compositor's Frame::draw_ui) takes the armed rectangles; effects, backdrop blur, GPU springs, native surfaces and turned or blurred layers draw whole. The window reads back what happened every frame. - Vendored wgpu-hal: flip-sequential swap chains (partial presentation needs them) and Surface::set_present_rects, presented with Present1's dirty rectangles. The swap chain's usage takes COPY_DST. - The frame log gains damage, whole (why a frame drew whole) and change. - RUNE_WHOLE_FRAMES=1 draws every frame whole, to check partial frames against.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Hona
added a commit
that referenced
this pull request
Nov 16, 2026
Partial frames (#852) redraw changed rectangles into a window-sized texture the renderer keeps, and copy it to the drawable. The first partial frame makes it and nothing gave it back: after a session is open and closed, Home holds it for the window's life (9,708,544 B of GPU memory at 1920x1200 on an Iris Xe, mapped into the process as private bytes). Rest now drops it with the other textures it gives back; the next partial frame finds no kept frame and draws whole into a new one, as the first one does.
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.
On Windows, a frame now redraws and presents only the part of the window that changed.
Present1dirty rectangles. The vendored wgpu-hal makes flip-sequential swap chains, which partial presents need, and gainsSurface::set_present_rects.Frame::draw_uitakes the partial path too.RUNE_WHOLE_FRAMES=1draws every frame whole, for checking partial frames against.Measured typing into OpenCode's composer, 1350x900 px on a 240 Hz Iris Xe, release build. Keys are posted at random moments in the refresh. Desktop Duplication timestamps when each key reaches the screen, and PresentMon gives the GPU time:
For comparison, a bare D3D11 window on the same present path takes 4,686 µs p50.
A spinner's frame redraws a 19x24 px square. After the same run of keys, the screen with partial frames matches the screen with
RUNE_WHOLE_FRAMES=1exactly (0 of 1,215,000 pixels differ).