Skip to content

fix(webgpu): Let the browser swapchain keep last frame's pixels - #25714

Merged
ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:dev/rara/wasm-webgpu-damage
Oct 27, 2026
Merged

ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:dev/rara/wasm-webgpu-damage

Conversation

@ramezgerges

@ramezgerges ramezgerges commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #25713

PR Type:

🐞 Bugfix

What changed? 🚀

The bug: on WebAssembly with WebGPU, every frame repainted the whole window. The compositor only repaints the damaged region when the swapchain reports PreservesContents. WebGpuSwapChainContext (desktop, iOS, Android) reports it; the browser context, WebGpuBrowserGraphicsContext, never did.

The fix: it now reports PreservesContents => true. That's safe because it keeps last frame's pixels, exactly like the desktop swapchain:

  • the scene renders into _presentTex, which Configure recreates only when the size changes;
  • Present() then blits all of _presentTex to the canvas.

Why it matters

The full-window repaint costs per pixel. On CI's WebAssembly WebGPU lane (Chrome with --use-webgpu-adapter=swiftshader, so WebGPU on the CPU), frames are slow enough that animation and scroll tests fail on timing. That's why the lane has failed 2 to 8 of its 12 shards on every master build since it was added, on 7 October. Examples:

  • InteractionTracker inertia: too few intermediate frames.
  • Wheel scrolling: settled 1064 ms after the last notch, against a 360 ms limit.
  • ScrollPresenter: timed out waiting for offset-change events.

Validation

Locally, in a CI-equivalent lane: Ubuntu 24.04 in Docker, Google Chrome stable with the lane's exact flags, Xvfb and fluxbox, a 1280×800 window, 8 cores, and the SamplesApp published with CI's command.

Run Before After
The 14 tests the lane failed on master 10 failed 0 failed; on a rerun, 2 failed (both Given_InteractionTracker inertia tests, see below)
Same 14 tests on the Skia backend, as a control 0 failed —
Same 14 at 640×400 (a quarter of the pixels) 3 failed —
CI's shard 6 of 12 (1,483 tests) 5 failed on CI 2 failed: the same 2 InteractionTracker tests

The after-runs had no other failures, so partial repaint left no stale pixels in the shard. The two Given_InteractionTracker inertia tests compare positions sampled mid-animation, so they still depend on the frame rate; they're tracked as timing-sensitive, not as rendering bugs.

Left to CI: the full WebAssembly WebGPU lane, all 12 shards. That lane is skipped on pull requests until the job-condition fix in #25664 or #25669 merges, so it will first run here after a rebase onto either.

PR Checklist ✅

🤖 Generated with Claude Code

The browser WebGPU context renders into an offscreen recreated only on
resize and blits it to the canvas, so last frame's pixels are there when
the next frame starts, but it never reported PreservesContents. Every
WebAssembly frame repainted the whole window; on a software adapter that
made frames slow enough to fail the animation and scroll tests on
timing. It now reports it, so the compositor repaints only the damage.

Fixes unoplatform#25713

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions github-actions Bot added the area/build Categorizes an issue or PR as relevant to build infrastructure label Oct 26, 2026
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@ramezgerges
ramezgerges force-pushed the dev/rara/wasm-webgpu-damage branch from c36753c to 650267a Compare October 26, 2026 17:41
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 241472 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • DisplayInformation.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • ImageBrushAlignmentXY.png-dark
    • ImageBrushAlignmentXY.png
    • DropDownButtonPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • Examples.png
  • skia-windows-screenshots: 2458 changed over 2490

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png-dark
    • AppBarButtonTest.png-dark
    • ApplicationViewMode.png
    • AppWindowPositionAndSize.png-dark
    • ArcSegment.png-dark
    • AuthenticationBroker_Cancel.png-dark
    • AutoBorderStretchwithrightmargin.png
    • AutomationProperties_Name.png
    • AutoSizedTopLeft.png-dark
    • AutoSizedTopLeft.png
    • AutoSuggestBox_Reason.png-dark
    • AutoSuggestBox_Reason.png
    • Basics Pivot Test.png-dark
    • Basics Pivot Test.png
    • BeginTime_MultipleAnimations.png-dark
    • BeginTime_MultipleAnimations.png
    • BitmapIcon_Monochromatic.png-dark
    • BitmapIcon_Monochromatic.png
    • BorderBottomwithmargins.png-dark
    • BorderBottomwithmargins.png

@mergify

mergify Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@ramezgerges
ramezgerges merged commit 227853a into unoplatform:master Oct 27, 2026
46 checks passed
@ramezgerges
ramezgerges deleted the dev/rara/wasm-webgpu-damage branch October 27, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebAssembly WebGPU repaints the whole window every frame (no partial repaint)

4 participants