Skip to content

feat(webgpu): Render with Dawn by default - #26703

Open
ramezgerges wants to merge 15 commits into
unoplatform:masterfrom
ramezgerges:dev/rara/webgpu-dawn-default
Open

ramezgerges wants to merge 15 commits into
unoplatform:masterfrom
ramezgerges:dev/rara/webgpu-dawn-default

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

GitHub Issue: closes unoplatform/uno-private#2583

PR Type:

✨ Feature

What changed? 🚀

The WebGPU renderer now runs on Dawn by default on every native platform, taken from the Uno.Dawn package (0.1.0-dev.12, built in unoplatform/uno.dawn). wgpu-native remains available with UnoWebGpuNative=WgpuNative.

  • Selecting the library. UnoWebGpuNative=Dawn|WgpuNative (default Dawn) is set in one targets file that the package and the in-repo heads both import. Only the selected engine's libraries reach the app; any other value fails the build with UNOB0037. wgpu-native keeps its own file name (wgpu_native.*) wherever it is provisioned, and the loader looks for both.
  • Running the binding on Dawn. Dawn implements the same webgpu.h; only wgpu-native's own functions need stand-ins (submission indices and the blocking poll become work-done futures, the device asks for implicit synchronization). That glue, the instance creation and the adapter toggles come from Uno.Dawn's DawnLibrary. The binding tells the engines apart by the loaded library's exports, and UNO_WEBGPU_LIBRARY loads either engine from a path.
  • System components. Dawn searches System32 for d3dcompiler_47.dll and vulkan-1.dll, and DXC is turned off so D3D12 compiles with FXC as wgpu-native does: nothing extra ships with the app.
  • Instance descriptor per ABI. DawnInstanceDescriptor is laid out at each C++ ABI's offsets; laid out for MSVC everywhere, it turned full backend validation on outside Windows.
  • X11. A Dawn window gets a 24-bit visual: Dawn's Vulkan swapchain needs opaque compositing, which Mesa doesn't offer on an alpha visual.
  • Packages. The renderer package depends on Uno.Dawn; the init package takes only its managed API, so the native libraries still reach only apps that use WebGPU.
  • Logging. The device initialization line now names the loaded library file, e.g. [webgpu] init device — engine=Dawn library=…\runtimes\win-x64\native\webgpu.dll, so CI logs show which binaries each lane ran.

The branch keeps its history, including the early spike commits (chore(...)), which later commits build on.

Validation so far

  • The branch is rebased on current master; Uno.Dawn 0.1.0-dev.12 restores from nuget.org, and the SamplesApp desktop head builds with it. The webgpu.dll it ships is byte-identical to the package's runtimes/win-x64/native/webgpu.dll.
  • 0.1.0-dev.12's DawnLibrary exposes every member Uno uses.
  • Before this rebase, the same Dawn build (local packages of these scripts) passed the rendering runtime tests on Windows (D3D12, Vulkan), Linux, Android, macOS and the iOS simulator, with the same failures as wgpu-native.
  • A rendering runtime-test run on the published package (Windows, D3D12 on WARP) is in progress; I'll add the results here.

Note for upgrades: the loader looks for the library next to the app before runtimes/<rid>/native. A local output folder that still holds an older wgpu-native webgpu.dll (from a build before this change) loads that instead of Dawn; a clean build fixes it, and the new log line shows it.

PR Checklist ✅

🤖 Generated with Claude Code

ramezgerges and others added 15 commits November 24, 2026 16:06
UNO_WEBGPU_DAWN points the "webgpu" binding at a Dawn build. Dawn
implements the same webgpu.h, so only wgpu-native's own functions need
standing in for: submission indices and the blocking poll become
work-done futures, and the device asks for implicit synchronization
because the backend uses it from several threads.

Reads mapped readback buffers through the const range, which Dawn
requires for a buffer mapped for reading.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit bc26b35968210cf829a80db08c4e5a90903c9f66)
Dawn rejects wgpu-native's instance extras, so the backend choice goes
through the adapter request's backendType instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b3e1ca6a350d3a9e9db9d9b07aed237b34633f55)
-p:UnoDawnAndroidDir packs a Dawn build as libwebgpu.so in place of
wgpu-native: a Release APK resolves the p/invoke itself, so the swap
happens at packaging. The UNO_WEBGPU_DAWN check is now lazy, since
Android sets UNO_* variables from the launch intent in OnCreate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 90cdb77f624d05b2c83ce225fc29bb859fe17f04)
Dawn's Vulkan swapchain requires opaque compositing, which Mesa doesn't
offer on a window with an alpha visual, so every present failed with
"Vulkan SwapChain must support opaque alpha" on Uno's default 32-bit
window.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 06973ca106991f7da16a9a8f2fbca57c26638aab)
The binding stands in for wgpu-native's own functions on Dawn, and X11
gives a Dawn window a visual without alpha. Both now ask the loaded
library (wgpu-native exports wgpuDevicePoll, Dawn does not) instead of
an environment variable, and UNO_WEBGPU_LIBRARY loads a library of
either engine from a path. The init log names the engine.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ader

Dawn opens d3dcompiler_47.dll, dxil.dll and vulkan-1.dll only from its
own folder and the search paths it is given. Its instance now searches
System32, and DXC (not part of Windows) is turned off so D3D12 compiles
with FXC as wgpu-native does, so the library ships without them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Dawn publishes static libraries only. These link each platform's release
into the library the WebGPU binding loads, exporting the webgpu.h API:
webgpu.dll (MSVC), libwebgpu.so (Linux, Android ABIs), libwebgpu.dylib
(macOS) and the iOS static libraries.

- exports.py lists the functions from Dawn's header for each linker.
- Apple: Dawn's objects hide those functions, so unhide-macho.py makes
  them global again before linking or shipping the static library.
- Linux: a strtoul shim and a shared libgcc keep the floor at glibc 2.34
  instead of 2.38.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A pipeline of its own, run when build/dawn changes, produces Dawn for
every native platform and packs it:

- Windows x64 and arm64 built from source against the static C++
  runtime, so the DLL needs no Visual C++ redistributable.
- Linux x64 linked on Ubuntu 22.04; arm64 cross-built from source
  against an Ubuntu 22.04 sysroot assembled without root.
- Android (4 ABIs), macOS and iOS linked from Dawn's releases.
- The package carries Dawn's license and those of the third-party code
  built into it, and targets linking Dawn into iOS apps.

The package version is the Dawn release tag (0.20260624.223603).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Windows: abseil picks its C runtime on its own (ABSL_MSVC_STATIC_RUNTIME),
  and protobuf is off, as a cross-build cannot run protoc.
- Linux arm64 links with clang and lld against the sysroot.
- The license file is LICENSE.txt (an extensionless one lands in a
  folder) and staging sits beside the pack output, which pack skips.
- Desktop apps no longer copy the Android libraries; the drop targets
  run before the copy and qualify the metadata they test.
- pack.py --partial packs what is there, for a local test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
DawnInstanceDescriptor derives from the 2-field chained struct. Outside
MSVC its fields start in the base's tail padding, so a C# struct laid
out for MSVC put the search paths where Dawn reads the validation level
on Linux, Android and Apple, turning full backend validation on. The
fields are now written at the offsets each ABI gives.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The WebGPU backend depends on Uno.WinUI.Composition.WebGpu.Dawn and
loads Dawn on every native platform. UnoWebGpuNative=WgpuNative selects
wgpu-native instead, which now keeps its own file name (wgpu_native.*)
everywhere it is provisioned; only the selected engine reaches the app,
and the loader looks for both.

Needs Uno.WinUI.Composition.WebGpu.Dawn 0.20260624.223603 on a feed
before it can restore (.vsts-ci-dawn.yml publishes it).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Dawn's libraries and the managed code that runs the wgpu-native binding
on Dawn (instance creation, wgpu-native's extension stand-ins, the
adapter toggles, telling the engines apart) now come from Uno.Dawn,
built in unoplatform/uno.dawn. build/dawn and its pipeline move there.

The renderer takes the whole package. Init takes only its managed API:
every runtime host references Init, so the native libraries still reach
only the apps that use WebGPU.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…uNative

The default (Dawn) is set in one targets file that both the package and
the in-repo heads import, and every target that ships or drops a library
now compares against an explicit value. Any other value fails the build
with UNOB0037 instead of falling back to Dawn.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first published Uno.Dawn, built from source for every platform and
for size. It exposes the same DawnLibrary API as 0.1.0-dev.4.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The device initialization line names the engine; it now also names the
file it came from (the path on desktop), so a run shows it used the
Uno.Dawn package's library rather than a stale one left in the output.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation platform/x11 🐧 Categorizes an issue or PR as relevant to X11 labels Nov 24, 2026
@mergify

mergify Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 248943 found UI Test snapshots differences: skia-linux-screenshots: 261, skia-windows-screenshots: 271

Details
  • skia-linux-screenshots: 261 changed over 2504

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppWindowTitleBar Properties.png-dark
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • Accessibility_Showcase.png
    • AutomationProperties_StructureAndProps.png-dark
    • AutomationProperties_StructureAndProps.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Accessibility_Showcase.png-dark
    • AnimatedBackVisualSourceSamplePage.png
    • BasicAcrylicBrushTest.png-dark
    • BasicAcrylicBrushTest.png
  • skia-windows-screenshots: 271 changed over 2504

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AutomationProperties_StructureAndProps.png-dark
    • Basics.png-dark
    • Basics.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • Accessibility_Showcase.png-dark
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AnimatedVisualsTestbedPage.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • AnimatedBackVisualSourceSamplePage.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • AutomationProperties_StructureAndProps.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation platform/x11 🐧 Categorizes an issue or PR as relevant to X11

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants