Fix canvas ghosting in the wgpu renderer#3364
Closed
zao111222333 wants to merge 1 commit into
Closed
Conversation
Member
I don't see how this is possible. The This looks like a graphics driver issue to me. |
Author
You're right, I found the graphics adapter of |
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.
This PR fixes stale
iced::widget::canvaspixels that can remain visible after a canvas is resized, clipped, hidden, or covered by another layer.The issue was observed with the
wgpurenderer onRed Hat 8 and Red Hat 9. The same application did not reproduce it on the macOS / CentOS 7 systems used for comparison. Layout, hit testing, scrollbars, and widget sizing were correct; only the rendered pixels were stale.Reproduction
Repro Demo, RedHat 8
Screen.Recording.2026-06-15.at.18.18.14.mp4
Now:
Screen.Recording.2026-06-15.at.19.02.11.mp4
Root Cause
The problem was in the
iced_wgputriangle rendering path, not in application layout or individual canvas widgets.The MSAA triangle pipeline reuses an intermediate resolve texture. When a previous frame rendered a larger canvas, pixels could remain in untouched parts of that reused texture. A later frame with a smaller canvas or different clip bounds could then composite those stale pixels into the final frame.
Cached triangle uploads also need to account for the active clip bounds. The same mesh content can be valid under one clip and invalid under another.
Fix
Together, these changes make clipping and target reuse explicit in the renderer, so applications do not need widget-specific background clearing workarounds to hide stale canvas pixels.