Skip to content

feat!: Move to SkiaSharp 4.148 and Enable Vulkan by default - #23598

Merged
ramezgerges merged 10 commits into
unoplatform:feature/breakingchangesfrom
ramezgerges:feature/vulkan-default-skiasharp-4148
Jul 8, 2026
Merged

ramezgerges merged 10 commits into
unoplatform:feature/breakingchangesfrom
ramezgerges:feature/vulkan-default-skiasharp-4148

Conversation

@ramezgerges

@ramezgerges ramezgerges commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue: closes https://github.com/unoplatform/uno-private/issues/2156

PR Type:

What changed? 🚀

PR Checklist ✅

@github-actions github-actions Bot added 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 area/solution-templates Categorizes an issue or PR as relevant to the solution template area/skia ✏️ Categorizes an issue or PR as relevant to Skia area/build Categorizes an issue or PR as relevant to build infrastructure area/automation Categorizes an issue or PR as relevant to project automation kind/documentation platform/x11 🐧 Categorizes an issue or PR as relevant to X11 labels Jun 29, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 220164 did not find any UI Test snapshots differences.

@unodevops

Copy link
Copy Markdown
Contributor

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

@MartinZikmund MartinZikmund left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

May need a follow up uno.templates PR for skiasharp update, will create some 7.0 feature branch there

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 220430 did not find any UI Test snapshots differences.

@unodevops

Copy link
Copy Markdown
Contributor

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

@ramezgerges
ramezgerges force-pushed the feature/vulkan-default-skiasharp-4148 branch from 7fafc3b to 79c11f2 Compare July 2, 2026 18:03
@github-actions github-actions Bot added the area/sdk Categorizes an issue or PR as relevant to the Uno.Sdk label Jul 2, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 220539 did not find any UI Test snapshots differences.

@unodevops

Copy link
Copy Markdown
Contributor

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

ajpinedam pushed a commit to ajpinedam/uno that referenced this pull request Jul 6, 2026
Fixes: unoplatform#23159

Context: dotnet/runtime#4538 (comment)
Context: https://github.com/unoplatform/uno/blob/ffbb0c0ed47679ede7c67effaa979e7a9934ed33/doc/articles/controls/WebView.md?plain=1#L198-L206

Use of WebView2 on Linux Wayland requires that the `GDK_BACKEND`
environment variable be set, lest Bad Things Happen™.

On the ignorable side, the bad things are simply messages written
to stdout.  For example, build and run SamplesApp.Skia.Generic:

	dotnet build -c Release -f net10.0 src/SamplesApp/SamplesApp.Skia.Generic/SamplesApp.Skia.Generic.csproj
	LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libfreetype.so.6.20.1 \
	  dotnet src/SamplesApp/SamplesApp.Skia.Generic/bin/Release/net10.0/SamplesApp.Skia.Generic.dll

(The $LD_PRELOAD is needed to avoid [a *different* problem][0], which
should get fixed by updating SkiaSharp; see unoplatform#23598.)

Once SamplesApp.Skia.Generic has launched:

 1. Click the "checkbox list" icon on the top-left to show the
    RuntimeTests panel.
 2. In the "Enter test filter here" textbox, enter
    `When_ExecuteScriptAsync`.
 3. Click the ▶️ Run button

Console output will contain messages such as:

	(SamplesApp.Skia.Generic:25303): Gdk-CRITICAL **: 09:20:32.946: gdk_x11_window_get_xid: assertion 'GDK_IS_X11_WINDOW (window)' failed
	…
	fail: Uno.UI.WebView.Skia.X11.X11NativeWebView[0]
	      SetScrollingEnabled is not supported on the X11 target.
	…
	warn: Uno.WinUI.Runtime.Skia.X11.X11ApplicationHost[0]
	      X11 protocol error — ErrorCode: 3, RequestCode: X_UnmapWindow, MinorCode: 0, ResourceId: 0x0, Serial: 428

However, the tests *pass* and the app *doesn't crash*.

Enter unoplatform#23159: if we build Uno.Gallery for *Native AOT* and hit the
WebView2 logic, we see the same `Gdk-CRITICAL` message, *and also*
these messages:

	fail: Uno.WinUI.Runtime.Skia.X11.X11NativeOverlappedPresenter[0]
	      Couldn't get OverlappedPresenterState: _NET_WM_STATE does not exist on the window. Make sure you use an EWMH-compliant WM.
	fail: Uno.WinUI.Runtime.Skia.X11.X11NativeOverlappedPresenter[0]
	      Couldn't get OverlappedPresenterState: _NET_WM_STATE does not exist on the window. Make sure you use an EWMH-compliant WM.

followed by a *hard crash*:

	(Uno.Gallery:8586): Gdk-CRITICAL **: 14:46:16.851: gdk_x11_window_get_xid: assertion 'GDK_IS_X11_WINDOW (window)' failed
	X Error of failed request:  BadWindow (invalid Window parameter)
	  Major opcode of failed request:  3 (X_GetWindowAttributes)
	  Resource id in failed request:  0x0
	  Serial number of failed request:  103
	  Current serial number in output stream:  104

The workaround for this, as documented in
`doc/articles/controls/WebView.md`, is to export the `GDK_BACKEND`
environment variable to `x11`:

	export GDK_BACKEND=x11
	dotnet …

This works, but requires reading documentation (who does that?!).

The ideal fix would be to have `X11NativeWebProvider` export the
environment variable during app startup.  The problem is that the
"obvious" way to do this:

	Environment.SetEnvironmentVariable("GDK_BACKEND", "x11");

[*does not work*][1]

> we will not support the case where a user wants to modify the
> environment from managed code and expects to see those changes
> reflected in a native library they PInvoke to, or vice versa.

Since we *need* native code in `libgdk*` et al to see the
`GDK_BACKEND` environment variable, we can't use
`Environment.SetEnvironmentVariable()` to do so.

Instead, P/Invoke into **setenv**(3).  This allows us to set the
`GDK_BACKEND` environment variable on the native side, allowing
`libdk*` et al to see the value we set and behave accordingly.

With this fix in place, `SamplesApp.Skia.Generic.dll` no longer
produces the `Gdk-CRITICAL` or X11 protocol error messages.

[0]: unoplatform#20532 (comment)
[1]: dotnet/runtime#4538 (comment)
ramezgerges and others added 7 commits July 7, 2026 21:09
Bump SkiaSharp 3.119.0 -> 4.148.0 and HarfBuzzSharp 8.3.1.1 -> 14.2.0
across central versioning, nuspecs, solution template, test apps, the
macOS native dylib fetch script, add-in error messages and docs.

SkiaSharp 4 deprecates the mutable SKPath API (and a few SKCanvas /
SKTypeface members) in favor of the immutable SKPathBuilder / SKFont /
SKSamplingOptions APIs. Uno's renderer intentionally relies on the
mutable, poolable SKPath (per-frame Rewind/Op/Transform reuse), so the
deprecation is suppressed with a documented, greppable per-file
"#pragma warning disable CS0618" instead of being rewritten. The
SKPathBuilder rearchitecture is deferred to dedicated, benchmarked work.

BREAKING CHANGE: SkiaSharp is bumped to the 4.148 (milestone-148)
versioning scheme; consumers pinning SkiaSharp/HarfBuzzSharp must align.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Flip the default of UseVulkanOnWin32, UseVulkanOnX11 and
UseVulkanOnSkiaAndroid to true. Each rendering path already falls back to
OpenGL/OpenGL ES and then software when Vulkan is unavailable, so the new
default degrades gracefully. Update the Win32/X11 RenderingBackend.Default
enum docs to reflect the Vulkan-first order.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Replace the temporary CS0618 pragma suppressions with a real migration to
the SkiaSharp 4 immutable path model:

- Path construction/mutation now goes through SKPathBuilder; the built path
  is obtained via Detach() (fresh) or Snapshot() (copy). Pooled/reusable
  paths pool the builder and Reset() it between uses.
- Surviving SKPath operations (Op, Transform, Offset, Reset) are kept; only
  the deprecated construction methods are moved off. Rewind() -> Reset().
- The renderer's clip plumbing keeps its out-param/scratch signatures: a
  Transform(identity, dst) helper (CopyPath/SetPathToRect) overwrites an
  existing path with an exact copy, replacing the deprecated dst.AddPath/
  AddRect re-seeding while preserving verbs and fill type.
- SKPaint.GetFillPath now fills an SKPathBuilder; SKCanvas.DrawBitmap/
  DrawImage take SKSamplingOptions; SKCanvas.DrawText takes SKTextAlign;
  SKTypeface.ContainsGlyph -> SKFont.ContainsGlyph.

Builds clean (0 warnings/errors, TreatWarningsAsErrors) for the full
SamplesApp.Skia.Generic plus the Win32 and X11 hosts.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
When a resolved typeface is a variable font (exposes OpenType variation
axes), instantiate it at the requested style via SKTypeface.Clone with an
SKFontArguments variation position, mapping the WinUI font properties onto
the standard axes:
- wght <- FontWeight.Weight (exact numeric weight, e.g. 350/650)
- wdth <- FontStretch (as a width percentage)
- ital <- FontStyle.Italic
- slnt <- FontStyle.Italic/Oblique

Values are clamped to each axis' supported range and axes already at their
default are left untouched; static fonts are returned unchanged. This lets
a single variable font render arbitrary weights/widths instead of snapping
to the nearest static instance. Per-style results stay cached by the
existing FontDetailsCache key.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Use the typeface introspection added in SkiaSharp 4 when resolving fonts:

- Honor the "<file-uri>#<family name>" hint for embedded fonts. When the
  file is a TrueType/OpenType collection (.ttc/.otc), probe its faces and
  pick the one whose family or PostScript name matches the hint instead of
  always loading face 0. The default (no hint / single face) path is
  unchanged and streams directly; probing only happens when face 0 doesn't
  match, reading the data back via SKTypeface.OpenStream/SKStream.GetData,
  and is bounded to guard malformed files.
- Treat an empty typeface (SKTypeface.IsEmpty) from FromFamilyName the same
  as null so resolution falls back to the default font.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Replace the CopyPath helper with inline src.Transform(SKMatrix.Identity, dst)
  and share a single CreateRectPath from SkiaExtensions (was duplicated in Visual
  and SkiaRenderHelper); drop the SetPathToRect indirection and a dead Reset() +
  redundant transform on the native-clip path.
- Use SKSamplingOptions.Default instead of default(SKSamplingOptions) on the
  DrawBitmap/DrawImage calls.
- Draw the sample's rounded rect with DrawRoundRect instead of building a path.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
- Select collection faces by probing the font's own SKData; SKTypeface.OpenStream
  ().GetData() returns null here, so the previous approach never found sub-faces
  and every "#family" hint fell back to face 0.
- Carry the face's collection index in SKFontArguments when cloning; otherwise
  Clone() silently drops the weight/width variation for any non-first face.
- Cache loaded font data per source uri so a new FontWeight of the same file
  resolves synchronously instead of momentarily rendering the default font
  (flicker when animating weight on a variable font).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
ramezgerges and others added 2 commits July 7, 2026 21:09
Adds a Fonts sample that loads two families (Inter + Bitter) from a single .ttc
via the "#family" hint and sweeps the wght axis, exercising collection face
selection and variable-weight rendering. Bundles the OFL-licensed collection and
its license.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
The Android CoreCLR/NativeAOT Skia publish steps hardcoded the old
3.119.2-preview.1 SkiaSharp version, so they still compiled against the
pre-migration API (SKPath construction, 5-arg DrawBitmap) and failed.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@ramezgerges
ramezgerges force-pushed the feature/vulkan-default-skiasharp-4148 branch from 4bb1caf to cace064 Compare July 8, 2026 01:15
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 221210 found UI Test snapshots differences: skia-linux-screenshots: 0, skia-windows-screenshots: 2364

Details
  • skia-linux-screenshots: 0 changed over 2366

  • skia-windows-screenshots: 2364 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedVisualsTestbedPage.png
    • Attributed_text_Simple.png
    • AutoBorderStretchwithtopmargin.png
    • AutoSuggestBox_BitmapIcon.png
    • Basics_Automated.png-dark
    • BindableDrawerLayout_ChangePane.png
    • BorderCenteredwithmargins.png
    • BorderRightwithmargins.png-dark
    • Border_BorderThickness.png
    • Border_Clipped_Change_Property.png-dark
    • Border_Corner_Overlap.png-dark
    • Border_Corner_Overlap.png
    • Border_With_TranslateTransform.png-dark
    • Border_With_TranslateTransform.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • CheckBox_States.png-dark
    • CheckBox_States.png
    • ComboBox_CornerRadius.png-dark
    • ComboBox_CornerRadius.png

@unodevops

Copy link
Copy Markdown
Contributor

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

When_Negative_Margin_Should_Not_Clip asserted exact ellipse pixel bounds.
With SkiaSharp 4.148 and the now-default Vulkan GPU backend, the ellipse's
anti-aliased core shifts by a couple of pixels per rasterizer, so the exact
bounds are no longer portable across CI platforms. Assert the red (ellipse)
bounds with a 3px tolerance instead; a real clip removes the ~4px top/right
overflow, which still exceeds the tolerance. Rectangle bounds (purple,
yellow) stay exact.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@ramezgerges
ramezgerges force-pushed the feature/vulkan-default-skiasharp-4148 branch from cace064 to 56b58be Compare July 8, 2026 14:35
@unodevops

Copy link
Copy Markdown
Contributor

@ramezgerges
ramezgerges enabled auto-merge July 8, 2026 15:17
@nventive-devops

Copy link
Copy Markdown
Contributor

The build 221285 found UI Test snapshots differences: skia-linux-screenshots: 0, skia-windows-screenshots: 2364

Details
  • skia-linux-screenshots: 0 changed over 2366

  • skia-windows-screenshots: 2364 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AppWindowTitleBar Properties.png-dark
    • AuthenticationBroker_Demo.png
    • AutomationProperties_AutomationId.png-dark
    • AutoSuggestBox_Reason.png-dark
    • BasicAutoSuggestBox.png-dark
    • BasicThemeResources.png
    • BindableDrawerLayout_ChangePane.png
    • BorderBottomwithmargins.png
    • BorderCenteredwithmargins.png-dark
    • Border_AntiAlias.png-dark
    • Border_AntiAlias.png
    • Border_CornerRadius_Gradient.png-dark
    • Border_CornerRadius_Gradient.png
    • Border_With_Off_Centre_RotateTransform.png-dark
    • Border_With_Off_Centre_RotateTransform.png
    • Button_Inside_Border.png-dark
    • Button_Inside_Border.png
    • Capture with overlap.png-dark
    • Capture with overlap.png

@ramezgerges
ramezgerges merged commit 007a5c2 into unoplatform:feature/breakingchanges Jul 8, 2026
69 checks passed
@ramezgerges
ramezgerges deleted the feature/vulkan-default-skiasharp-4148 branch July 8, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/build Categorizes an issue or PR as relevant to build infrastructure area/sdk Categorizes an issue or PR as relevant to the Uno.Sdk area/skia ✏️ Categorizes an issue or PR as relevant to Skia area/solution-templates Categorizes an issue or PR as relevant to the solution template kind/documentation 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/x11 🐧 Categorizes an issue or PR as relevant to X11

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants