Skip to content

fix(skia): Restore Compositor.IsSoftwareRenderer - #23895

Merged
ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:dev/rara/compositor-issoftwarerenderer
Jul 29, 2026
Merged

ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:dev/rara/compositor-issoftwarerenderer

Conversation

@ramezgerges

@ramezgerges ramezgerges commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #23896

PR Type:

🐞 Bugfix

What changed? 🚀

Compositor.IsSoftwareRenderer has been permanently null since 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. Only RenderTargetBitmap still 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:

Backend Set where Value
Win32 Win32WindowWrapper after the Vulkan → OpenGL → Software cascade existing IRenderer.IsSoftware() (previously unconsumed)
X11 X11XamlRootHost after the Vulkan → GLX/EGL → Software cascade renderer is X11SoftwareRenderer
macOS MacSkiaHost.InitializeMac once RenderSurfaceType resolves RenderSurfaceType == Software
WASM BrowserRenderer ctor after WebGL/Software selection renderer is SoftwareBrowserRenderer
Linux FrameBuffer FrameBufferHost after DRM/Software selection renderer is SoftwareRenderer
Android (GL) UnoSKCanvasView ctor !UseOpenGLOnSkiaAndroid — the scene is CPU-rasterized then blitted through GL, so it reports software
Android (Vulkan) UnoSKVulkanView ctor false
Apple UIKit UnoSKMetalView ctor after Metal context creation false (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 and RenderTargetBitmap'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 ✅

🤖 Generated with Claude Code

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]>
Copilot AI review requested due to automatic review settings July 28, 2026 15:23
@github-actions github-actions Bot added platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform area/skia ✏️ Categorizes an issue or PR as relevant to Skia platform/x11 🐧 Categorizes an issue or PR as relevant to X11 labels Jul 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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().IsSoftwareRenderer during renderer/backend selection across Win32, X11, macOS, WASM, Linux framebuffer, Android, and Apple UIKit Skia hosts.
  • Document the intended contract/semantics of Compositor.IsSoftwareRenderer in Compositor.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.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 224538 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2348, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • ClipboardTests.png-dark
    • Buttons.png
    • ButtonClippingTestsControl.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • ImageIconPage.png-dark
    • ContextRequested.png-dark
    • ContextRequested.png
    • DisplayInformation.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Examples.png-dark
  • skia-windows-screenshots: 2348 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppBarButtonTest.png-dark
    • AndroidWindowInsets.png-dark
    • ApplicationViewSpanningRectsPage.png
    • Attributed_text_FontSize_Changing.png-dark
    • Arrange_Performance01.png-dark
    • AutomationPropertiesExtensions_Role.png
    • Attributed_text_Supserscript.png-dark
    • AutoSuggestBox_Keyboard.png
    • AutomationPropertiesExtensions_Role.png-dark
    • Basics_Automated.png
    • AutoSuggestBox_BitmapIcon.png-dark
    • BindableDrawerLayout_ChangePane.png
    • BasicEnability.png
    • BorderBottomwithmargins.png
    • BitmapIcon_Generic.png
    • BorderTopwithmargins.png-dark
    • BorderRightwithmargins.png-dark
    • Border_CornerRadius.png
    • BorderRightwithmargins.png
    • Border_CornerRadius_Alignments.png-dark
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools

@ajpinedam ajpinedam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only comment/concern is that when a new platform/host is added this might get forgotten and will default to false.

@ramezgerges

Copy link
Copy Markdown
Contributor Author

To cover this, the PR includes a runtime test that will fail if the property is unset.

@ramezgerges
ramezgerges merged commit be3f8f6 into unoplatform:master Jul 29, 2026
47 checks passed
@ramezgerges
ramezgerges deleted the dev/rara/compositor-issoftwarerenderer branch July 29, 2026 14:07
MartinZikmund added a commit to ramezgerges/uno that referenced this pull request Sep 21, 2026
…#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
MartinZikmund added a commit to ramezgerges/uno that referenced this pull request Sep 21, 2026
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
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 platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform platform/x11 🐧 Categorizes an issue or PR as relevant to X11

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Skia] Compositor.IsSoftwareRenderer is never set, so CompositionCapabilities.AreEffectsFast() is always true

5 participants