Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<XdlSdlVersion>$(XdlVersion.Split('-')[0])</XdlSdlVersion>
<XdlReleaseDirectory>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'artifacts', 'xdl', '$(XdlVersion)'))</XdlReleaseDirectory>
<XdlIncludeDirectory>$(XdlReleaseDirectory)include/</XdlIncludeDirectory>
<!-- Here and not in Directory.Build.targets, because a project's properties, such as EmccExtraLDFlags, read it. -->
<XdlBrowserDirectory>$(XdlReleaseDirectory)runtimes/browser-wasm/native/</XdlBrowserDirectory>
</PropertyGroup>

<!-- A release passes -p:Version=<SDL version>.<N>; any other pack is marked local, so it never passes for a release. -->
Expand Down
1 change: 0 additions & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project>
<PropertyGroup>
<XdlRuntimeDirectory>$(XdlReleaseDirectory)runtimes/$(NETCoreSdkPortableRuntimeIdentifier)/native/</XdlRuntimeDirectory>
<XdlBrowserDirectory>$(XdlReleaseDirectory)runtimes/browser-wasm/native/</XdlBrowserDirectory>
<!-- The headers, the runtime for this machine and the browser archives, unless a project names other XDL targets. -->
<XdlReleaseTargets Condition="'$(XdlReleaseTargets)' == ''">headers;$(NETCoreSdkPortableRuntimeIdentifier);browser-wasm-net11</XdlReleaseTargets>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Pointer<SDL_Window> 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.<rid>` 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`.

Expand Down
2 changes: 1 addition & 1 deletion XDL_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.4.20-4
3.4.20-9
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<Project>
<!--
The browser runtime links the archives into dotnet.native.wasm instead of loading them, and each archive's file name is its
P/Invoke module, such as XDL3. XDL's WebGPU backend is built on Emscripten's emdawnwebgpu port, which the link fetches and builds
into the Emscripten cache, so WasmCachePath must name a writable cache.
P/Invoke module, such as XDL3. XDL's WebGPU backend calls emdawnwebgpu, which XDL ships prebuilt as emdawnwebgpu.a, no P/Invoke
module, and four JavaScript libraries. Linking them instead of Emscripten's emdawnwebgpu port keeps the link inside the workload's
read-only Emscripten cache, which the port would build into. library_webgpu.js reads the tables of the other three, so it comes last.
-->
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
<NativeFileReference Include="$(MSBuildThisFileDirectory)native/*.a" />
<NativeFileReference Include="$(MSBuildThisFileDirectory)native/*.a" Exclude="$(MSBuildThisFileDirectory)native/emdawnwebgpu.a" />
<NativeFileReference Include="$(MSBuildThisFileDirectory)native/emdawnwebgpu.a" ScanForPInvokes="false" />
</ItemGroup>

<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
<EmccExtraLDFlags>$(EmccExtraLDFlags) --use-port=emdawnwebgpu</EmccExtraLDFlags>
<EmccExtraLDFlags>$(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"</EmccExtraLDFlags>
</PropertyGroup>
</Project>
6 changes: 3 additions & 3 deletions tests/XdlSharp.Browser.Tests/XdlSharp.Browser.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
<IsPackable>false</IsPackable>
<PublishTrimmed>false</PublishTrimmed>
<UsesXdlRelease>true</UsesXdlRelease>
<!-- XDL's WebGPU backend is built on the emdawnwebgpu port, which the link builds into a writable cache. -->
<WasmCachePath>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..', '..', 'artifacts', 'em-cache'))</WasmCachePath>
<EmccExtraLDFlags>$(EmccExtraLDFlags) --use-port=emdawnwebgpu</EmccExtraLDFlags>
<!-- XDL's WebGPU backend calls emdawnwebgpu, linked from the release as in XdlSharp.Native.browser-wasm.targets. -->
<EmccExtraLDFlags>$(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"</EmccExtraLDFlags>
</PropertyGroup>

<!-- Paths, not globs: the release is fetched during the build, before the native link checks that they exist. -->
Expand All @@ -20,6 +19,7 @@
<NativeFileReference Include="$(XdlBrowserDirectory)XDL3_image.a" />
<NativeFileReference Include="$(XdlBrowserDirectory)XDL3_ttf.a" />
<NativeFileReference Include="$(XdlBrowserDirectory)XDL3_mixer.a" />
<NativeFileReference Include="$(XdlBrowserDirectory)emdawnwebgpu.a" ScanForPInvokes="false" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<IsPackable>false</IsPackable>
<PublishTrimmed>false</PublishTrimmed>
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
<WasmCachePath>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..', '..', 'artifacts', 'em-cache'))</WasmCachePath>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading