Skip to content

fix(webgpu): Skip glyph batches outside the replay clip - #25640

Merged
ramezgerges merged 3 commits into
unoplatform:masterfrom
ramezgerges:dev/rara/webgpu-clip-cull-glyphs
Oct 26, 2026
Merged

ramezgerges merged 3 commits into
unoplatform:masterfrom
ramezgerges:dev/rara/webgpu-clip-cull-glyphs

Conversation

@ramezgerges

@ramezgerges ramezgerges commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #25600

PR Type:

🐞 Bugfix

What changed? 🚀

The three Given_RichEditBox tests in #25600 failed together because the test before them, When_Loaded_Large_Story_Local_Key_Edit_Stays_Range_Based, puts 128K characters on one unwrapped line in a 480 px RichEditBox. On the WebGPU lanes, lavapipe needed 16-60 s to render that frame. The X11 render thread waited for it in Present() (wgpuDevicePoll), so the following tests got no frames: their scroll animations never ticked and WaitForRenderedColor timed out.

The frame was that expensive for two reasons:

  • Glyphs: a same-colour glyph run was batched into one atlas draw however long it was, and nothing compared an op's extent with its clip. All 133K quads were drawn against a 480 px scissor (atlas=try133434, culled=0/0).
    • Batches now stop at 256 quads and carry their extent (DrawOp.Extent, cull-only, separate from the occlusion Bounds).
    • AppendSite drops ops that land wholly outside the site's clip, per frame. The cached op list is untouched, so a scroll brings them back.
  • Spell-check squiggle: the whole 128K-character "word" got one wave path, 1M px long with 18.7M edges, baked into a mask every frame.
    • A wave longer than two chunks is now drawn as repeats of one 40-period chunk through DrawPaths. Every chunk after the first starts and ends on the same crest, so they share one small, cached geometry, and their round caps overlap into the round join the single path had.
    • Normal-length squiggles are unchanged.

The BackendCondition skips added for #25600 are removed.

Validation

Runtime, in an Ubuntu 24.04 container matching the CI Linux WebGPU lane (lavapipe, 4 cores, -p:CI_Build=true):

Run Before After
Large-story test, then the three tests all three fail every attempt; the frame never finishes all pass, whole sequence ~1.3 s
Given_RichEditBox on WebGPU 3 failed, 155 s 999/999 passed, 55 s
Given_RichEditBox + Given_TextBox on Skia only the 18 pointer tests that also fail in the baseline (input injection in the container)

Stats for the large-story frame after the fix: clipCulled=511 batches dropped, no mask fills (big0). The remaining cost is about 0.3 s of CPU op building when the long line re-records.

Full suite (WebGPU, same container), against a baseline build of master: 10,562 tests, failures 76 -> 73, the three tests above are the only change, and no new failures, in two runs. These runs also carried the fix for a separate pre-existing race (two windows presenting at once corrupted the factory's main-surface cache), which crashed the suite at the multi-window tests without it; that fix will come as its own PR.

Not yet done: an A/B on a text-heavy sample. Batches capped at 256 should merge back into one draw at encode (they are adjacent in the recording's vertex buffer), but that is unmeasured.

PR Checklist ✅

🤖 Generated with Claude Code

ramezgerges and others added 3 commits October 22, 2026 09:48
A same-colour glyph run was batched into one atlas draw however long it
was, and nothing compared an op's extent with its clip: a 128K-glyph line
in a 480 px viewport drew all 133K quads against the scissor, a frame
lavapipe needed a minute for. Batches now stop at 256 quads and carry
their extent, and a replay drops the ones that land wholly outside its
site's clip. The cached op list is untouched, so a scroll brings them back.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A misspelled word's wave was one path across the whole word: a
128K-character word made a 1M px path of 18.7M edges, baked into a mask
on every frame. A wave longer than two chunks is now drawn as repeats of
one 40-period chunk through DrawPaths, so backends see one small cached
shape and can cull it per chunk.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
They failed because the large-story test before them left a frame that
held the render thread for up to a minute.

Fixes unoplatform#25600

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Oct 22, 2026
@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 240811 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) 🚨🚨
    • ClipboardTests.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • DisplayInformation.png-dark
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • DropDownButtonPage.png-dark
    • Image_UseTargetSizeLate.png-dark
    • Image_UseTargetSizeLate.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • DynamicFont.png-dark
  • skia-windows-screenshots: 2458 changed over 2490

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png
    • AnimatedBackVisualSourceSamplePage.png
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AnimatedIconPage.png
    • AnimatedIconPage.png-dark
    • Accessibility_ScreenReader.png
    • AppBarButtonTest.png-dark
    • AppBar_KeyBoard.png-dark
    • AppBarButtonWithIconTest.png-dark
    • AnimatedVisualsTestbedPage.png
    • AppBarButtonTest.png
    • AppBarToggleButtonTest.png-dark
    • AppBarToggleButtonTest.png
    • Application_DispatcherShutdownMode.png-dark
    • ApplicationViewMode.png-dark
    • ApplicationViewSizing.png
    • AppBar_KeyBoard.png
    • ApplicationViewSpanningRectsPage.png-dark
    • AppWindowClosing.png
    • AppXamlDefinedResources.png

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 240811 has failed on Uno.UI - CI.

@ramezgerges
ramezgerges enabled auto-merge October 26, 2026 16:03
@mergify

mergify Bot commented Oct 26, 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 d51fd6f into unoplatform:master Oct 26, 2026
47 checks passed
@ramezgerges
ramezgerges deleted the dev/rara/webgpu-clip-cull-glyphs branch October 26, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Three Given_RichEditBox runtime tests fail together on the WebGPU CI jobs

5 participants