Add native Graphite views and samples - #4734
Conversation
Expose deferred canvases, Vulkan synchronization and texture-state primitives, and 64-bit-safe external handles independently of any view implementation.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 00cda8ff-9603-406f-ae2e-45c70e39b3e7
Carve the reviewed native Graphite views package from the combined Graphite views work and add direct native Basic samples for Android, iOS, Mac Catalyst, macOS, and tvOS. Gate Android below API 24 and keep the sample render loops lifecycle-aware and failure-reporting. Related: #4721 Requires: #4729 Requires: mono/skia#345 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: dd83f08e-1222-4b30-b315-1a5c2103463a
📦 Try the packages from this PRWarning Do not run these scripts without first reviewing the code in this PR. Step 1 — Download the packages bash / macOS / Linux: curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 4734PowerShell / Windows: iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4734"Step 2 — Add the local NuGet source dotnet nuget add source ~/.skiasharp/hives/pr-4734/packages --name skiasharp-pr-4734More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-4734 |
|
📖 Documentation Preview The documentation for this PR has been deployed and is available at: 🔗 View Staging Site This preview will be updated automatically when you push new commits to this PR. This comment is automatically updated by the documentation staging workflow. |
📊 SkiaSharp benchmarks — PR #4734⭐ this PR (full source build) vs 🌙 nightly · Linux · Windows · macOS
Highlights⏱️ Time — 🔴 39 slower · 🟢 52 faster
📦 Allocations — 🔴 1 more alloc · 🟢 0 less alloc
Full per-OS benchmark deltasLinux⏱️ Time (vs 🌙 nightly
📦 Allocations (vs 🌙 nightly
Windows⏱️ Time (vs 🌙 nightly
macOS⏱️ Time (vs 🌙 nightly
|
|
This is the middle layer of the split.
|
📦 Artifact size reportPackages from this PR (build Total Packages
+36 package(s) unchanged (< 50.0 KB). Per-file changes
|
| File | Size |
|---|---|
lib/net462/SkiaSharp.dll |
862.0 KB → 872.0 KB (🔴 +10.0 KB) |
lib/net48/SkiaSharp.dll |
862.0 KB → 871.5 KB (🔴 +9.5 KB) |
lib/net10.0-android36.0/SkiaSharp.dll |
534.0 KB → 540.5 KB (🔴 +6.5 KB) |
lib/net10.0-ios26.0/SkiaSharp.dll |
536.5 KB → 543.0 KB (🔴 +6.5 KB) |
lib/net10.0-maccatalyst26.0/SkiaSharp.dll |
536.5 KB → 543.0 KB (🔴 +6.5 KB) |
lib/net10.0-tvos26.0/SkiaSharp.dll |
536.5 KB → 543.0 KB (🔴 +6.5 KB) |
lib/net6.0/SkiaSharp.dll |
510.0 KB → 516.5 KB (🔴 +6.5 KB) |
lib/net9.0-android35.0/SkiaSharp.dll |
534.0 KB → 540.5 KB (🔴 +6.5 KB) |
lib/net9.0-ios18.0/SkiaSharp.dll |
536.5 KB → 543.0 KB (🔴 +6.5 KB) |
lib/net9.0-maccatalyst18.0/SkiaSharp.dll |
536.5 KB → 543.0 KB (🔴 +6.5 KB) |
lib/net9.0-tvos18.0/SkiaSharp.dll |
536.5 KB → 543.0 KB (🔴 +6.5 KB) |
lib/netstandard2.1/SkiaSharp.dll |
514.0 KB → 520.5 KB (🔴 +6.5 KB) |
lib/net10.0-macos26.0/SkiaSharp.dll |
536.5 KB → 542.5 KB (🔴 +6.0 KB) |
lib/net10.0-tizen10.0/SkiaSharp.dll |
554.0 KB → 560.0 KB (🔴 +6.0 KB) |
lib/net10.0-windows10.0.19041/SkiaSharp.dll |
539.0 KB → 545.0 KB (🔴 +6.0 KB) |
lib/net10.0/SkiaSharp.dll |
538.0 KB → 544.0 KB (🔴 +6.0 KB) |
lib/net6.0-tizen8.0/SkiaSharp.dll |
527.0 KB → 533.0 KB (🔴 +6.0 KB) |
lib/net9.0-macos15.0/SkiaSharp.dll |
536.5 KB → 542.5 KB (🔴 +6.0 KB) |
lib/net9.0-tizen8.0/SkiaSharp.dll |
554.0 KB → 560.0 KB (🔴 +6.0 KB) |
lib/net9.0-windows10.0.19041/SkiaSharp.dll |
539.0 KB → 545.0 KB (🔴 +6.0 KB) |
lib/net9.0/SkiaSharp.dll |
538.0 KB → 544.0 KB (🔴 +6.0 KB) |
lib/netstandard2.0/SkiaSharp.dll |
518.0 KB → 524.0 KB (🔴 +6.0 KB) |
ref/net462/SkiaSharp.dll |
470.0 KB → 475.0 KB (🔴 +5.0 KB) |
ref/net48/SkiaSharp.dll |
470.0 KB → 475.0 KB (🔴 +5.0 KB) |
ref/net6.0/SkiaSharp.dll |
296.0 KB → 299.5 KB (🔴 +3.5 KB) |
| +41 more file(s) |
SkiaSharp.NativeAssets.WebAssembly
| File | Size |
|---|---|
🧬 wasm 5.0.6/st · libSkiaSharp.a (buildTransitive/netstandard1.0/libSkiaSharp.a/5.0.6/st/libSkiaSharp.a) |
18.0 MB → 18.0 MB (🔴 +3.7 KB) |
🧬 wasm 5.0.6/st,simd · libSkiaSharp.a (buildTransitive/netstandard1.0/libSkiaSharp.a/5.0.6/st,simd/libSkiaSharp.a) |
18.2 MB → 18.2 MB (🔴 +3.7 KB) |
🧬 wasm 5.0.6/mt · libSkiaSharp.a (buildTransitive/netstandard1.0/libSkiaSharp.a/5.0.6/mt/libSkiaSharp.a) |
17.9 MB → 17.9 MB (🔴 +3.7 KB) |
🧬 wasm 5.0.6/mt,simd · libSkiaSharp.a (buildTransitive/netstandard1.0/libSkiaSharp.a/5.0.6/mt,simd/libSkiaSharp.a) |
18.2 MB → 18.2 MB (🔴 +3.6 KB) |
🧬 wasm 3.1.56/st · libSkiaSharp.a (buildTransitive/netstandard1.0/libSkiaSharp.a/3.1.56/st/libSkiaSharp.a) |
17.8 MB → 17.8 MB (🔴 +3.3 KB) |
🧬 wasm 3.1.56/st,simd · libSkiaSharp.a (buildTransitive/netstandard1.0/libSkiaSharp.a/3.1.56/st,simd/libSkiaSharp.a) |
18.1 MB → 18.1 MB (🔴 +3.3 KB) |
🧬 wasm 3.1.56/mt · libSkiaSharp.a (buildTransitive/netstandard1.0/libSkiaSharp.a/3.1.56/mt/libSkiaSharp.a) |
17.8 MB → 17.8 MB (🔴 +3.2 KB) |
🧬 wasm 3.1.56/mt,simd · libSkiaSharp.a (buildTransitive/netstandard1.0/libSkiaSharp.a/3.1.56/mt,simd/libSkiaSharp.a) |
18.0 MB → 18.0 MB (🔴 +3.2 KB) |
SkiaSharp.NativeAssets.Win32
| File | Size |
|---|---|
runtimes/win-x86/native/libSkiaSharp.pdb |
97.1 MB → 97.1 MB (🔴 +72.0 KB) |
runtimes/win-arm64/native/libSkiaSharp.pdb |
91.2 MB → 91.2 MB (🔴 +60.0 KB) |
runtimes/win-x64/native/libSkiaSharp.pdb |
94.3 MB → 94.4 MB (🔴 +44.0 KB) |
🧬 win-x64 (runtimes/win-x64/native/libSkiaSharp.dll) |
12.8 MB → 12.8 MB (🔴 +9.0 KB) |
🧬 win-arm64 (runtimes/win-arm64/native/libSkiaSharp.dll) |
11.0 MB → 11.0 MB (🔴 +8.5 KB) |
🧬 win-x86 (runtimes/win-x86/native/libSkiaSharp.dll) |
11.1 MB → 11.1 MB (🔴 +7.5 KB) |
SkiaSharp.NativeAssets.WinUI
| File | Size |
|---|---|
runtimes/win-x86/native/libGLESv2.pdb |
67.2 MB → 67.1 MB (🟢 −128.0 KB) |
runtimes/win-arm64/native/libGLESv2.pdb |
64.5 MB → 64.4 MB (🟢 −96.0 KB) |
runtimes/win-x64/native/libGLESv2.pdb |
66.6 MB → 66.6 MB (🟢 −64.0 KB) |
Informational only — this never blocks the PR. Native binaries are labelled by os/arch.
|
Superseded by the staged split:
The exact source commit for this cumulative draft remains pinned for carving the later Android-native layer. |
Description
Adds the native Graphite views/package layer and direct native Basic samples split from draft #4728.
This PR introduces:
SkiaSharp.Views.Graphite, with a Vulkan-backedSKGraphiteVulkanViewfor Android and a Metal-backedSKGraphiteMetalViewfor iOS, Mac Catalyst, macOS, and tvOS.This is the middle commit in the split of #4728. It is commit-stacked on the exact head of #4729 (
4e6d1268dfffb2470fae74d1225771fbb2200c8a) and must not merge until #4729 and mono/skia#345 merge. It intentionally excludes all MAUI controls, handlers, tests, touch proxies, and MAUI samples.Related issues
Related to #4721
Documentation: mono/SkiaSharp-API-docs#200
Required skia PR
Requires mono/skia#345
Also requires #4729.
Areas affected
binding/)externals/skia/src/c,include/c)Changes
Public API
SkiaSharp.Views.Graphitepackage for Android, iOS, Mac Catalyst, macOS, and tvOS.SKGraphiteVulkanViewon Android withCanvasSize,GraphiteContext,RenderMode,PaintSurface,RenderFailed,RequestRender(),OnPause(), andOnResume().SKGraphiteMetalViewon Apple platforms withCanvasSize,GraphiteContext,PaintSurface, andRenderFailed.SKPaintGraphiteSurfaceEventArgsandSKGraphiteRenderFailedEventArgsin each platform's native views namespace.Behavior
The native views own their Graphite presentation lifecycle, render continuously by default, surface unrecoverable failures through
RenderFailed, and stop/pause rendering with their host lifecycle. Android requires API 24 or later.Testing
externals-download:dotnet cake --target=externals-androiddotnet cake --target=externals-iosdotnet cake --target=externals-maccatalystdotnet cake --target=externals-macos --arch=arm64dotnet cake --target=externals-tvosSkiaSharp.Views.Graphitefor:net10.0-android36.0net10.0-ios26.0net10.0-maccatalyst26.0net10.0-macos26.0net10.0-tvos26.0SkiaSharp.Views.Graphite.4.152.0.nupkgand verified all five current TFM assemblies and dependency groups.GRAPHITE / VULKAN | FPS: 103with no render or process failures.DiagonalLinesgolden mismatch; the isolated visual test run reproduced only that same mismatch.No tests were added because this PR restores the already-reviewed native view implementation and adds direct platform samples; the five sample builds and Android/iOS simulator runs exercise the integration.
Checklist
Changesabove lists all public API and behavioral changes (or "None.")mono/skiaPR linked above and bindings regenerated