Repository navigation
Execute Vulkan tests on the Windows CI leg (software SwiftShader ICD via preBuildStep) - #4531
Conversation
Adds a new convenience package that brings up Vulkan for SkiaSharp via the actively-maintained, cross-platform Silk.NET.Vulkan binding, alongside the existing (2018, Android-incapable) SharpVk package which is left untouched. - source/SkiaSharp.Vulkan/SkiaSharp.Vulkan.Silk.NET: GRSilkNetBackendContext (maps Silk.NET Instance/PhysicalDevice/Device/Queue nint handles + pinned PhysicalDeviceFeatures + GetProcedureAddress to the raw-IntPtr GRVkBackendContext), GRSilkNetGetProcedureAddressDelegate, and the GRVkExtensionsSilkNetExtensions.Initialize bridges. - Wires the package into SkiaSharpSource.sln and scripts/VERSIONS.txt. - Adds device-free GRSilkNetBackendContext tests and references the package from the Vulkan test console. Builds on all BasicTargetFrameworks (netstandard2.0 -> net10.0); the two device-free tests pass without a Vulkan ICD. Note: Silk.NET.Vulkan must be promoted to the dotnet-public feed for CI restore.
Proves the SkiaSharp.Vulkan.Silk.NET package works with a real GPU Vulkan context end-to-end: Silk.NET brings up instance/device/queue headlessly and GRContext.CreateVulkan renders an offscreen SKSurface. Verified in a Linux container against the repo's milestone-151 native using Mesa Lavapipe (software Vulkan) on Apple Silicon. - tests/VulkanTests/VkContexts/SilkVkContext.cs: headless, cross-platform Silk.NET bring-up (OS-provided Vulkan loader; no window/surface). - tests/VulkanTests/GRSilkNetBackendContext.cs: VkGpuSurfaceIsCreatedSilkNetTypes drives GRContext.CreateVulkan through GRSilkNetBackendContext; skips cleanly when no ICD is present. - GRVkExtensionsSilkNetExtensions.Create: build a GRVkExtensions straight from Silk.NET handles (GRVkExtensions has no public constructor otherwise). Skia needs MaxAPIVersion + GRVkExtensions on software ICDs like Lavapipe. - nuget.config: add nuget.org so Silk.NET.Vulkan restores until it is mirrored to the dotnet-public feed. Device-free tests pass and the GPU test skips on macOS (no Vulkan backend in the mac native, #3202); the GPU test renders green on Linux+Lavapipe.
All backend-agnostic Vulkan tests now bring Vulkan up via the cross-platform Silk.NET binding (SilkVkContext) instead of the desktop-only SharpVk Win32VkContext. SharpVk types and their specific tests are kept but isolated: - VKTest: CreateSilkVkContext() (default, cross-platform, skips without an ICD) and CreateSharpVkContext() (Windows-only, for SharpVk-specific tests only). - GRContextTest, SKSurfaceTest.VkGpuSurfaceIsCreated, GaneshVulkanRenderer: now use SilkVkContext + GRVkBackendContext/GRSilkNetBackendContext with the MaxAPIVersion + GRVkExtensions that Skia needs on software ICDs. - SharpVk-specific tests (GRSharpVkBackendContext, SKSurfaceTest SharpVk case) use CreateSharpVkContext and skip off-Windows. - SilkVkContext gains BaseGetProc (raw GRVkBackendContext) + ApiVersion. Verified on Mesa Lavapipe (Linux container, Apple Silicon): 8 passed, 0 failed, 2 skipped (the SharpVk GPU cases skip off-Windows).
…te project Deletes the separate SkiaSharp.Vulkan.Tests.Console project and compiles the tests/VulkanTests folder directly into the real hosts, only where Vulkan is supported; it no-ops (skips) elsewhere: - Console host (desktop net10/net48): includes all of VulkanTests + Silk.NET and SharpVk package/project refs. Runs on Linux/Windows; skips on macOS (no Vulkan in the mac native). - Devices (MAUI) host: includes VulkanTests only for -android and -windows TFMs; iOS/MacCatalyst/tvOS never take the Vulkan dependency. - GaneshVulkanRenderer is now available on Android too and joins the shared VisualMatrixTests automatically (via RendererCatalog.AllNames), so the separate VulkanVisualTests class is deleted to avoid double-running. - Removes SkiaSharp.Vulkan.Tests.Console from the solution and the cake test lists; drops the unused SharpVk.Glfw reference. Verified on macOS: Vulkan tests skip cleanly (no ICD), ganesh-vulkan visual cells skip (unavailable); 0 Vulkan failures. (The one ganesh-gl visual mismatch is a pre-existing GL golden difference, unrelated.)
Installs libvulkan1 (the Vulkan loader) and mesa-vulkan-drivers (the Lavapipe software ICD) in tests/Dockerfile.linux so the merged Vulkan GPU tests run headlessly in the container without a physical GPU. When no ICD is present the tests skip; with Lavapipe they execute and render.
Harvests the 5 ganesh-vulkan visual-matrix goldens on Linux from the Mesa Lavapipe (deterministic software Vulkan) render in the repo test container, so the ganesh-vulkan cells compare strictly and pass instead of failing unseeded. Verified: with these goldens the Visual matrix on Linux/Lavapipe is 0 failed / 10 succeeded / 10 skipped (the 5 ganesh-vulkan cells now pass; gl and metal skip in the headless container). raster.linux goldens already matched this container render and are left untouched. Windows/Android ganesh-vulkan goldens are seeded separately from their own CI legs (per-platform golden folders).
- nuget.config: revert to base now that Silk.NET.Vulkan (and Silk.NET.Core) are mirrored to the dotnet-public feed; restores work without nuget.org. - SkiaSharpSource.sln: replace the 357-line 'dotnet sln add' churn (which added x64/x86 configs to every project) with the minimal 7 lines that register SkiaSharp.Vulkan.Silk.NET under the existing SkiaSharp.Vulkan solution folder, mirroring SkiaSharp.Vulkan.SharpVk. - TestConfig: add IsAndroid alongside IsLinux/IsMac/IsWindows and use it from GaneshVulkanRenderer instead of a local helper.
The gate is still needed (it serializes GPU rendering across xUnit's parallel theory cells) and still cross-assembly: on the Devices host the Vulkan renderers are compiled into the app assembly while the gate lives in the referenced SkiaSharp.Tests assembly, and Direct3D remains a separate satellite. Only the comment's 'Vulkan satellite' wording was stale; no behavior change.
Replace the process-wide GpuRenderGate lock with a DisableParallelization xUnit collection. All GPU rendering is driven by the single VisualMatrixTests class, so pinning that class to a serialized collection is an equivalent, more idiomatic guarantee (it matches the existing HandleDictionaryThreadingCollection pattern) and removes the per-renderer lock boilerplate. - Add GpuRenderingCollection ([CollectionDefinition(DisableParallelization=true)]) - Apply [Collection] to VisualMatrixTests - Drop the lock (GpuRenderGate.Sync) wrapper from the Ganesh GL/Metal/Vulkan renderers and delete GpuRenderGate Co-authored-by: Copilot App <[email protected]> Copilot-Session: 51747b15-4eb0-467b-8bc8-7029e750e7e1
CatalogReflection found host-contributed renderers (Vulkan, Direct3D) via Assembly.GetEntryAssembly(), which is null on Android/MAUI and WASM. As a result the merged GaneshVulkanRenderer -- compiled into the device app assembly -- was invisible on the Devices host, so ganesh-vulkan never joined the visual matrix there and only raster ran. Also scan loaded "SkiaSharp.Tests*" host assemblies by name so host renderers are discovered regardless of whether GetEntryAssembly() is populated. On desktop the entry assembly is unchanged; on device/wasm the app assembly is now included. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 51747b15-4eb0-467b-8bc8-7029e750e7e1
Captured from the Silk.NET Vulkan renderer running on an Android API-36 arm64 emulator (ranchu ICD, Vulkan 1.3). Confirms GRSilkNetBackendContext brings up Vulkan and renders through Skia on Android, not just desktop/Lavapipe. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 51747b15-4eb0-467b-8bc8-7029e750e7e1
Move the Vulkan test dependencies (Silk.NET.Vulkan, SharpVk, and the two SkiaSharp.Vulkan.* packages) and the ..\VulkanTests\** compile onto the shared SkiaSharp.Tests library instead of Compile-Including them into each MAUI/WASM host. The Devices and WASM app heads now pick up the Vulkan tests through their existing ProjectReference to SkiaSharp.Tests, and the Console host keeps compiling the same source directly (it does not reference the library). Because GaneshVulkanRenderer now lives in the catalog assembly, the visual matrix discovers it on every host with the original catalog+entry-assembly scan, so the Assembly.GetEntryAssembly() Android/WASM workaround is no longer needed and is reverted. Verified on the Android API-36 emulator: all five ganesh-vulkan.android cells render and pass. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 51747b15-4eb0-467b-8bc8-7029e750e7e1
…ojects) The two SkiaSharp.Vulkan.* project references already bring Silk.NET.Vulkan and SharpVk in transitively (they are public API of those packages, so never private), so the explicit PackageReferences on the base test library and the Console host were redundant. Verified both still build. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 51747b15-4eb0-467b-8bc8-7029e750e7e1
GRVkExtensions had a private constructor, so the only way to obtain one was the
static GRVkExtensions.Create (raw IntPtr + delegate). That forced the Silk.NET
helper to expose its own Create factory, and left the SharpVk helper's Initialize
extension effectively unusable (there was no typed way to get an instance to
initialize).
Make the parameterless constructor public — mirroring native
skgpu::VulkanExtensions (default-construct, then init) and SkiaSharp's own
SKPaint/SKPath allocating ctors — so the idiomatic usage is:
using var ext = new GRVkExtensions();
ext.Initialize(getProc, instance, physicalDevice);
The Silk.NET helper drops its Create overloads and keeps only the typed
Initialize extension methods, matching the SharpVk helper (which is now usable).
GRVkExtensions.Create stays for source compatibility. Verified on the Android
emulator: all five ganesh-vulkan.android cells still render and pass.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 51747b15-4eb0-467b-8bc8-7029e750e7e1
…otnet-vulkan-bindings # Conflicts: # source/SkiaSharpSource.sln # tests/SkiaSharp.Tests.Console.sln
📦 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 -- 4531PowerShell / Windows: iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4531"Step 2 — Add the local NuGet source dotnet nuget add source ~/.skiasharp/hives/pr-4531/packages --name skiasharp-pr-4531More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-4531 |
|
📖 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 #4531⭐ this PR (full source build) vs 🌙 nightly · Linux · Windows · macOS
Highlights⏱️ Time — 🔴 20 slower · 🟢 15 faster
Full per-OS benchmark deltasLinux⏱️ Time (vs 🌙 nightly
Windows⏱️ Time (vs 🌙 nightly
macOS⏱️ Time (vs 🌙 nightly
|
📦 Artifact size reportPackages from this PR (build Total Packages
+38 package(s) unchanged (< 50.0 KB). Per-file changes
|
| File | Size |
|---|---|
runtimes/win-x86/native/libHarfBuzzSharp.pdb |
22.2 MB → 21.9 MB (🟢 −272.0 KB) |
runtimes/win-x64/native/libHarfBuzzSharp.pdb |
22.0 MB → 21.8 MB (🟢 −240.0 KB) |
runtimes/win-arm64/native/libHarfBuzzSharp.pdb |
22.3 MB → 22.3 MB (🟢 −8.0 KB) |
SkiaSharp.NativeAssets.WinUI
| File | Size |
|---|---|
runtimes/win-x86/native/libGLESv2.pdb |
67.3 MB → 67.0 MB (🟢 −256.0 KB) |
runtimes/win-arm64/native/libGLESv2.pdb |
64.5 MB → 64.3 MB (🟢 −224.0 KB) |
runtimes/win-x64/native/libGLESv2.pdb |
66.6 MB → 66.4 MB (🟢 −224.0 KB) |
runtimes/win-x64/native/libEGL.pdb |
6.4 MB → 6.3 MB (🟢 −32.0 KB) |
runtimes/win-x86/native/libEGL.pdb |
6.5 MB → 6.5 MB (🟢 −16.0 KB) |
runtimes/win-arm64/native/SkiaSharp.Views.WinUI.Native.pdb |
67.7 MB → 67.7 MB (🟢 −8.0 KB) |
runtimes/win-x64/native/SkiaSharp.Views.WinUI.Native.pdb |
68.0 MB → 68.0 MB (🟢 −8.0 KB) |
🧬 win-x64 (runtimes/win-x64/native/libGLESv2.dll) |
4.9 MB → 4.9 MB (🔴 +2.0 KB) |
🧬 win-arm64 (runtimes/win-arm64/native/libGLESv2.dll) |
4.4 MB → 4.4 MB (🔴 +1.0 KB) |
Informational only — this never blocks the PR. Native binaries are labelled by os/arch.
Context: #4527 Context: ADO build 159014 (SkiaSharp Public) — iOS, Mac Catalyst, and Windows .NET Framework legs red. Folding the Vulkan tests + their unsigned Silk.NET.Vulkan/SharpVk dependencies into the shared, strong-named SkiaSharp.Tests base library and Console host (the earlier "Option A") broke three CI legs: * iOS / Mac Catalyst — the Apple AOT/ILC linker requires every native symbol to resolve at link time. Pulling Silk.NET into the base lib flowed it into the Apple device heads, which have no libvulkan, so the link failed with "undefined symbol _vkBindImageMemory" (and friends). * Windows .NET Framework (net48) — the full framework enforces strong-name references at load time. The strong-named SkiaSharp.Tests Console could not load the unsigned Silk.NET.Vulkan assembly and threw FileLoadException "A strongly-named assembly is required" (0x80131044). net-core does not enforce this, which is why the net10 build was clean and the failure only surfaced at runtime on net48. Keep Vulkan (and its unsigned deps) out of the base library and out of every strong-named / Apple-linked assembly by moving the tests into two dedicated, non-strong-named projects: * tests/SkiaSharp.Vulkan.Tests.Console — a standalone Microsoft.Testing.Platform exe (net10 + net48), SignAssembly=false. It ProjectReferences the signed SkiaSharp.Tests.Console for shared infra (unsigned -> signed is allowed) plus Silk.NET/SharpVk. This is the net48 fix: an unsigned host can load the unsigned Vulkan deps. * tests/SkiaSharp.Vulkan.Tests — a library targeting only net10-android / -windows, SignAssembly=false, referenced by the Devices host and registered in MauiProgram. This is the Apple fix: Vulkan never reaches the iOS/MacCatalyst heads. To make the Vulkan renderer discoverable from these separate assemblies in the single-process device host, CatalogReflection now scans the catalog + entry + all loaded SkiaSharp.* assemblies (this also preps the identical pattern for a future D3D test lib: reference the lib + register it in MauiProgram). VisualMatrixTests switches from RendererCatalog.AllNames to NamesIn(own assembly) so the base matrix and each satellite only run their own renderers — no cell is executed twice when both are loaded. A per-assembly VulkanGpuRenderingCollection serializes the Vulkan GPU classes within the satellite/lib the way GpuRenderingCollection does for GL/Metal in the main process. Validated locally: base/Console/satellite-Console build (net10); the iOS and Mac Catalyst Devices heads now build (the _vk link error is gone); the Android head builds and the emulator renders all 5 ganesh-vulkan cells green with no double-run; the satellite Console runs on macOS and skips Vulkan cleanly (0 failures). net48 + Windows Vulkan are validated on CI. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 51747b15-4eb0-467b-8bc8-7029e750e7e1
SkiaSharp.Vulkan.Tests.Console was already present in the netcore and netfx test-assembly lists on main; the Option A rework had removed it and the follow-up restore re-added it in a different position, leaving a pure line-reordering with no functional effect. Restore the original ordering so the diff carries only real changes. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 51747b15-4eb0-467b-8bc8-7029e750e7e1
…Shader) The Vulkan visual/GPU tests already compile on the Windows test legs and libSkiaSharp is built with Vulkan, but every ganesh-vulkan cell skips: the headless windows-2022 agents have no registered Vulkan ICD and no guaranteed loader, so vkEnumeratePhysicalDevices returns 0, SilkVkContext throws, and the matrix reports the cell as unavailable. Give both Windows legs (net-current and net48, x64 and x86) a software ICD + loader the same way the Linux leg uses Mesa lavapipe, but sourced from first-party, Apache-2.0, signed Silk.NET native NuGet packages instead of a committed binary or a bespoke download script: - Silk.NET.Vulkan.SwiftShader.Native -> vk_swiftshader.dll + vk_swiftshader_icd.json - Silk.NET.Vulkan.Loader.Native -> vulkan-1.dll (the Khronos loader) The csproj takes only the native assets (ExcludeAssets=build) and copies the correct bitness next to the test host itself, so net48 and net-current behave identically (the packages' own targets are net461-only). Silk.NET loads vulkan-1.dll by filename off the OS search path (not via deps.json), so the loader must be app-local; a no-RID netcore restore would not place it there, and the Windows loader discovers ICDs through the registry rather than the app dir, so VulkanIcdEnvironmentFixture (an xUnit assembly fixture that runs once before any test) points VK_ICD_FILENAMES/VK_DRIVER_FILES at the copied manifest. Everything is Windows-gated and skip-safe: on Linux/macOS/Android nothing is restored or copied, and if the ICD/loader is ever missing or broken the Vulkan cells simply skip (only a missing native entry point is a real failure), so this can only add coverage, never turn a leg red. The Linux/Android provisioning is untouched. First green Windows run will report the ganesh-vulkan.windows cells as "unseeded" (real SwiftShader pixels captured into the TRX, but no golden committed yet); those goldens are harvested from the leg's own output in a follow-up seeding commit, exactly like Linux and Android. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
Make the ganesh-vulkan visual/GPU tests EXECUTE on the Windows (.NET Core) CI leg by provisioning a software Vulkan ICD + the Khronos loader, mirroring the Linux leg's Mesa lavapipe setup. Additive and skip-safe by design. Pivot away from the earlier NuGet <PackageReference> approach: the two Silk.NET *.Native packages are not on the repo's curated dotnet-public / dotnet-eng feeds (nuget.org is deliberately excluded via nuget.config <clear/>), so restore fails with NU1101. Instead a preBuildStep downloads those same first-party, Apache-2.0, signed binaries by immutable api.nuget.org flat-container URL + pinned SHA-256 (the install-7zip.ps1 / LLVM convention) - a plain HTTPS artifact fetch, not a feed - then registers them for the loader. - scripts/infra/native/windows/install-vulkan-icd.ps1 (new): downloads + SHA-verifies + extracts vulkan-1.dll (Loader.Native) and vk_swiftshader.dll + vk_swiftshader_icd.json (SwiftShader.Native) for win-x64, prepends the extract dir to PATH (loader discovery) and sets VK_ICD_FILENAMES / VK_DRIVER_FILES to the manifest (ICD discovery). Any failure warns and exits 0 - a missing ICD just skips the Vulkan cells, never reds the leg. - scripts/azure-templates-stages-test.yml: add one pwsh preBuildStep to the tests_netcore_windows leg only. netfx/Linux/Android untouched. - Revert the csproj PackageReference/Content additions and remove VulkanIcdEnvironmentFixture (env is now set by the preBuildStep). First green Windows run will report the ganesh-vulkan.windows cells as "unseeded" (SwiftShader is a third engine vs Linux lavapipe / Android emulator, so it needs its own goldens); harvest them from this leg's TRX in a follow-up seeding commit. Only a broken binding (EntryPointNotFound) would be a real failure. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
The provisioning step succeeds (downloads + SHA-verifies + extracts the
SwiftShader ICD and Khronos loader), but the ganesh-vulkan visual cells
still SKIP on the Windows (.NET Core) leg with 'vkCreateInstance failed' /
'Unable to create a Vulkan context on this host'. That is a skip, not a
failure, but it is not the PROOF we want.
To pinpoint whether the loader cannot load vk_swiftshader.dll (missing
dependency vs arch mismatch) or the loader rejects the ICD manifest, add a
self-contained, skip-safe diagnostic to install-vulkan-icd.ps1 that runs in
the fast provisioning step itself:
- Emit VK_LOADER_DEBUG=error,warn for the test leg so the loader explains
ICD accept/reject decisions in the test log too.
- In-process P/Invoke smoke test (own inner try/catch, only warns):
* LoadLibraryW(vk_swiftshader.dll) -> reports the Win32 error so we can
tell 126 (missing dependency DLL, e.g. VC++ runtime) from 193 (arch
mismatch) from success.
* vkCreateInstance via vulkan-1.dll with VK_LOADER_DEBUG=all -> reports
the VkResult and prints the loader's exact reason, without needing the
9 MB test TRX.
Env vars are emitted BEFORE the smoke test and the script still exits 0 in
all paths, so the real test run and skip-safety are unchanged. Diagnostic
only; no behaviour change to the tests themselves.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
…ader ignores VK_* env vars)
Build 159017's in-step smoke test proved the real cause of the ganesh-vulkan
skip on the Windows (.NET Core) leg, and it is NOT a missing VC++ redist:
SMOKE: LoadLibrary(vk_swiftshader.dll) OK
INFO: Loader is running with elevated permissions. Environment variable
VK_ICD_FILENAMES will be ignored
INFO: ... VK_DRIVER_FILES will be ignored
ERROR: windows_read_data_files_in_registry: Registry lookup failed to get
ICD manifest files. Possibly missing Vulkan driver?
ERROR: vkCreateInstance: Found no drivers!
SMOKE: vkCreateInstance -> -9 (INCOMPATIBLE_DRIVER)
The SwiftShader DLL loads fine (redist present). The Khronos loader
deliberately IGNORES VK_ICD_FILENAMES / VK_DRIVER_FILES / VK_ADD_DRIVER_FILES
in elevated processes for security (docs/LoaderDriverInterface.md, "Exception
for Elevated Privileges"), and CI agents run elevated. Our env-var-only ICD
selection was silently discarded, so the loader fell back to the empty
registry and found no driver.
Fix: register the manifest via the officially-documented Windows registry
path -- a REG_DWORD=0 value named with the manifest's absolute path under
HKLM\SOFTWARE\Khronos\Vulkan\Drivers (WOW6432Node for x86). This works
regardless of elevation and is the loader's primary discovery mechanism on
Windows. The VK_* env vars are kept as a harmless non-elevated fallback.
Still skip-safe: registry write is wrapped in try/catch and the script always
exits 0. The in-step smoke test now runs after registration, so its
vkCreateInstance should report VK_SUCCESS as in-step proof before the tests.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
…ftShader The Windows (.NET Core) CI leg now executes the ganesh-vulkan visual cells against the software SwiftShader ICD provisioned by install-vulkan-icd.ps1. Build 159021 rendered 5 real 256x256 images (reported "unseeded" because no Windows goldens existed yet): DiagonalLines, FilledCircle, GradientBlend, RedRoundedRectOnWhite, Text These are harvested verbatim from that leg's own visual-failures artifact and committed as the ganesh-vulkan.windows goldens (mirroring how the Linux lavapipe and Android SwiftShader goldens were seeded). GradientBlend carries 689 distinct colors; the simple-shape renders match the Linux byte sizes almost exactly, confirming genuine GPU output. ganesh-vulkan uses the Gpu tolerance (+/-12 per channel, 2% outlier), so a deterministic SwiftShader re-run compares cleanly. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
32bfe80 to
9dce62e
Compare
… + Linux (#4527) Add SkiaSharp.Vulkan.Silk.NET package and run Vulkan tests on Android + Linux (#4527) SkiaSharp's only managed Vulkan helper was SkiaSharp.Vulkan.SharpVk, pinned to SharpVk 0.4.2 (a 2018 release). SharpVk is effectively unmaintained and its native loader throws NotSupportedException on Android -- it only handles Windows and Linux -- so the Vulkan tests have always been desktop/Windows-only. With the Graphite GPU backend (#3968) bringing Vulkan to mobile, we need a managed Vulkan binding that actually works on Android. ~~ New package: SkiaSharp.Vulkan.Silk.NET ~~ Adds a convenience package (namespace SkiaSharp, netstandard2.0 -> net10.0) built on the actively maintained, cross-platform Silk.NET.Vulkan, mirroring the shape of the existing SharpVk package. GRSilkNetBackendContext maps Silk.NET's Instance/PhysicalDevice/Device/Queue (nint handles) plus a pinned PhysicalDeviceFeatures onto SkiaSharp's raw-IntPtr GRVkBackendContext and bridges the GetProcedureAddress delegate Skia uses to resolve Vulkan entry points. GRVkExtensionsSilkNetExtensions.Initialize(...) is a typed extension (plus an overload taking instance/device extension arrays). SkiaSharp.Vulkan.SharpVk is intentionally left untouched; nothing is removed. ~~ Core API: public GRVkExtensions constructor ~~ The parameterless GRVkExtensions() constructor is changed from private to public, mirroring native skgpu::VulkanExtensions (default-construct, then init) and SkiaSharp's own allocating SKPaint/SKPath constructors. This lets the Silk.NET helper expose a plain Initialize(...) extension instead of a bespoke Create(...) factory. GRVkExtensions.Create(...) is unchanged. This is the only change to a shipping package and is purely additive (a widened accessibility), so it is ABI/API-safe. ~~ Test restructuring: keep unsigned Vulkan deps off Apple + net48 ~~ The Vulkan tests bring Vulkan up through a headless Silk.NET context (SilkVkContext) that uses the OS-provided loader, so they run anywhere a Vulkan ICD is present. An earlier iteration folded the unsigned Silk.NET.Vulkan/SharpVk dependencies into the shared, strong-named SkiaSharp.Tests base library, which broke three CI legs: * iOS / Mac Catalyst -- the Apple AOT linker must resolve every native symbol at link time; there is no libvulkan on Apple, so the link failed with "clang++ ... Undefined symbols: _vkBindImageMemory" (and friends). * Windows .NET Framework (net48) -- the full framework enforces strong-name references at load time, so the strong-named host could not load the unsigned Silk.NET.Vulkan and threw FileLoadException "A strongly-named assembly is required" (0x80131044). .NET Core does not enforce this, which is why the net10 build was clean and the failure only surfaced at runtime on net48. To keep those dependencies out of the base library and out of every strong-named / Apple-linked assembly, the Vulkan tests now live in two dedicated, non-strong- named projects: * tests/SkiaSharp.Vulkan.Tests.Console -- a standalone Microsoft.Testing.Platform executable (net10.0 + net48, SignAssembly=false) that references the signed SkiaSharp.Tests.Console for shared infrastructure (unsigned -> signed is allowed) plus Silk.NET/SharpVk. This is the desktop runner (Linux/Lavapipe and Windows). * tests/SkiaSharp.Vulkan.Tests -- a library targeting only net10.0-android / -windows, referenced by the MAUI Devices host and registered in MauiProgram, so Vulkan never reaches the iOS/Mac Catalyst heads. Supporting changes so the separate assemblies integrate with the shared visual- regression harness: * CatalogReflection discovers renderers across the catalog, entry, and all loaded SkiaSharp.* assemblies, so the ganesh-vulkan renderer (in the separate Vulkan library) joins the shared VisualMatrixTests inside the single-process Devices host. This also preps the identical pattern for a future Direct3D test library: reference the library + register its assembly. * VisualMatrixTests matches only its own assembly's renderers (NamesIn(own assembly) instead of AllNames), so the base matrix and each satellite never double-run a cell when both are loaded in one process. * GPU rendering is serialized with an xUnit [Collection(DisableParallelization = true)] instead of the previous process-wide GpuRenderGate static lock. xUnit collections are scoped to a single assembly, so each assembly carries its own definition -- GpuRenderingCollection (base, GL/Metal) and VulkanGpuRenderingCollection (Vulkan). No cross-assembly lock is needed because the base and Vulkan tests never run concurrently: the Console hosts run them as separate processes, and DeviceRunners executes registered assemblies sequentially. * tests/Dockerfile.linux installs libvulkan1 + mesa-vulkan-drivers (Mesa Lavapipe software ICD) so the Vulkan GPU tests render headlessly in the container. ~~ Validation ~~ * Linux (repo test container + Mesa Lavapipe): Silk.NET Vulkan tests render and pass; the visual matrix is green against the seeded ganesh-vulkan.linux goldens. * Android (API 36 arm64 emulator, ranchu ICD): Vulkan comes up through libvulkan.so and all five ganesh-vulkan.android cells pass against seeded goldens -- the platform SharpVk could never reach -- with each renderer run exactly once (no double-run). * iOS / Mac Catalyst: the Devices heads build cleanly again; the earlier "Undefined symbols: _vk*" link failures are gone. * CI: green on the xamarin "SkiaSharp (Public)" pipeline; the previously-red iOS, Mac Catalyst, and Windows .NET Framework legs all report 0 failed tests. Windows Vulkan CI enablement (a software SwiftShader ICD + ganesh-vulkan.windows goldens) is delivered by the stacked follow-up #4531, which lands on top of this PR. Follow-up: the new public types and the now-public GRVkExtensions constructor still need generated mdoc XML via the normal docs flow. Co-authored-by: Matthew Leibowitz <[email protected]> Co-authored-by: Copilot App <[email protected]>
…Shader) The Vulkan visual/GPU tests already compile on the Windows test legs and libSkiaSharp is built with Vulkan, but every ganesh-vulkan cell skips: the headless windows-2022 agents have no registered Vulkan ICD and no guaranteed loader, so vkEnumeratePhysicalDevices returns 0, SilkVkContext throws, and the matrix reports the cell as unavailable. Give both Windows legs (net-current and net48, x64 and x86) a software ICD + loader the same way the Linux leg uses Mesa lavapipe, but sourced from first-party, Apache-2.0, signed Silk.NET native NuGet packages instead of a committed binary or a bespoke download script: - Silk.NET.Vulkan.SwiftShader.Native -> vk_swiftshader.dll + vk_swiftshader_icd.json - Silk.NET.Vulkan.Loader.Native -> vulkan-1.dll (the Khronos loader) The csproj takes only the native assets (ExcludeAssets=build) and copies the correct bitness next to the test host itself, so net48 and net-current behave identically (the packages' own targets are net461-only). Silk.NET loads vulkan-1.dll by filename off the OS search path (not via deps.json), so the loader must be app-local; a no-RID netcore restore would not place it there, and the Windows loader discovers ICDs through the registry rather than the app dir, so VulkanIcdEnvironmentFixture (an xUnit assembly fixture that runs once before any test) points VK_ICD_FILENAMES/VK_DRIVER_FILES at the copied manifest. Everything is Windows-gated and skip-safe: on Linux/macOS/Android nothing is restored or copied, and if the ICD/loader is ever missing or broken the Vulkan cells simply skip (only a missing native entry point is a real failure), so this can only add coverage, never turn a leg red. The Linux/Android provisioning is untouched. First green Windows run will report the ganesh-vulkan.windows cells as "unseeded" (real SwiftShader pixels captured into the TRX, but no golden committed yet); those goldens are harvested from the leg's own output in a follow-up seeding commit, exactly like Linux and Android. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
Make the ganesh-vulkan visual/GPU tests EXECUTE on the Windows (.NET Core) CI leg by provisioning a software Vulkan ICD + the Khronos loader, mirroring the Linux leg's Mesa lavapipe setup. Additive and skip-safe by design. Pivot away from the earlier NuGet <PackageReference> approach: the two Silk.NET *.Native packages are not on the repo's curated dotnet-public / dotnet-eng feeds (nuget.org is deliberately excluded via nuget.config <clear/>), so restore fails with NU1101. Instead a preBuildStep downloads those same first-party, Apache-2.0, signed binaries by immutable api.nuget.org flat-container URL + pinned SHA-256 (the install-7zip.ps1 / LLVM convention) - a plain HTTPS artifact fetch, not a feed - then registers them for the loader. - scripts/infra/native/windows/install-vulkan-icd.ps1 (new): downloads + SHA-verifies + extracts vulkan-1.dll (Loader.Native) and vk_swiftshader.dll + vk_swiftshader_icd.json (SwiftShader.Native) for win-x64, prepends the extract dir to PATH (loader discovery) and sets VK_ICD_FILENAMES / VK_DRIVER_FILES to the manifest (ICD discovery). Any failure warns and exits 0 - a missing ICD just skips the Vulkan cells, never reds the leg. - scripts/azure-templates-stages-test.yml: add one pwsh preBuildStep to the tests_netcore_windows leg only. netfx/Linux/Android untouched. - Revert the csproj PackageReference/Content additions and remove VulkanIcdEnvironmentFixture (env is now set by the preBuildStep). First green Windows run will report the ganesh-vulkan.windows cells as "unseeded" (SwiftShader is a third engine vs Linux lavapipe / Android emulator, so it needs its own goldens); harvest them from this leg's TRX in a follow-up seeding commit. Only a broken binding (EntryPointNotFound) would be a real failure. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
The provisioning step succeeds (downloads + SHA-verifies + extracts the
SwiftShader ICD and Khronos loader), but the ganesh-vulkan visual cells
still SKIP on the Windows (.NET Core) leg with 'vkCreateInstance failed' /
'Unable to create a Vulkan context on this host'. That is a skip, not a
failure, but it is not the PROOF we want.
To pinpoint whether the loader cannot load vk_swiftshader.dll (missing
dependency vs arch mismatch) or the loader rejects the ICD manifest, add a
self-contained, skip-safe diagnostic to install-vulkan-icd.ps1 that runs in
the fast provisioning step itself:
- Emit VK_LOADER_DEBUG=error,warn for the test leg so the loader explains
ICD accept/reject decisions in the test log too.
- In-process P/Invoke smoke test (own inner try/catch, only warns):
* LoadLibraryW(vk_swiftshader.dll) -> reports the Win32 error so we can
tell 126 (missing dependency DLL, e.g. VC++ runtime) from 193 (arch
mismatch) from success.
* vkCreateInstance via vulkan-1.dll with VK_LOADER_DEBUG=all -> reports
the VkResult and prints the loader's exact reason, without needing the
9 MB test TRX.
Env vars are emitted BEFORE the smoke test and the script still exits 0 in
all paths, so the real test run and skip-safety are unchanged. Diagnostic
only; no behaviour change to the tests themselves.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
…ader ignores VK_* env vars)
Build 159017's in-step smoke test proved the real cause of the ganesh-vulkan
skip on the Windows (.NET Core) leg, and it is NOT a missing VC++ redist:
SMOKE: LoadLibrary(vk_swiftshader.dll) OK
INFO: Loader is running with elevated permissions. Environment variable
VK_ICD_FILENAMES will be ignored
INFO: ... VK_DRIVER_FILES will be ignored
ERROR: windows_read_data_files_in_registry: Registry lookup failed to get
ICD manifest files. Possibly missing Vulkan driver?
ERROR: vkCreateInstance: Found no drivers!
SMOKE: vkCreateInstance -> -9 (INCOMPATIBLE_DRIVER)
The SwiftShader DLL loads fine (redist present). The Khronos loader
deliberately IGNORES VK_ICD_FILENAMES / VK_DRIVER_FILES / VK_ADD_DRIVER_FILES
in elevated processes for security (docs/LoaderDriverInterface.md, "Exception
for Elevated Privileges"), and CI agents run elevated. Our env-var-only ICD
selection was silently discarded, so the loader fell back to the empty
registry and found no driver.
Fix: register the manifest via the officially-documented Windows registry
path -- a REG_DWORD=0 value named with the manifest's absolute path under
HKLM\SOFTWARE\Khronos\Vulkan\Drivers (WOW6432Node for x86). This works
regardless of elevation and is the loader's primary discovery mechanism on
Windows. The VK_* env vars are kept as a harmless non-elevated fallback.
Still skip-safe: registry write is wrapped in try/catch and the script always
exits 0. The in-step smoke test now runs after registration, so its
vkCreateInstance should report VK_SUCCESS as in-step proof before the tests.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
…ftShader The Windows (.NET Core) CI leg now executes the ganesh-vulkan visual cells against the software SwiftShader ICD provisioned by install-vulkan-icd.ps1. Build 159021 rendered 5 real 256x256 images (reported "unseeded" because no Windows goldens existed yet): DiagonalLines, FilledCircle, GradientBlend, RedRoundedRectOnWhite, Text These are harvested verbatim from that leg's own visual-failures artifact and committed as the ganesh-vulkan.windows goldens (mirroring how the Linux lavapipe and Android SwiftShader goldens were seeded). GradientBlend carries 689 distinct colors; the simple-shape renders match the Linux byte sizes almost exactly, confirming genuine GPU output. ganesh-vulkan uses the Gpu tolerance (+/-12 per channel, 2% outlier), so a deterministic SwiftShader re-run compares cleanly. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
…ow-windows-vulkan-ci-icd
…path The provisioning script proved out on build 159023, so collapse it from the exploratory 263-line version to the single path we know the elevated Windows CI agent actually takes (~100 lines): - Drop the ~90-line in-step LoadLibrary/vkCreateInstance smoke test; the real signal is the test run's own render + golden compare. - Drop the x86/WOW6432Node branch and the -Arch param; the netcore host is a 64-bit process, so only win-x64 is ever provisioned. YAML drops -Arch x64. - Drop the VK_ICD_FILENAMES / VK_DRIVER_FILES env fallbacks: the elevated loader ignores them and reads only the HKLM registry (kept, with a comment explaining why env vars can't replace it here). - Drop VK_LOADER_DEBUG, verbose dumps, and redundant post-extract existence checks (Zip extraction already throws on a missing entry). Behaviour is unchanged on the deterministic path: download the two pinned Silk.NET native nupkgs by immutable api.nuget.org URL, SHA-256 verify, extract vulkan-1.dll + vk_swiftshader.dll + the ICD json, register the ICD in HKLM, and prepend the dir to PATH. The outer try/catch -> exit 0 skip-safety guard is preserved, so a missing/broken ICD still just skips, never turns red. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
Two follow-ups to the slim-down: - Drop the skip-safe try/catch -> exit 0 wrapper. Now that the path is deterministic and proven, a provisioning failure (download, SHA mismatch, missing package entry, registry) should turn the build RED rather than silently drop Vulkan coverage. $ErrorActionPreference = 'Stop' makes any error terminate the pwsh step. The test-layer skip in VKTest.cs still covers genuinely-unsupported environments, but on CI we require the ICD to be here. - Make the package versions plain consts alongside their SHA-256s instead of Param() defaults. They must be bumped in lockstep (a version override with a stale SHA would just fail the hash gate), so params gave a false sense of independent tunability. This is CI config, updated manually. YAML preBuildStep comment updated to match (required, fails the build). Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
output/ is reserved for artifacts our own native build produces. Downloaded third-party native deps belong in externals/ next to angle/ and winappsdk/ (the WinAppSDK NuGet download+extract is the direct analog), so gitignore a new externals/vulkan-icd/ and extract the loader + SwiftShader ICD there. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
Point install-vulkan-icd.ps1 at the dnceng dotnet-public NuGet mirror (the same feed the WinAppSDK/ANGLE provisioning uses) instead of api.nuget.org, which is blocked internally. The pinned .nupkg SHA-256s are unchanged (the mirror serves byte-identical packages). Also simplify the extraction: unzip the whole .nupkg with ExtractToDirectory and flatten the win-x64 native binaries into externals/vulkan-icd, replacing the per-entry OpenRead/GetEntry loop. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
Add the SwiftShader ICD provisioning preBuildStep to the Windows (.NET Framework) test leg so ganesh-vulkan executes there as well, and condense the netcore leg's provisioning comment to one line. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 6d633b27-19dd-4a66-b77a-2b950c86c729
… + Linux (#4527) Add SkiaSharp.Vulkan.Silk.NET package and run Vulkan tests on Android + Linux (#4527) SkiaSharp's only managed Vulkan helper was SkiaSharp.Vulkan.SharpVk, pinned to SharpVk 0.4.2 (a 2018 release). SharpVk is effectively unmaintained and its native loader throws NotSupportedException on Android -- it only handles Windows and Linux -- so the Vulkan tests have always been desktop/Windows-only. With the Graphite GPU backend (#3968) bringing Vulkan to mobile, we need a managed Vulkan binding that actually works on Android. ~~ New package: SkiaSharp.Vulkan.Silk.NET ~~ Adds a convenience package (namespace SkiaSharp, netstandard2.0 -> net10.0) built on the actively maintained, cross-platform Silk.NET.Vulkan, mirroring the shape of the existing SharpVk package. GRSilkNetBackendContext maps Silk.NET's Instance/PhysicalDevice/Device/Queue (nint handles) plus a pinned PhysicalDeviceFeatures onto SkiaSharp's raw-IntPtr GRVkBackendContext and bridges the GetProcedureAddress delegate Skia uses to resolve Vulkan entry points. GRVkExtensionsSilkNetExtensions.Initialize(...) is a typed extension (plus an overload taking instance/device extension arrays). SkiaSharp.Vulkan.SharpVk is intentionally left untouched; nothing is removed. ~~ Core API: public GRVkExtensions constructor ~~ The parameterless GRVkExtensions() constructor is changed from private to public, mirroring native skgpu::VulkanExtensions (default-construct, then init) and SkiaSharp's own allocating SKPaint/SKPath constructors. This lets the Silk.NET helper expose a plain Initialize(...) extension instead of a bespoke Create(...) factory. GRVkExtensions.Create(...) is unchanged. This is the only change to a shipping package and is purely additive (a widened accessibility), so it is ABI/API-safe. ~~ Test restructuring: keep unsigned Vulkan deps off Apple + net48 ~~ The Vulkan tests bring Vulkan up through a headless Silk.NET context (SilkVkContext) that uses the OS-provided loader, so they run anywhere a Vulkan ICD is present. An earlier iteration folded the unsigned Silk.NET.Vulkan/SharpVk dependencies into the shared, strong-named SkiaSharp.Tests base library, which broke three CI legs: * iOS / Mac Catalyst -- the Apple AOT linker must resolve every native symbol at link time; there is no libvulkan on Apple, so the link failed with "clang++ ... Undefined symbols: _vkBindImageMemory" (and friends). * Windows .NET Framework (net48) -- the full framework enforces strong-name references at load time, so the strong-named host could not load the unsigned Silk.NET.Vulkan and threw FileLoadException "A strongly-named assembly is required" (0x80131044). .NET Core does not enforce this, which is why the net10 build was clean and the failure only surfaced at runtime on net48. To keep those dependencies out of the base library and out of every strong-named / Apple-linked assembly, the Vulkan tests now live in two dedicated, non-strong- named projects: * tests/SkiaSharp.Vulkan.Tests.Console -- a standalone Microsoft.Testing.Platform executable (net10.0 + net48, SignAssembly=false) that references the signed SkiaSharp.Tests.Console for shared infrastructure (unsigned -> signed is allowed) plus Silk.NET/SharpVk. This is the desktop runner (Linux/Lavapipe and Windows). * tests/SkiaSharp.Vulkan.Tests -- a library targeting only net10.0-android / -windows, referenced by the MAUI Devices host and registered in MauiProgram, so Vulkan never reaches the iOS/Mac Catalyst heads. Supporting changes so the separate assemblies integrate with the shared visual- regression harness: * CatalogReflection discovers renderers across the catalog, entry, and all loaded SkiaSharp.* assemblies, so the ganesh-vulkan renderer (in the separate Vulkan library) joins the shared VisualMatrixTests inside the single-process Devices host. This also preps the identical pattern for a future Direct3D test library: reference the library + register its assembly. * VisualMatrixTests matches only its own assembly's renderers (NamesIn(own assembly) instead of AllNames), so the base matrix and each satellite never double-run a cell when both are loaded in one process. * GPU rendering is serialized with an xUnit [Collection(DisableParallelization = true)] instead of the previous process-wide GpuRenderGate static lock. xUnit collections are scoped to a single assembly, so each assembly carries its own definition -- GpuRenderingCollection (base, GL/Metal) and VulkanGpuRenderingCollection (Vulkan). No cross-assembly lock is needed because the base and Vulkan tests never run concurrently: the Console hosts run them as separate processes, and DeviceRunners executes registered assemblies sequentially. * tests/Dockerfile.linux installs libvulkan1 + mesa-vulkan-drivers (Mesa Lavapipe software ICD) so the Vulkan GPU tests render headlessly in the container. ~~ Validation ~~ * Linux (repo test container + Mesa Lavapipe): Silk.NET Vulkan tests render and pass; the visual matrix is green against the seeded ganesh-vulkan.linux goldens. * Android (API 36 arm64 emulator, ranchu ICD): Vulkan comes up through libvulkan.so and all five ganesh-vulkan.android cells pass against seeded goldens -- the platform SharpVk could never reach -- with each renderer run exactly once (no double-run). * iOS / Mac Catalyst: the Devices heads build cleanly again; the earlier "Undefined symbols: _vk*" link failures are gone. * CI: green on the xamarin "SkiaSharp (Public)" pipeline; the previously-red iOS, Mac Catalyst, and Windows .NET Framework legs all report 0 failed tests. Windows Vulkan CI enablement (a software SwiftShader ICD + ganesh-vulkan.windows goldens) is delivered by the stacked follow-up #4531, which lands on top of this PR. Follow-up: the new public types and the now-public GRVkExtensions constructor still need generated mdoc XML via the normal docs flow. Co-authored-by: Matthew Leibowitz <[email protected]> Co-authored-by: Copilot App <[email protected]>
…#4531) Execute Vulkan visual tests on the Windows CI legs via a software ICD (#4531) Context: #4527 Follow-up to #4527, which added the Silk.NET Vulkan test path and enabled the ganesh-vulkan visual cells on Linux (Mesa lavapipe) and Android (emulator SwiftShader). Windows already compiled the tests and built libSkiaSharp with Vulkan, but the headless CI agent ships no Vulkan driver, so every ganesh-vulkan cell skipped — the backend was built and never exercised. Provision a software Vulkan ICD on the Windows test agent so those cells render and golden-compare instead of skipping, mirroring what the Linux leg does with lavapipe. A pwsh preBuildStep on both Windows test legs (.NET Core and .NET Framework) runs scripts/infra/native/windows/install-vulkan-icd.ps1, which downloads and SHA-256-verifies the Khronos loader (vulkan-1.dll) and Google SwiftShader (vk_swiftshader.dll + vk_swiftshader_icd.json) from pinned, prebuilt Silk.NET native packages, extracts them under externals/vulkan-icd, registers the ICD, and puts the loader on PATH. Register the ICD in HKLM\SOFTWARE\Khronos\Vulkan\Drivers rather than via VK_ICD_FILENAMES / VK_DRIVER_FILES: the agent runs elevated, and the loader ignores those environment variables under elevation, reading the driver list only from the registry. The script fails the leg on any download, checksum, or registry error instead of silently degrading back to a skip — provisioning can only add coverage, never hide a regression. Seed five ganesh-vulkan.windows goldens harvested from the agent's own SwiftShader renders; cross-implementation pixel differences mean Windows goldens must come from the Windows ICD, not from Linux/Android. A future driver-driven mismatch reseeds via scripts/infra/tests/extract-visual-goldens.py, the same flow as the other legs. CI-only change: no product, binding, or test-project code is touched (+88/-0), so apps running against real Vulkan drivers are unaffected. Verified on CI — the x64 Windows .NET Core and .NET Framework legs now run SkiaSharp.Vulkan.Tests.Console with 15 passed / 0 skipped, including all five VulkanVisualTests.RenderMatchesGolden ("ganesh-vulkan") cells, and golden extraction reports 0 mismatch / 0 unseeded. The 32-bit netfx (x86) slice still skips Vulkan (NotExecuted, never failed) because the provisioned SwiftShader ICD is 64-bit only. Linux and Android provisioning is unchanged. Co-authored-by: Copilot App <[email protected]>
Description
Runs the Vulkan visual-regression tests on the Windows CI leg by provisioning a software Vulkan ICD — Google SwiftShader plus the Khronos loader — on the Windows test agent, so the
ganesh-vulkancells render and golden-compare instead of skipping. This mirrors what the Linux leg already does with Mesa lavapipe.Follow-up to #4527, which added the Silk.NET Vulkan test path and enabled these tests on Linux and Android. Windows compiled the tests and built
libSkiaSharpwith Vulkan, but the headless agent has no Vulkan driver, so everyganesh-vulkancell skipped. This change is CI/environment-only — no product, binding, or test-project changes — so users running against real Vulkan drivers are unaffected.What it does: a
pwshpreBuildStep on the Windows .NET Core test leg runs a provisioning script that downloads and SHA-256-verifies the loader (vulkan-1.dll) and SwiftShader (vk_swiftshader.dll+vk_swiftshader_icd.json) from pinned, prebuilt Silk.NET native packages, extracts them underexternals/, registers the ICD, and puts the loader onPATH. It fails the leg on any download, checksum, or registry error rather than silently skipping. Five golden images are seeded from the agent's own SwiftShader renders so the cells have a baseline to compare against.Why registry registration rather than environment variables: the Windows test agent runs elevated, and the Khronos loader ignores
VK_ICD_FILENAMES/VK_DRIVER_FILESunder elevation — it reads the ICD list only fromHKLM\SOFTWARE\Khronos\Vulkan\Drivers. Registering there is what makes the software ICD discoverable.Why a provisioning script rather than a package/
runtimesasset: the tests copy native assets viaProjectReference+IncludeNativeAssets.SkiaSharp.targets, not NuGetruntimes/resolution, and the elevated loader needs the registry key regardless — so this belongs at the CI/environment layer rather than in a.csproj.Related issues
Related to #4527.
Required skia PR
None.
Areas affected
binding/)externals/skia/src/c,include/c)Changes
None — CI-only; no public API or runtime behavior change.
Testing
With the ICD provisioned, the 5
ganesh-vulkan.windowscells now execute on the Windows CI leg — Failed → 0, +5 passing, Skipped unchanged (they were previously counted as skips) — and golden extraction reports 0 mismatch, 0 unseeded. The goldens in this PR were seeded from that run, so a clean pass is expected.Backend/platform: software Vulkan (SwiftShader) on the Windows .NET Core test leg. Not runnable locally (macOS host, no Windows/Vulkan) — verified on CI. Linux (lavapipe) and Android (emulator SwiftShader) provisioning is unchanged.
A future golden mismatch (e.g. from a driver change) would just need a reseed via
scripts/infra/tests/extract-visual-goldens.py, the same flow as Linux/Android.Checklist
Changesabove lists all public API and behavioral changes (or "None.")mono/skiaPR linked above and bindings regenerated (N/A — no native change)