Repository navigation
feat(webgpu): Render with Dawn by default - #26703
Open
ramezgerges wants to merge 15 commits into
Open
ramezgerges wants to merge 15 commits into
ramezgerges wants to merge 15 commits into
Conversation
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]>
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
Contributor
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-26703/docs/index.html |
Contributor
|
The build 248943 found UI Test snapshots differences: Details
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.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.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'sDawnLibrary. The binding tells the engines apart by the loaded library's exports, andUNO_WEBGPU_LIBRARYloads either engine from a path.d3dcompiler_47.dllandvulkan-1.dll, and DXC is turned off so D3D12 compiles with FXC as wgpu-native does: nothing extra ships with the app.DawnInstanceDescriptoris laid out at each C++ ABI's offsets; laid out for MSVC everywhere, it turned full backend validation on outside Windows.[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
webgpu.dllit ships is byte-identical to the package'sruntimes/win-x64/native/webgpu.dll.DawnLibraryexposes every member Uno uses.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-nativewebgpu.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 ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code