Repository navigation
feat!: pluggable drawing backend abstraction (WebGPU renderer + managed engines) - #24153
ramezgerges merged 1024 commits into
Conversation
Perf session results (samples-list scroll + WASM investigation)Fixes landed (each correctness-gated on the clip-heavy runtime batch, unchanged at its 61/72 baseline — all 10 failures pre-existing and bisect-confirmed):
Measured on UHD 620 (heat-soaked laptop; cold numbers expected higher):
Root causes, in order of discovery: rounded session clips excluded recordings from the fast stamp paths; Also documented for follow-up: pre-existing WebGPU failures (ellipse-clip+translate ×6, stroke-thickness 1px ×2), mono 10.0.11's AOT profiler crashing at runtime init (profile-guided AOT blocked), and the WASM composition-walk cost as the next lane. 🤖 Generated with Claude Code |
|
Full-suite stability note: running the unfiltered runtime-test suite against WebGPU crashes with a wgpu 🤖 Generated with Claude Code |
e49ce1c to
54c0702
Compare
6502a17 to
7663afe
Compare
Adds Given_DrawingBackend_Conformance — 8 always-on parity tests that render deterministic solid-colour scenes (solid fill, rounded-rect corner clip, path fill, stroke outline, linear + radial gradient, opacity blend, geometry clip) through the normal XAML → composition → drawing-backend pipeline and assert pixel colours at known points. No golden images and no runtime-shader dependence, so the SAME assertions run under software rendering (lavapipe) on every backend. Proves seam parity: 8/8 on Skia and 8/8 on WebGPU (UNO_WEBGPU=1). Addresses the rendering-contract review's conformance-suite gap (#68); complements Given_GradientBrush (golden) and Given_EffectBrush_Parity (effects). Co-Authored-By: Claude Opus 4.8 <[email protected]>
…n log - Architecture doc: rewrite the Lottie seam section for the SkiaSharp-free ManagedLottie engine (now the default), the IGeometryFactory-carrying Load, and the Skottie-vs-managed resolution + UNO_MANAGED_LOTTIE toggle. - RUNNING-CONTEXT §51: JS-honest browser WebGPU handoff (JsDevice/JsColorView, double-import), radial focal-origin fix, conformance suite, managed Lottie, and the two documented deferrals (layer sub-rect sizing, lighting node). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Adds trim-path (tm) support to ManagedLottie: keep the [Start,End]% arc-length of a group's paths, rotated by Offset (deg), applied via IGeometry.GetFilledGeometry before fill/stroke. Simultaneous mode (trim over the concatenated group length); wrap across the seam is a best-effort union of the two arcs. Unlocks the common loader/progress/checkmark animations that draw a stroke on via trim. Test: Given_ManagedLottie.When_Trim_Animation_Renders_And_Animates renders ms-appx 4930-checkbox-animation.json (trim + ellipses + fills/strokes) and asserts non-blank + animates — passes on Skia, WebGPU, and Skottie (renderer-agnostic), so managed trim matches the Skottie oracle. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ndow A SaveLayer offscreen (opacity-isolation, colour-matrix, and especially the drop-shadow fallback for gradient/image-filled cards) allocated and rendered into a FULL-WINDOW surface even for a small card — wasting memory and fill every frame. Size it to the layer's visible device bounds instead. The surface is now rebased through the NDC basis: added _basisOx/Oy/W/H on WebGpuPresentSession; Ndc(), WriteXform() (path-fill projection), TryScissor() + the widenable-scissor widen, and finvMap()'s translation (clip/gradient fragment coords, folded in FillClipU) all map absolute device space into the layer's sub-rect. RenderInto carries the basis (default = target/window, identity) and saves/restores it around nested layers. The composite samples the smaller texture by framebuffer position (params.z + m0 = offset,size). Cached recordings (frame-solid/arena/compiled caches) bake window-space coordinates keyed on the recording, so under a sub-surface they are rebuilt fresh and uncached via the basis-aware immediate path (main-window path untouched). Gated to mode-0 layers (SrcOver / drop shadow), no colour-matrix, no backdrop, no nested layer; mask/matrix/backdrop keep the full-size surface. UNO_WEBGPU_NO_SUBLAYER=1 forces the old full-window path (escape hatch + A/B). Correctness validated headlessly (lavapipe): a gradient ThemeShadow card renders BYTE-IDENTICAL to the full-window path (sub-rect ON vs OFF, RMS 0.000000); the broad WebGPU suite (conformance/gradient/effect/container/ border) is ON==OFF across 52 tests; new Given_DrawingBackend_Conformance. When_Shadow_Layer 9/9 on Skia + WebGPU (sub-rect on/off). Even on software, the smaller offscreens already help (Dashboard 13.1 vs 10.9 fps); the real memory-bandwidth win is on GPU, to be measured on hardware. Co-Authored-By: Claude Opus 4.8 <[email protected]>
2c7474d to
8565f65
Compare
|
|
|
The build 231940 found UI Test snapshots differences: Details
|
CreateBlendModeColorFilter took a BlendMode, but only SrcIn was ever passed (one caller: CompositionSurfaceBrush's monochrome tint) and only SrcIn was ever honored. Skia mapped the full set; WebGPU pattern-matched SrcIn and fell through to "untinted" for anything else, with no log. So a second caller passing any other mode would have rendered on Skia and silently dropped on WebGPU. Replace it with CreateTintColorFilter(Color): SrcIn is the contract, so there is no mode to disagree about. WebGpuColorFilter loses its now-dead Mode field and IsBlendMode becomes IsTint. BlendMode itself is unchanged and keeps all 26 members - the audit found every one of them is emitted by EffectGraphParser from user XAML and mapped by both backends, so none is dead. It is now documented as the EFFECT seam's enum, with a pointer away from colour filters, and its group comments no longer imply an exclusivity that never held (SrcIn was used by both paths). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
DrawImage took an ImageSampling, and WebGPU silently discarded it: the argument was never stored on ImageCmd and the backend has a single sampler hard-wired to Linear (WebGpuDevice.cs). Skia mapped it to SKFilterMode.Linear/Nearest, so the two backends sampled differently. It happened to be invisible. Of the eight call sites, seven pass Linear and the one NearestNeighbor caller (SkiaAcrylicBrush's noise tiling) steps by exactly texture.PixelWidth/PixelHeight - at 1:1 with pixel-aligned placement linear and nearest sample the same texel centres, so the outputs agree. The parameter was an optimization hint at a scale where it has no effect, not a rendering requirement. Rather than implement it (a second sampler, a command field and a bind-group variant to change no pixels), remove it: a backend picks its own filtering, which is correct for all eight callers. The acrylic loop keeps the intent as a comment - the tiling must stay 1:1, because drawing that noise scaled would filter it into mush whatever the backend chooses. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
The build 231961 found UI Test snapshots differences: Details
|
70ebacc to
6789ab0
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24153/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24153/docs/index.html |
|
The build 235366 found UI Test snapshots differences: Details
|
|
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. |
Since #24153 text was filled as glyph outline paths, skipping the glyph cache and scaler hinting: 10-40x slower and blurry at small sizes. Skia sessions now draw glyph runs as text blobs; other backends keep the outline path. On Windows, grayscale edging matches DirectWrite. Fixes #24652 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WHQGrdpD7nu5qU71pqPwiC
BREAKING CHANGE: `--renderer` now accepts `skia` (default) or `webgpu`. `native` stays removed. `--renderer webgpu` adds the `WebGpu` UnoFeature next to `SkiaRenderer`, so Uno.Sdk references Uno.WinUI.Composition.WebGpu (unoplatform/uno#24153) and the runtime negotiates the drawing backend. The Skia backend stays included as the fallback. - unoapp/unolib template.json: add the `webgpu` choice and a `useWebGpuRenderer` computed symbol. - MyExtensionsApp.1.csproj / CrossTargetedLibrary.csproj: emit `WebGpu;` when `useWebGpuRenderer` is set. - TemplateWizard.json: bring back the renderer single-select in Features, with a `renderer.webgpu` entry that reuses the Skia rendering icon. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013vMq8j2sEJeY54EXxrzAiE
Since #24153 text was filled as glyph outline paths, skipping the glyph cache and scaler hinting: 10-40x slower and blurry at small sizes. Skia sessions now draw glyph runs as text blobs; other backends keep the outline path. On Windows, grayscale edging matches DirectWrite. Fixes #24652 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WHQGrdpD7nu5qU71pqPwiC
BREAKING CHANGE: `--renderer` now accepts `skia` (default) or `webgpu`. `native` stays removed. `--renderer webgpu` adds the `WebGpu` UnoFeature next to `SkiaRenderer`, so Uno.Sdk references Uno.WinUI.Composition.WebGpu (unoplatform/uno#24153) and the runtime negotiates the drawing backend. The Skia backend stays included as the fallback. - unoapp/unolib template.json: add the `webgpu` choice and a `useWebGpuRenderer` computed symbol. - MyExtensionsApp.1.csproj / CrossTargetedLibrary.csproj: emit `WebGpu;` when `useWebGpuRenderer` is set. - TemplateWizard.json: bring back the renderer single-select in Features, with a `renderer.webgpu` entry that reuses the Skia rendering icon. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013vMq8j2sEJeY54EXxrzAiE
BREAKING CHANGE: `--renderer` now accepts `skia` (default) or `webgpu`. `native` stays removed. `--renderer webgpu` adds the `WebGpu` UnoFeature next to `SkiaRenderer`, so Uno.Sdk references Uno.WinUI.Composition.WebGpu (unoplatform/uno#24153) and the runtime negotiates the drawing backend. The Skia backend stays included as the fallback. - unoapp/unolib template.json: add the `webgpu` choice and a `useWebGpuRenderer` computed symbol. - MyExtensionsApp.1.csproj / CrossTargetedLibrary.csproj: emit `WebGpu;` when `useWebGpuRenderer` is set. - TemplateWizard.json: bring back the renderer single-select in Features, with a `renderer.webgpu` entry that reuses the Skia rendering icon. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013vMq8j2sEJeY54EXxrzAiE
GitHub Issue: closes unoplatform/RnD#41
PR Type:
✨ Feature
What changed? 🚀
Introduces a pluggable drawing-backend abstraction for the Skia rendering targets, so the renderer and the content engines behind it are selectable seams instead of a hard SkiaSharp dependency. Design doc:
doc/uno-drawing-backend-abstraction.md.Architecture
Uno.UI.Composition.Drawing): backend-neutral contracts —IGraphicsProvider/IDrawingFactory(renderer negotiation over host-provided swapchain contexts),IGeometry/IGeometryFactory,IFontProvider,IImageEncoderDecoder,ISvgRenderer, retained command lists (IRenderRecord) and damage-region plumbing.Uno.UI.Composition.Skia): the existing SkiaSharp renderer, repackaged as one registerable backend and still the default when referenced.Uno.UI.Composition.WebGpu/.Init): a new renderer over wgpu-native (Dawn on the browser) — analytic rounded-rect/ring clips evaluated in-shader, stencil-mask path clips, frame-solid coalescing, damage-clipped presents. Opt-in viaUNO_WEBGPU=1, backend/present-mode knobs viaUNO_WEBGPU_BACKENDS/UNO_WEBGPU_PRESENT.Uno.UI.Composition.Managed): geometry (flatten/combine/stroke), font loading/shaping, image decode, and SVG — enabling fully SkiaSharp-free heads (UnoDrawingBackendSkia=false).UnoPlatformHostBuilder.GraphicsBackend(...)/.GeometryFactory(...)/.FontProvider(...)/.ImageEncoderDecoder(...)/.SvgRenderer(...), with Skia light-up preserved when the Skia backend is referenced.Measured (Intel UHD 620, maximized 1920×1009, damage regions disabled so every frame pays full render cost)
Performance_1000ButtonsContinuousRenderingn=1000, uncapped: WebGPU 57.8 avg / 50.2 min fps vs Skia 51.7 / 5.3.SkiaSharp.dll/libSkiaSharploaded (managed fonts/images/SVG/geometry).PR Checklist ✅
Screenshots Compare Test Runresults.Breaking changes
This branch intentionally carries coordinated breaking changes; libraries compiled against earlier packages need a rebuild:
DependencyObjectbecomes a class on Skia targets (was an interface). Prebuilt libraries with types directly implementing the old interface fail withTypeLoadExceptionuntil recompiled (validated: Uno.Toolkit, Uno.Themes/Material/Cupertino rebuild with minor source fixes — generic constraintswhere T : class, DependencyObject→where T : DependencyObject).Uno.UI(Uno.UI.Lottieassembly removed); a type-forwarding facade restores binary compatibility for existing consumers and can be shipped if needed.Style.RegisterDefaultStyleForType(Type, IXamlResourceDictionaryProvider, bool isNative)was removed; this PR restores it as a binary-compat shim (native registrations are ignored).Validation
eb88258652;Given_Borderre-run after the shared clip changes (27 tests, 0 failures).🤖 Generated with Claude Code