Repository navigation
fix(skia): Restore Compositor.IsSoftwareRenderer - #23895
ramezgerges merged 1 commit into
Conversation
Every Skia render backend now sets IsSoftwareRenderer when it selects its renderer (including GPU-init fallback paths), so effect brushes, SkiaAcrylicBrush and CompositionCapabilities.AreEffectsFast() see an accurate value again. The setters were dropped when rendering moved to the record/replay architecture (b96ad06), leaving the flag null (treated as hardware) everywhere. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
Pull request overview
Restores correct population of Compositor.IsSoftwareRenderer across Skia backends so effect-brush recording can choose CPU-vs-GPU-compatible filter paths, and adds a runtime test to ensure the flag is no longer left null on Skia targets.
Changes:
- Set
Compositor.GetSharedCompositor().IsSoftwareRendererduring renderer/backend selection across Win32, X11, macOS, WASM, Linux framebuffer, Android, and Apple UIKit Skia hosts. - Document the intended contract/semantics of
Compositor.IsSoftwareRendererinCompositor.skia.cs. - Add a Skia-only runtime test asserting the flag is populated.
Review summary (current):
- Blocking issues: 1
- Non-blocking issues: 0
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Composition/Given_Compositor.cs | Adds Skia-only runtime test asserting IsSoftwareRenderer is populated. |
| src/Uno.UI.Runtime.Skia.X11/Hosting/X11XamlRootHost.cs | Sets IsSoftwareRenderer after the X11 renderer fallback/selection completes. |
| src/Uno.UI.Runtime.Skia.Win32/UI/Xaml/Window/Win32WindowWrapper.cs | Sets IsSoftwareRenderer based on the selected Win32 renderer. |
| src/Uno.UI.Runtime.Skia.WebAssembly.Browser/Rendering/BrowserRenderer.cs | Sets IsSoftwareRenderer based on WebGL vs software backend selection. |
| src/Uno.UI.Runtime.Skia.MacOS/Hosting/MacSkiaHost.cs | Sets IsSoftwareRenderer after RenderSurfaceType is resolved. |
| src/Uno.UI.Runtime.Skia.Linux.FrameBuffer/Hosting/FramebufferHost.cs | Sets IsSoftwareRenderer after DRM/software renderer selection. |
| src/Uno.UI.Runtime.Skia.AppleUIKit/Rendering/UnoSKMetalView.cs | Sets IsSoftwareRenderer = false for Metal-backed rendering. |
| src/Uno.UI.Runtime.Skia.Android/Rendering/UnoSKVulkanView.cs | Sets IsSoftwareRenderer = false for Vulkan-backed rendering. |
| src/Uno.UI.Runtime.Skia.Android/Rendering/UnoSKCanvasView.cs | Sets IsSoftwareRenderer based on whether the Android Skia path is CPU-rasterized. |
| src/Uno.UI.Composition/Composition/Compositor.skia.cs | Adds documentation clarifying the IsSoftwareRenderer contract. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23895/wasm-skia-net9/index.html |
|
The build 224538 found UI Test snapshots differences: Details
|
ajpinedam
left a comment
There was a problem hiding this comment.
My only comment/concern is that when a new platform/host is added this might get forgotten and will default to false.
|
To cover this, the PR includes a runtime test that will fail if the property is unset. |
…#23736, unoplatform#23844 Restores unoplatform#23736 (WSLg's XWM re-detaches subwindows without override-redirect set via XSetWindowAttributes, plus a best-effort post-reparent ownership check) and unoplatform#23844 (frame pacer created before the DPI read that spins up DisplayInformation; icon decoding offloaded per-icon instead of racing DisplayInformation creation off the UI thread). unoplatform#23895's Compositor.IsSoftwareRenderer line was already covered by the branch's own GraphicsContextKind-based assignment - the duplicate line from the merge was dropped. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XsQppKuZgijApgJxaTZt81
The branch kept the property but dropped the doc comment master added with it. Restored verbatim. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01XsQppKuZgijApgJxaTZt81
GitHub Issue: closes #23896
PR Type:
🐞 Bugfix
What changed? 🚀
Compositor.IsSoftwareRendererhas been permanentlynullsince the rendering refactor to the record/replay architecture (b96ad06) dropped the per-paint setters, so every consumer —CompositionEffectBrush,SkiaAcrylicBrush,CompositionCapabilities.AreEffectsFast()— has been treating all targets as hardware-rendered, even when the scene is rasterized on the CPU. OnlyRenderTargetBitmapstill set it, temporarily, around software re-records.This PR makes every Skia backend set the flag at the point it commits to a renderer, including GPU-init fallback paths:
Win32WindowWrapperafter the Vulkan → OpenGL → Software cascadeIRenderer.IsSoftware()(previously unconsumed)X11XamlRootHostafter the Vulkan → GLX/EGL → Software cascaderenderer is X11SoftwareRendererMacSkiaHost.InitializeMaconceRenderSurfaceTyperesolvesRenderSurfaceType == SoftwareBrowserRendererctor after WebGL/Software selectionrenderer is SoftwareBrowserRendererFrameBufferHostafter DRM/Software selectionrenderer is SoftwareRendererUnoSKCanvasViewctor!UseOpenGLOnSkiaAndroid— the scene is CPU-rasterized then blitted through GL, so it reports softwareUnoSKVulkanViewctorfalseUnoSKMetalViewctor after Metal context creationfalse(Metal-only)The flag matters at SKPicture recording time on the UI thread (effect brushes consult it to generate filters the target surface can rasterize), so setting it once at renderer selection is sufficient — renderer choice is fixed after startup on all backends. The
bool?type andRenderTargetBitmap's save/restore semantics are preserved, and the property now carries doc comments describing the contract.Also adds a runtime test asserting the flag is populated on all Skia targets (fails before this change everywhere, passes after).
PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code