diff --git a/.github/workflows/wgpu.yml b/.github/workflows/wgpu.yml
new file mode 100644
index 0000000000..e718cbe4a8
--- /dev/null
+++ b/.github/workflows/wgpu.yml
@@ -0,0 +1,90 @@
+name: WGPU
+on:
+ push:
+ branches-ignore:
+ - "ci/*"
+ - "develop/*"
+ - "main"
+ paths:
+ - "build/submodules/wgpu-native"
+ - "build/nuke/Build.Native.cs"
+ - ".github/workflows/wgpu.yml"
+jobs:
+ Build:
+ strategy:
+ fail-fast: false
+ matrix:
+ env:
+ - os: ubuntu-latest
+ name: Linux
+ nuke_invoke: ./build.sh
+ extras: |
+ sudo apt-get update
+ sudo apt-get install -y gcc-multilib
+ - os: windows-latest
+ name: Windows
+ nuke_invoke: ./build.cmd
+ extras: ""
+ - os: macos-latest
+ name: Darwin
+ nuke_invoke: ./build.sh
+ extras: ""
+ name: ${{ matrix.env.name }} Build
+ runs-on: ${{ matrix.env.os }}
+ steps:
+ - uses: dtolnay/rust-toolchain@nightly
+ if: runner.os == 'Windows'
+ with:
+ toolchain: nightly-x86_64-pc-windows-msvc
+
+ - uses: dtolnay/rust-toolchain@nightly
+ if: runner.os == 'Linux'
+ with:
+ toolchain: nightly-x86_64-unknown-linux-gnu
+
+ - uses: dtolnay/rust-toolchain@nightly
+ if: runner.os == 'macOS'
+ with:
+ toolchain: nightly-x86_64-apple-darwin
+
+ - name: Add targets
+ if: runner.os == 'Windows'
+ run: |
+ rustup target add i686-pc-windows-msvc
+ rustup target add aarch64-pc-windows-msvc
+
+ - name: Add targets
+ if: runner.os == 'Linux'
+ run: |
+ rustup target add i686-unknown-linux-gnu
+
+ - name: Add targets
+ if: runner.os == 'macOS'
+ run: |
+ rustup target add aarch64-apple-darwin
+
+ - uses: actions/checkout@v2
+ with:
+ token: ${{ secrets.PUSHABLE_GITHUB_TOKEN }}
+ - name: Checkout submodules, configure git
+ run: |
+ git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive build/submodules/wgpu-native
+ git config --local user.email "9011267+dotnet-bot@users.noreply.github.com"
+ git config --local user.name "The Silk.NET Automaton"
+ - name: Extra prerequisites
+ run: |
+ echo running extras
+ ${{ matrix.env.extras }}
+ - name: Setup .NET 6.0
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 6.0.201
+ - name: Setup .NET 7.0.102
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 7.0.102
+ - name: Build WGPU
+ run: ${{ matrix.env.nuke_invoke }} Wgpu
+ env:
+ PUSHABLE_GITHUB_TOKEN: ${{ secrets.PUSHABLE_GITHUB_TOKEN }}
+
diff --git a/Silk.NET.sln b/Silk.NET.sln
index e407c90e14..dd436414c7 100644
--- a/Silk.NET.sln
+++ b/Silk.NET.sln
@@ -560,6 +560,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Direct3D11.Extensi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.DirectComposition", "src\Microsoft\Silk.NET.DirectComposition\Silk.NET.DirectComposition.csproj", "{8773396C-5EDF-498C-97D7-1D2728CB969B}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.WebGPU.Native.WGPU", "src\Native\Silk.NET.WebGPU.Native.WGPU\Silk.NET.WebGPU.Native.WGPU.csproj", "{4031A5EB-820B-478D-A656-85C93210054E}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -3389,6 +3391,18 @@ Global
{8773396C-5EDF-498C-97D7-1D2728CB969B}.Release|x64.Build.0 = Release|Any CPU
{8773396C-5EDF-498C-97D7-1D2728CB969B}.Release|x86.ActiveCfg = Release|Any CPU
{8773396C-5EDF-498C-97D7-1D2728CB969B}.Release|x86.Build.0 = Release|Any CPU
+ {4031A5EB-820B-478D-A656-85C93210054E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4031A5EB-820B-478D-A656-85C93210054E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4031A5EB-820B-478D-A656-85C93210054E}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {4031A5EB-820B-478D-A656-85C93210054E}.Debug|x64.Build.0 = Debug|Any CPU
+ {4031A5EB-820B-478D-A656-85C93210054E}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {4031A5EB-820B-478D-A656-85C93210054E}.Debug|x86.Build.0 = Debug|Any CPU
+ {4031A5EB-820B-478D-A656-85C93210054E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4031A5EB-820B-478D-A656-85C93210054E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4031A5EB-820B-478D-A656-85C93210054E}.Release|x64.ActiveCfg = Release|Any CPU
+ {4031A5EB-820B-478D-A656-85C93210054E}.Release|x64.Build.0 = Release|Any CPU
+ {4031A5EB-820B-478D-A656-85C93210054E}.Release|x86.ActiveCfg = Release|Any CPU
+ {4031A5EB-820B-478D-A656-85C93210054E}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -3661,6 +3675,7 @@ Global
{58FECE86-7530-4E6F-BA61-512BE44DEA83} = {F2CF5D32-4B41-425E-B229-8FFC48F88063}
{82626916-C5F3-46E7-B0EC-1D38191450C7} = {58FECE86-7530-4E6F-BA61-512BE44DEA83}
{8773396C-5EDF-498C-97D7-1D2728CB969B} = {F2CF5D32-4B41-425E-B229-8FFC48F88063}
+ {4031A5EB-820B-478D-A656-85C93210054E} = {72E7FA64-5B1E-477D-BD30-63B7F206B3C4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F5273D7F-3334-48DF-94E3-41AE6816CD4D}
diff --git a/build/nuke/Build.Native.cs b/build/nuke/Build.Native.cs
index 84ec89047f..1b03191461 100644
--- a/build/nuke/Build.Native.cs
+++ b/build/nuke/Build.Native.cs
@@ -277,6 +277,59 @@ string AndroidHome
)
);
+
+ AbsolutePath WgpuPath => RootDirectory / "build" / "submodules" / "wgpu-native";
+
+ Target Wgpu => CommonTarget
+ (
+ x => x.Before(Compile)
+ .After(Clean)
+ .Executes
+ (
+ () =>
+ {
+ var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.WebGPU.Native.WGPU" / "runtimes";
+
+ var target = WgpuPath / "target";
+ EnsureCleanDirectory(target);
+
+ if(OperatingSystem.IsWindows())
+ {
+ //Compile Windows libraries
+ InheritedShell("cargo build --release --target=i686-pc-windows-msvc", WgpuPath).AssertZeroExitCode();
+ InheritedShell("cargo build --release --target=x86_64-pc-windows-msvc", WgpuPath).AssertZeroExitCode();
+ InheritedShell("cargo build --release --target=aarch64-pc-windows-msvc", WgpuPath).AssertZeroExitCode();
+
+ CopyFile(target / "i686-pc-windows-msvc" / "release" / "wgpu_native.dll", runtimes / "win-x86" / "native" / "wgpu_native.dll", FileExistsPolicy.Overwrite);
+ CopyFile(target / "x86_64-pc-windows-msvc" / "release" / "wgpu_native.dll", runtimes / "win-x64" / "native" / "wgpu_native.dll", FileExistsPolicy.Overwrite);
+ CopyFile(target / "aarch64-pc-windows-msvc" / "release" / "wgpu_native.dll", runtimes / "win-arm64" / "native" / "wgpu_native.dll", FileExistsPolicy.Overwrite);
+ }
+
+ if(OperatingSystem.IsLinux())
+ {
+ //Compile Linux libraries
+ InheritedShell("cargo build --release --target=i686-unknown-linux-gnu", WgpuPath).AssertZeroExitCode();
+ InheritedShell("cargo build --release --target=x86_64-unknown-linux-gnu", WgpuPath).AssertZeroExitCode();
+
+ CopyFile(target / "i686-unknown-linux-gnu" / "release" / "libwgpu_native.so", runtimes / "linux-x86" / "native" / "libwgpu_native.so", FileExistsPolicy.Overwrite);
+ CopyFile(target / "x86_64-unknown-linux-gnu" / "release" / "libwgpu_native.so", runtimes / "linux-x64" / "native" / "libwgpu_native.so", FileExistsPolicy.Overwrite);
+ }
+
+ if(OperatingSystem.IsMacOS())
+ {
+ //Compile MacOS libraries
+ InheritedShell("cargo build --release --target=aarch64-apple-darwin", WgpuPath).AssertZeroExitCode();
+ InheritedShell("cargo build --release --target=x86_64-apple-darwin", WgpuPath).AssertZeroExitCode();
+
+ CopyFile(target / "x86_64-apple-darwin" / "release" / "libwgpu_native.dylib", runtimes / "osx-x64" / "native" / "libwgpu_native.dylib", FileExistsPolicy.Overwrite);
+ CopyFile(target / "aarch64-apple-darwin" / "release" / "libwgpu_native.dylib", runtimes / "osx-arm64" / "native" / "libwgpu_native.dylib", FileExistsPolicy.Overwrite);
+ }
+
+ PrUpdatedNativeBinary("Wgpu");
+ }
+ )
+ );
+
AbsolutePath GLFWPath => RootDirectory / "build" / "submodules" / "GLFW";
Target GLFW => CommonTarget
diff --git a/build/submodules/wgpu-native b/build/submodules/wgpu-native
index 1adb5576cb..87da430524 160000
--- a/build/submodules/wgpu-native
+++ b/build/submodules/wgpu-native
@@ -1 +1 @@
-Subproject commit 1adb5576cb566432f38b8d8d9891630b94820133
+Subproject commit 87da4305241b47abd6b21d465603e2a9aa2a7854
diff --git a/src/Native/README.md b/src/Native/README.md
index 6a2cd25a8a..89a2810368 100644
--- a/src/Native/README.md
+++ b/src/Native/README.md
@@ -16,3 +16,4 @@ compatibility with the rest of your solution:
- Silk.NET.Assimp.Native: BSD-3-Clause
- Silk.NET.SDL.Native and Silk.NET.GLFW.Native: Zlib
- Silk.NET.OpenAL.Soft.Native: LGPL-2.0-or-later
+- Silk.NET.WebGPU.Native.WGPU: MIT/Apache-2.0
diff --git a/src/Native/Silk.NET.WebGPU.Native.WGPU/Silk.NET.WebGPU.Native.WGPU.csproj b/src/Native/Silk.NET.WebGPU.Native.WGPU/Silk.NET.WebGPU.Native.WGPU.csproj
new file mode 100644
index 0000000000..1da340b171
--- /dev/null
+++ b/src/Native/Silk.NET.WebGPU.Native.WGPU/Silk.NET.WebGPU.Native.WGPU.csproj
@@ -0,0 +1,34 @@
+
+
+
+ true
+
+
+
+
+
+ netstandard2.0;net4.6.1
+ Silk.NET.WebGPU.Native.WGPU
+ .NET Foundation and Contributors
+ true
+ MIT
+ https://github.com/dotnet/Silk.NET
+ Multi-platform native library for WGPU.
+ git
+ https://github.com/gfx-rs/wgpu-native
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Native/Silk.NET.WebGPU.Native.WGPU/build/net461/Silk.NET.WebGPU.Native.WGPU.targets b/src/Native/Silk.NET.WebGPU.Native.WGPU/build/net461/Silk.NET.WebGPU.Native.WGPU.targets
new file mode 100644
index 0000000000..a9745e0980
--- /dev/null
+++ b/src/Native/Silk.NET.WebGPU.Native.WGPU/build/net461/Silk.NET.WebGPU.Native.WGPU.targets
@@ -0,0 +1,29 @@
+
+
+
+ <_Silk_NET_WebGPU_Native_WGPU_IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true
+ <_Silk_NET_WebGPU_Native_WGPU_IsMacOS Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true
+ <_Silk_NET_WebGPU_Native_WGPU_IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true
+
+ <_Silk_NET_WebGPU_Native_WGPU_NativeRuntime Condition=" '$(_Silk_NET_WebGPU_Native_WGPU_NativeRuntime)' == '' And '$(_Silk_NET_WebGPU_Native_WGPU_IsMacOS)' == 'true' And ('$(Prefer32Bit)' == 'false' Or '$(PlatformTarget)' == 'x64')">osx-x64
+ <_Silk_NET_WebGPU_Native_WGPU_NativeRuntime Condition=" '$(_Silk_NET_WebGPU_Native_WGPU_NativeRuntime)' == '' And '$(_Silk_NET_WebGPU_Native_WGPU_IsLinux)' == 'true' And ('$(Prefer32Bit)' == 'false' Or '$(PlatformTarget)' == 'x64')">linux-x64
+ <_Silk_NET_WebGPU_Native_WGPU_NativeRuntime Condition=" '$(_Silk_NET_WebGPU_Native_WGPU_NativeRuntime)' == '' And '$(_Silk_NET_WebGPU_Native_WGPU_IsWindows)' == 'true' And ('$(Prefer32Bit)' == 'true' Or '$(PlatformTarget)' == 'x86')">win-x86
+ <_Silk_NET_WebGPU_Native_WGPU_NativeRuntime Condition=" '$(_Silk_NET_WebGPU_Native_WGPU_NativeRuntime)' == '' And '$(_Silk_NET_WebGPU_Native_WGPU_IsWindows)' == 'true' And ('$(Prefer32Bit)' == 'false' Or '$(PlatformTarget)' == 'x64')">win-x64
+ <_Silk_NET_WebGPU_Native_WGPU_NativeRuntime Condition=" '$(_Silk_NET_WebGPU_Native_WGPU_NativeRuntime)' == '' And '$(_Silk_NET_WebGPU_Native_WGPU_IsWindows)' == 'true' And '$(PlatformTarget)' == 'arm64'">win-arm64
+
+ <_Silk_NET_WebGPU_Native_WGPU_NativeLibName Condition="'$(_Silk_NET_WebGPU_Native_WGPU_NativeRuntime)' == 'win-x86'">wgpu_native.dll
+ <_Silk_NET_WebGPU_Native_WGPU_NativeLibName Condition="'$(_Silk_NET_WebGPU_Native_WGPU_NativeRuntime)' == 'win-x64'">wgpu_native.dll
+ <_Silk_NET_WebGPU_Native_WGPU_NativeLibName Condition="'$(_Silk_NET_WebGPU_Native_WGPU_NativeRuntime)' == 'win-arm64'">wgpu_native.dll
+ <_Silk_NET_WebGPU_Native_WGPU_NativeLibName Condition="'$(_Silk_NET_WebGPU_Native_WGPU_NativeRuntime)' == 'osx-x64'">libwgpu_native.dylib
+ <_Silk_NET_WebGPU_Native_WGPU_NativeLibName Condition="'$(_Silk_NET_WebGPU_Native_WGPU_NativeRuntime)' == 'osx-arm64'">libwgpu_native.dylib
+ <_Silk_NET_WebGPU_Native_WGPU_NativeLibName Condition="'$(_Silk_NET_WebGPU_Native_WGPU_NativeRuntime)' == 'linux-x86'">libwgpu_native.so
+ <_Silk_NET_WebGPU_Native_WGPU_NativeLibName Condition="'$(_Silk_NET_WebGPU_Native_WGPU_NativeRuntime)' == 'linux-x64'">libwgpu_native.so
+
+
+
+ %(Filename)%(Extension)
+ Always
+ False
+
+
+
diff --git a/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/linux-x64/native/libwgpu_native.so b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/linux-x64/native/libwgpu_native.so
new file mode 100755
index 0000000000..0ce1dc34c4
Binary files /dev/null and b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/linux-x64/native/libwgpu_native.so differ
diff --git a/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/linux-x86/native/libwgpu_native.so b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/linux-x86/native/libwgpu_native.so
new file mode 100755
index 0000000000..3e8813a3a4
Binary files /dev/null and b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/linux-x86/native/libwgpu_native.so differ
diff --git a/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/osx-arm64/native/libwgpu_native.dylib b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/osx-arm64/native/libwgpu_native.dylib
new file mode 100755
index 0000000000..7a93a58dbd
Binary files /dev/null and b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/osx-arm64/native/libwgpu_native.dylib differ
diff --git a/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/osx-x64/native/libwgpu_native.dylib b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/osx-x64/native/libwgpu_native.dylib
new file mode 100755
index 0000000000..78501683c4
Binary files /dev/null and b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/osx-x64/native/libwgpu_native.dylib differ
diff --git a/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/win-arm64/native/wgpu_native.dll b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/win-arm64/native/wgpu_native.dll
new file mode 100644
index 0000000000..015559d873
Binary files /dev/null and b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/win-arm64/native/wgpu_native.dll differ
diff --git a/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/win-x64/native/wgpu_native.dll b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/win-x64/native/wgpu_native.dll
new file mode 100644
index 0000000000..500d4af848
Binary files /dev/null and b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/win-x64/native/wgpu_native.dll differ
diff --git a/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/win-x86/native/wgpu_native.dll b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/win-x86/native/wgpu_native.dll
new file mode 100644
index 0000000000..8c4135c3c7
Binary files /dev/null and b/src/Native/Silk.NET.WebGPU.Native.WGPU/runtimes/win-x86/native/wgpu_native.dll differ