Repository navigation
Add Ganesh and Graphite native and MAUI views - #5329
mattleibow wants to merge 19 commits into
Conversation
📦 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 -- 5329PowerShell / Windows: iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 5329"Step 2 — Add the local NuGet source dotnet nuget add source ~/.skiasharp/hives/pr-5329/packages --name skiasharp-pr-5329More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-5329 |
📊 SkiaSharp benchmarks — PR #5329⭐ this PR (full source build) vs 🌙 nightly · Linux · Windows · macOS
Highlights⏱️ Time — 🔴 36 slower · 🟢 59 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
|
|
/azp run |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
|
The remaining Windows acceptance work is now wired into the owning Windows .NET Core CI leg at The Catalyst package-validation blocker has an independent, non-Appium path now: a package-only host reused the actual GPU view tests and collection checks and passed 15/15 with zero skips, including current-frame pixels/readbacks, producers, resize, retry and retirement. It did not bypass OS authentication or permission settings. The local macOS GL golden divergence is explicitly documented by the already merged #5183: the repository deliberately chose the macOS 15.7 CI capture rather than the macOS 26.7 M3 Pro local image. We retain that golden and require the fresh unfiltered owning-platform CI gates; no golden/tolerance/skip changes are included here. |
592b555 to
8aabb95
Compare
d72fe35 to
cafdc05
Compare
cafdc05 to
326396e
Compare
Keep native GPU presentation behind stable engine-named containers and expose typed contexts, common drawing metadata, explicit lifecycle notifications, and generation-safe producer recording. Ganesh uses the established Metal/GLES/ANGLE backends; Graphite uses Metal/Vulkan without a Windows or software fallback. Vulkan presentation retires bounded asynchronous frames, and frame readback is scheduled after drawing and before presentation transitions. Migrate supported native and MAUI samples, isolate Vulkan integration dependencies, and cover pixels, resize, input, completion, retry, reattachment, and owned-resource collection. The legacy SKGLView consumer API remains unchanged. Windows validation and the independently reproduced main Ganesh-GL golden failure remain explicit draft blockers. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
Native Android containers expose SkiaCanvas through ContentDescription, whereas MAUI controls use a resource ID. Locate archived native samples by their shared accessibility identifier instead of applying the MAUI-specific Android resource-ID locator. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
Avoid Java's reserved native identifier in Android sample package names. Build iOS package consumers for the simulator RID expected by the harness, with normal ad-hoc signing, instead of relying on device-build defaults. Both archived Android GPU samples and both archived iOS GPU samples pass their actual presentation checks against the source-built local package feed. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
Run the owning MAUI device host in the Windows console-test leg with its repository-derived framework. Verify a distinctive composited Ganesh pattern and real pointer routing in addition to context, pixel, lifecycle and collection contracts. Keep rendering failures latched through cleanup and restore only this test's injected input state. No GPU skip, golden, tolerance, native download fallback, or production signing change is introduced. An exact-package Catalyst device host separately passed all 15 GPU/lifecycle cases without depending on Appium or OS authentication automation. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
Collapse both framework properties for the primary unfiltered console solution instead of restoring every platform from desktop jobs. Query the Windows MAUI framework through a neutral binding evaluation so native-copy targets cannot inspect an unset platform version. Keep distinct result files for all five solution hosts. Use the compatible MTP-native coverage extension, preserve the isolated MSBuild test project's boundary, and normalize merged coverage class filenames without assuming a sources element. Actual local validation produced five populated Cobertura reports; only the intentionally documented main macOS GL golden divergence remains. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
The primary console solution declares Any CPU, while its individual projects use AnyCPU. Preserve each runner's correct platform spelling instead of passing the project spelling to a solution. The actual coverage-enabled Cake helper reaches all five hosts and emits distinct result/coverage files; only the previously documented local main GL image difference remains. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
Build the owning Windows UI test host as unpackaged and self-contained. The first real-host compile passed, but DeviceRunners attempted loose MSIX registration and correctly rejected an agent without Developer Mode. Use normal executable deployment instead of enabling machine-wide installation exceptions or skipping presentation/input coverage. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
The Windows App SDK rejects self-contained AnyCPU projections. Match the owning x64 test agent for the UI host and its project graph so the unpackaged launch can be verified without enabling Developer Mode. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
Avoid extracting competing Windows App SDK runtime copies in every referenced view library. Keep self-contained unpackaged mode local to the Windows test host, preserving normal packaged and non-Windows defaults. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
Import the existing WinUI source-native helper and explicitly copy its native content for unpackaged execution. The owning Windows host now launches; its GPU tests exposed missing ANGLE DLLs that packaged sample layouts previously collected implicitly. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
When destruction callbacks have released every producer dependency, dispose the native context before Stop returns. Preserve asynchronous owner-thread retirement for callers retaining recorders. The existing context-handle regression reproduced the race in a full Android run; six complete after-runs pass, and independent ownership review found no significant issues. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
Retain opt-in host exception and exit logs, plus recent Application Error/.NET Runtime/WER events and existing reports for the owning test executable, without changing system policy. Require five complete eight-case host runs and fail immediately on any failure or incomplete stream; this is stress validation, not a retry-until-pass fallback. The intermittent four-case termination remains unexplained and is not classified as infrastructure. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
Keep the initial frame completion stable and publish a separate logical-size waiter. An Android GPU callback can still be finishing a pre-scaling frame after the UI observes its frame counter and changes IgnorePixelScaling. Preserve the existing width/height criteria, latch render failures through cleanup, and always disconnect the host. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
Keep the five-host gate unchanged by default and enable native crash capture only on explicit diagnostic runs. Verify Microsoft tooling and owning process identities, retain collector/analysis ownership through recovery, and analyze privately before deleting dumps. Isolate raw dumps, licensed binaries and symbols from all failed-job artifacts. Exercise timeout, failed-job, late-analysis and repeated-invocation paths with owned-process fixtures. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
Queue Build does not propagate arbitrary runtime variables. Forward a default-off captureWindowsGpuNativeDumps boolean through complete/tests templates and log its evaluated value before the GPU gate, preserving the local task-environment opt-in. Validate both true and false rendered task scripts. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
The actual capture worker exposed advanced-script positional binding failure and lost PSScriptRoot from Start-Job -FilePath. Forward named arguments through a job scriptblock invoking the real file, and verify the actual launch AST reaches platform/tool validation in a real background job. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
Keep the Windows GPU workload and acceptance hook caller-owned while common reporting stays in the shared desktop template. Exercise the actual shared-runner method with local stand-ins to preserve Samples filtering/no-build/hang behavior, caller properties, solution platform spelling and distinct MTP coverage/TRX arguments without restoring Cake or launching native/device hosts. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
The captured Windows failure enters native MakeWin with cached WGL procedure addresses inside an unloaded opengl32 mapping. This presenter already owns an EGL/ANGLE context, so probing desktop WGL is both unnecessary and unsafe. Select the existing ANGLE factory after MakeCurrent without changing native code, public APIs or fallback policy. The actual-render-method local fixture fails before and passes across 16 context generations after; owning Windows after-runtime validation remains paused. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
Use the renamed shared runner in its regression fixture and keep only the inherited WinUI native-assets import before the unpackaged host content update. Document the Windows GPU hook in the split runtime stage without changing canonical device coverage or GPU policy. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd863066-e555-4b94-a17a-cc1bc0633c2f
326396e to
4813015
Compare
Description
Add engine-named native containers and MAUI controls:
SKGaneshViewandSKGraphiteView. Applications can share drawing code throughSKPaintSurfaceEventArgswithout losing typedGRContextorSKGraphiteContextaccess. Presentation backends remain private implementation details rather than public base classes, so adopting a different backend later need not replace the control API.Keep the existing
SKGLViewAPI and signed native assembly identities. Migrate the supported native Basic and MAUI Basic/Gallery GPU paths, add an explicit Graphite choice, and isolate Android's unsigned Vulkan integration dependency inSkiaSharp.Views.Graphite. No native Dawn, backend selector, silent renderer fallback, Tizen, or new macOS/tvOS view is included.Stacked prerequisite: this PR intentionally targets #4729's refreshed feature branch while its interop changes remain unmerged. Its diff is views-only; native exports, generated bindings, and core interop regressions remain in #4729 and mono/skia#345. Keep this PR dependent on the prerequisite; do not merge the stack out of order.
Current alignment: head
4813015ef9262504c1f32d4c5464680647cf09d8is rebased onto #4729f5b6f58ee7aaf8c327268df04fa3907b4a4541f8, whose exact main base is5e3e1c51bab1b5ef41017f570717e173108b48b4. All 19 upper commits were replayed after old lower14157c0030ab0c339310b3c68999e866cf0ab918, conflict-free and range-diff identical. This refresh only inherits main's landed #5795 x86 Docker digest pins and #5788 Uno 7 smoke-layout fixes, plus generated release documentation. Those repairs are byte-identical to the lower/main baseline and are not copied into the views diff. Implementation, native source/pin, public APIs, tests, target/package graphs and Gallery's Ganesh-first default are unchanged. The combined Mesh/Graphite native pin remains75ab194f675fe445dac44ea98829148fc6c6848d, based on merged Mesh5d226f638edbb3c0dac0ac93ac1ff349298880a4; its verified source-built artifacts/provenance remain valid. Stack 5781 stays [4729, 5329], with the same base chain and draft states. No pending APIs, unrelated feature repairs, stack metadata or foreign branch changes were introduced.Draft acceptance gaps: the local unfiltered console gate was rerun on this head, but repaired remote container/Uno checks still need their natural new-head CI run; inheriting fixes is not a claimed remote pass. Native-view Windows/mobile/package-consumer runtime acceptance also remains outstanding. The earlier Windows CFG fix and mandatory five-host acceptance gate are retained unchanged. No manual CI queues, device runs, golden/tolerance changes or GPU-policy relaxation were made.
Related issues
Related to #4721 and #3962. #4745 is now closed as superseded for iOS/Mac Catalyst; its unported macOS/tvOS source and
mattleibow-apple-native-graphite-viewsbranch are preserved.Required skia PR
Requires mono/skia#345 through #4729. The source-built native prerequisite is the combined Mesh/Graphite m159
75ab194f675fe445dac44ea98829148fc6c6848d; the refreshed managed prerequisite isf5b6f58ee7aaf8c327268df04fa3907b4a4541f8. The native presentation changes and regenerated Mesh/Graphite Cdecl/callback bindings remain in the prerequisite/main layers, not this views diff.Areas affected
binding/)externals/skia/src/c,include/c)Changes
Public API
All additions; no legacy signature, return type, interface requirement, or assembly identity is changed. The native/MAUI paint arguments below inherit the existing
SKPaintSurfaceEventArgs, retaining itsSurface,Info, andRawInfoproperties.MAUI controls: SkiaSharp.Views.Maui.Controls
UseSkiaSharp()registers both new handlers while retaining the existing registrations; its signature is unchanged.MAUI contracts and events: SkiaSharp.Views.Maui
Native contracts and containers
The following native contracts are in
SkiaSharp.Views.iOS,SkiaSharp.Views.Android, and (Ganesh/common contracts only)SkiaSharp.Views.Windows:Each new concrete native container publicly implements all its engine-contract members. Stable hosts and constructors:
Native
SKPaintGaneshSurfaceEventArgsandSKGpuRenderFailedEventArgshave the same public members/signatures listed for their MAUI counterparts. Native Graphite event-argument constructor ordering matches the prior native presentation convention:Graphite containers/contracts are provided only on iOS, Mac Catalyst and Android by the new unsigned
SkiaSharp.Views.Graphitepackage. Android alone depends on the existingSilk.NET.Vulkan2.23.0 package. The cross-platform MAUI type compiles for reference/Windows TFMs but unsupported presentation throws explicitly.Handler customization: SkiaSharp.Views.Maui.Handlers
The concrete handlers inherit
SKGpuViewHandler<engine-contract, native-container>on supported platforms. Reference handlers and Windows Graphite inherit the correspondingViewHandlerplaceholder specialization and reject platform creation. Native create/connect/disconnect lifecycle overrides are documented in source.Behavior
Defaults remain on-demand rendering, physical-pixel drawing, and opt-in touch forwarding. Contexts and frame surfaces are borrowed and thread-affine; application code must not dispose/retain frame resources or submit the private presentation recorder independently.
Graphite caller recorders are created/tracked through
CreateRecorder, snapped on their exclusive worker thread throughSnapRecording, and inserted on the context owner thread. Stale/untracked recordings are rejected before native insertion. Shutdown stops producers and disposes dependent surfaces/images/recordings before recorders; retiring generations remain bounded while dependencies drain.Vulkan uses up to three asynchronously submitted frames, with acquisition waits, per-image completion semaphores, present layout/queue transitions and resize-aware native-window geometry. Ordinary frames do not block on CPU fence/device-idle waits; resize/teardown may drain.
e.RequestReadPixelsschedules reads after current-frame drawing insertion and before presentation transitions; callbacks receive borrowed pixels or null on failure/cancellation, including while an on-demand view is idle. All canceled requests are notified even if a callback throws, and mandatory GPU cleanup still runs.Failure stops the affected generation and notifies/logs explicitly. Retry is explicit; no blank-success, Ganesh, or software fallback is substituted for Graphite. Typed context state and canvas size clear on destruction. Windows teardown makes its own EGL context current before notifying applications.
Android disconnect completes native context disposal before returning when destruction callbacks release all registered dependencies; callers retaining producer recorders still defer final retirement to the GPU owner thread.
Gallery preserves main's GPU-first default through Ganesh; CPU and supported-platform Graphite remain explicit selections.
See
documentation/dev/gpu-engine-views.mdfor ownership, worker shutdown, readbacks, platform scope and migration examples.Testing
Current CI-base refresh validation (November 17): the unfiltered console command below was rerun successfully on this head, and source/native/CI identity checks were repeated. All other library, Gallery compilation, package and fixture evidence below comes from the preceding Mesh refresh on byte-identical implementation and target/package graphs; it was not relabeled as newly executed. No manual CI queues, device runs, golden updates, new GPU skips or protected-branch changes were made.
The macOS ARM64 natives were reused from the prerequisite's successful
dotnet cake --target=externals-macos --arch=arm64source build at75ab194f675fe445dac44ea98829148fc6c6848d, not downloaded. Both source-artifact SHA256s were checked before/after copying; the Skia hash also matches all five rebuilt console hosts: Skiafce798551b6779290b0f5b052ef521d4da33be23be2286a87142e64037ea1e02; HarfBuzz534e548753bfca75c78384d0e6527e2f8caac146aefa307742967b92cf1a1cb6. These are ARM64 macOS outputs only, not device/x64/Windows artifacts. Apple library compilation used process-local Xcode 27.2.dotnet test tests/SkiaSharp.Tests.Console.slnx -p:TargetFramework=net10.0 -p:TargetFrameworks=net10.0 --verbosity quiet -- --report-trxDiagonalLinesblocker passes now.dotnet build source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Controls/SkiaSharp.Views.Maui.Controls.csproj -p:TargetFramework=net10.0-android36.0 -p:TargetFrameworks=net10.0-android36.0 --verbosity quietdotnet build source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Controls/SkiaSharp.Views.Maui.Controls.csproj -p:TargetFramework=net10.0-ios26.0 -p:TargetFrameworks=net10.0-ios26.0 --verbosity quietdotnet build source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Controls/SkiaSharp.Views.Maui.Controls.csproj -p:TargetFramework=net10.0-maccatalyst26.0 -p:TargetFrameworks=net10.0-maccatalyst26.0 --verbosity quietdotnet build source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Controls/SkiaSharp.Views.Maui.Controls.csproj -p:TargetFramework=net9.0-android35.0 -p:TargetFrameworks=net9.0-android35.0 --verbosity quietdotnet build source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Controls/SkiaSharp.Views.Maui.Controls.csproj -p:TargetFramework=net9.0-ios18.0 -p:TargetFrameworks=net9.0-ios18.0 --verbosity quietdotnet build source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Controls/SkiaSharp.Views.Maui.Controls.csproj -p:TargetFramework=net9.0-maccatalyst18.0 -p:TargetFrameworks=net9.0-maccatalyst18.0 --verbosity quietdotnet build source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Controls/SkiaSharp.Views.Maui.Controls.csproj -p:TargetFramework=net10.0 -p:TargetFrameworks=net10.0 --verbosity quietdotnet build source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Controls/SkiaSharp.Views.Maui.Controls.csproj -p:TargetFramework=net9.0 -p:TargetFrameworks=net9.0 --verbosity quietdotnet restore samples/Gallery/Maui/SkiaSharpSample.Maui.csproj --verbosity quietthendotnet build samples/Gallery/Maui/SkiaSharpSample.Maui.csproj -t:Compile --no-restore --framework net10.0-android --verbosity quietdotnet restore source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Controls/SkiaSharp.Views.Maui.Controls.csproj --verbosity quietdotnet pack source/SkiaSharp.Views/SkiaSharp.Views.Graphite/SkiaSharp.Views.Graphite.csproj --configuration Debug --no-build --output output/gpu-view-validation/m159-mesh-sync/packages --verbosity quietdotnet pack source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Core/SkiaSharp.Views.Maui.Core.csproj --configuration Debug --no-build --output output/gpu-view-validation/m159-mesh-sync/packages --verbosity quietdotnet pack source/SkiaSharp.Views.Maui/SkiaSharp.Views.Maui.Controls/SkiaSharp.Views.Maui.Controls.csproj --configuration Debug --no-build --output output/gpu-view-validation/m159-mesh-sync/packages --verbosity quiet4.159.0; compiler XML accompanies all 22 packaged assemblies, and only Android Graphite groups depend on Silk.NET.Vulkan. These Debug packs preserve main'sProduceReferenceAssembly=falsesetting; they do not claim separateref/assemblies or production signing/BAR certification.pwsh -NoLogo -NoProfile -File scripts/infra/tests/tests/Test-SharedRunner.ps1tests-shared.cakerename.pwsh -NoLogo -NoProfile -File scripts/infra/tests/tests/Test-WindowsGaneshBackend.ps1pwsh -NoLogo -NoProfile -File scripts/infra/tests/tests/Test-WindowsGpuCapture.ps1azure-templates-stages-tests.yml; default-off capture is forwarded through the stage wrapper. Other runtime callers, current Android/iOS matrices, Windows MAUI job, typed Samples/analyzer/templates/runner and human-facingbuilding-samples.mdare unchanged from the lower/main baseline.git diff --checkRemaining acceptance: no new Windows native presentation/input/teardown run, mobile device run, or package-consumer runtime run was performed for m159. Those remain required before treating the views as fully accepted. The historical Windows crash was identified as a CFG indirect-call failure into unloaded WGL code; the presenter now explicitly uses
GRGlInterface.CreateAngle()afterMakeCurrent(). The retained gate still requires all eight cases in five independent hosts; a method-level regression or old pass is not its replacement. The old build 1635543 is not claimed as a verified after-pass.Historical m156 evidence, not m159 acceptance: source-built native matrices, package metadata/legacy compatibility checks and actual Android/iOS/Catalyst pixel/readback/lifetime runs were obtained earlier. The complete hosted Android after-gate passed 1,191 / 0 failures / 87 declared skips, including all 16 new GPU/lifetime cases. Catalyst package-only runs passed 15/15 with no skips after Appium authentication prevented the original launch. Windows had complete eight-case passes but intermittent host termination before the explicit ANGLE fix. These results explain the retained tests and fixes; they are not relabeled as fresh m159 runtime evidence. Screenshots below also come from that original implementation.
Screenshots (before / after)
Native iOS Basic migration. These are real animated shader scenes, not synchronized golden captures; animation phases differ. The original-main
SKMetalViewsample is unchanged and was rebuilt for the comparison.No golden-image changes.
Checklist
Changesabove lists all public API and behavioral changes (or "None.")///documentation and regenerated bindings when applicablemono/skiaPR linked above and bindings regenerated