From 3c278ea8cb6973b757a3d6af8f1ccbd448e3e069 Mon Sep 17 00:00:00 2001
From: botoddly <250804054+botoddly@users.noreply.github.com>
Date: Mon, 9 Nov 2026 22:43:07 +0100
Subject: [PATCH] Link XDL's prebuilt emdawnwebgpu instead of the port, so
browser apps need no writable Emscripten cache
---
Directory.Build.props | 2 ++
Directory.Build.targets | 1 -
README.md | 2 +-
XDL_VERSION | 2 +-
.../XdlSharp.Native.browser-wasm.targets | 10 ++++++----
.../XdlSharp.Browser.Tests.csproj | 6 +++---
.../XdlSharp.Package.Browser.Tests.csproj | 1 -
7 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index 94c94a9..2a7f776 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -13,6 +13,8 @@
$(XdlVersion.Split('-')[0])
$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'artifacts', 'xdl', '$(XdlVersion)'))
$(XdlReleaseDirectory)include/
+
+ $(XdlReleaseDirectory)runtimes/browser-wasm/native/
diff --git a/Directory.Build.targets b/Directory.Build.targets
index 7a00fdf..284d619 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -1,7 +1,6 @@
$(XdlReleaseDirectory)runtimes/$(NETCoreSdkPortableRuntimeIdentifier)/native/
- $(XdlReleaseDirectory)runtimes/browser-wasm/native/
headers;$(NETCoreSdkPortableRuntimeIdentifier);browser-wasm-net11
diff --git a/README.md b/README.md
index f7afb28..d0faf0c 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ Pointer window = SDL_CreateWindow("Title"u8, 640, 480, SDL_WindowFla
- `XdlSharp` holds the bindings. It is the same for every platform and holds no native library.
- `XdlSharp.Native.` holds XDL's runtime for one platform, from the XDL release: `linux-x64`, `linux-arm64`, `osx-x64`, `osx-arm64`, `win-x64`, `win-arm64` or `browser-wasm`. An app references the packages of the platforms it runs on.
-- `XdlSharp.Native.browser-wasm` links its archives into `dotnet.native.wasm` and adds `--use-port=emdawnwebgpu` to the link. The link builds that Emscripten port into the Emscripten cache. The workload's own cache is read-only, so set `WasmCachePath` to a writable directory.
+- `XdlSharp.Native.browser-wasm` links its archives into `dotnet.native.wasm`, with emdawnwebgpu, the WebGPU binding that XDL calls, which XDL ships prebuilt. The link needs the `wasm-tools` workload and no writable Emscripten cache. To create a GPU device from the page, as the .NET runtime requires, also export `WebGPU` with `EmccExportedRuntimeMethod` and `_wgpuCreateInstance` with `EmccExportedFunction`.
The version is the SDL version and a release number, such as `3.4.20.1`. The package description names the XDL release, such as `3.4.20-4`.
diff --git a/XDL_VERSION b/XDL_VERSION
index edb0958..76001f6 100644
--- a/XDL_VERSION
+++ b/XDL_VERSION
@@ -1 +1 @@
-3.4.20-4
+3.4.20-9
diff --git a/packaging/XdlSharp.Native/buildTransitive/XdlSharp.Native.browser-wasm.targets b/packaging/XdlSharp.Native/buildTransitive/XdlSharp.Native.browser-wasm.targets
index eee05d4..25b2572 100644
--- a/packaging/XdlSharp.Native/buildTransitive/XdlSharp.Native.browser-wasm.targets
+++ b/packaging/XdlSharp.Native/buildTransitive/XdlSharp.Native.browser-wasm.targets
@@ -1,14 +1,16 @@
-
+
+
- $(EmccExtraLDFlags) --use-port=emdawnwebgpu
+ $(EmccExtraLDFlags) --js-library "$(MSBuildThisFileDirectory)native/library_webgpu_enum_tables.js" --js-library "$(MSBuildThisFileDirectory)native/library_webgpu_generated_struct_info.js" --js-library "$(MSBuildThisFileDirectory)native/library_webgpu_generated_sig_info.js" --js-library "$(MSBuildThisFileDirectory)native/library_webgpu.js"
diff --git a/tests/XdlSharp.Browser.Tests/XdlSharp.Browser.Tests.csproj b/tests/XdlSharp.Browser.Tests/XdlSharp.Browser.Tests.csproj
index ceeaac5..46ed4f3 100644
--- a/tests/XdlSharp.Browser.Tests/XdlSharp.Browser.Tests.csproj
+++ b/tests/XdlSharp.Browser.Tests/XdlSharp.Browser.Tests.csproj
@@ -9,9 +9,8 @@
false
false
true
-
- $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..', '..', 'artifacts', 'em-cache'))
- $(EmccExtraLDFlags) --use-port=emdawnwebgpu
+
+ $(EmccExtraLDFlags) --js-library "$(XdlBrowserDirectory)library_webgpu_enum_tables.js" --js-library "$(XdlBrowserDirectory)library_webgpu_generated_struct_info.js" --js-library "$(XdlBrowserDirectory)library_webgpu_generated_sig_info.js" --js-library "$(XdlBrowserDirectory)library_webgpu.js"
@@ -20,6 +19,7 @@
+
diff --git a/tests/XdlSharp.Package.Browser.Tests/XdlSharp.Package.Browser.Tests.csproj b/tests/XdlSharp.Package.Browser.Tests/XdlSharp.Package.Browser.Tests.csproj
index 1141fc6..d5c7b0f 100644
--- a/tests/XdlSharp.Package.Browser.Tests/XdlSharp.Package.Browser.Tests.csproj
+++ b/tests/XdlSharp.Package.Browser.Tests/XdlSharp.Package.Browser.Tests.csproj
@@ -10,7 +10,6 @@
false
false
false
- $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..', '..', 'artifacts', 'em-cache'))