diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index bc49e552..e307114c 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -232,6 +232,45 @@ jobs:
# Download the NuGet packages generated in the previous job and use them
# to build and run the sample project referencing them. This is used as
# a test to ensure the NuGet packages work in a consuming project.
+ verify-packages:
+ if: success()
+ needs: [build-packages]
+ runs-on: windows-2022
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v2
+ - name: Setup .NET 6 SDK
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 6.0.x
+ - name: Create local NuGet feed
+ run: mkdir artifacts
+ shell: cmd
+ - name: Download package artifacts
+ uses: actions/download-artifact@v2
+ with:
+ name: nuget_preview
+ path: artifacts
+ - name: Build ComputeSharp.NuGet (.NET 6)
+ run: dotnet build tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj -c Release -f net6.0
+ shell: cmd
+ - name: Run ComputeSharp.NuGet (.NET 6)
+ run: dotnet tests\ComputeSharp.NuGet\bin\Release\net6.0\ComputeSharp.NuGet.dll
+ shell: cmd
+ - name: Build ComputeSharp.NuGet (.NET Core 3.1)
+ run: dotnet build tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj -c Release -f netcoreapp3.1 -r win-x64
+ shell: cmd
+ - name: Run ComputeSharp.NuGet (.NET Core 3.1)
+ run: tests\ComputeSharp.NuGet\bin\Release\netcoreapp3.1\win-x64\ComputeSharp.NuGet.exe
+ shell: cmd
+ - name: Build ComputeSharp.NuGet (.NET Framework 4.7.2)
+ run: dotnet build tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj -c Release -f net472 /p:Platform=x64
+ shell: cmd
+ - name: Run ComputeSharp.NuGet (.NET Framework 4.7.2)
+ run: tests\ComputeSharp.NuGet\bin\x64\Release\net472\ComputeSharp.NuGet.exe
+ shell: cmd
+
+ # Download the NuGet packages and test the ComputeSharp.Dynamic dependency
verify-packages-dynamic:
if: success()
needs: [build-packages]
@@ -329,7 +368,7 @@ jobs:
# Publish the packages to GitHub packages
publish-nightlies-github:
- needs: [run-dx12-tests, run-d2d1-tests, run-dx12-samples, verify-packages-dynamic, verify-packages-pix, verify-package-native-libs]
+ needs: [run-dx12-tests, run-d2d1-tests, run-dx12-samples, verify-packages, verify-packages-dynamic, verify-packages-pix, verify-package-native-libs]
runs-on: windows-2022
if: ${{github.event_name == 'push'}}
steps:
@@ -345,7 +384,7 @@ jobs:
# Publish the packages to Azure DevOps
publish-nightlies-azure-devops:
- needs: [run-dx12-tests, run-d2d1-tests, run-dx12-samples, verify-packages-dynamic, verify-packages-pix, verify-package-native-libs]
+ needs: [run-dx12-tests, run-d2d1-tests, run-dx12-samples, verify-packages, verify-packages-dynamic, verify-packages-pix, verify-package-native-libs]
runs-on: windows-2022
if: ${{github.event_name == 'push'}}
steps:
diff --git a/ComputeSharp.sln b/ComputeSharp.sln
index 4c907251..880d7110 100644
--- a/ComputeSharp.sln
+++ b/ComputeSharp.sln
@@ -117,6 +117,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComputeSharp.Pix.NuGet", "C
tests\ComputeSharp.Pix.NuGet\Program.cs = tests\ComputeSharp.Pix.NuGet\Program.cs
EndProjectSection
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComputeSharp.NuGet", "ComputeSharp.NuGet", "{E3403F19-A0D8-4317-8A54-322C7A13F2A2}"
+ ProjectSection(SolutionItems) = preProject
+ tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj = tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj
+ tests\ComputeSharp.NuGet\nuget.config = tests\ComputeSharp.NuGet\nuget.config
+ tests\ComputeSharp.NuGet\Program.cs = tests\ComputeSharp.NuGet\Program.cs
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -470,6 +477,7 @@ Global
{94178D51-0097-4AD2-B3D0-827E40D62F2E} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
{CBA545B4-31EF-4E9F-A1A8-2A1290B54046} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
{C0B903AA-F32C-4760-B4B6-199AC4FE1C5A} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
+ {E3403F19-A0D8-4317-8A54-322C7A13F2A2} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4664C5E3-0340-4E22-BCFD-98AAEDF5F2DC}
diff --git a/tests/ComputeSharp.NuGet/ComputeSharp.NuGet.csproj b/tests/ComputeSharp.NuGet/ComputeSharp.NuGet.csproj
new file mode 100644
index 00000000..7bdf5213
--- /dev/null
+++ b/tests/ComputeSharp.NuGet/ComputeSharp.NuGet.csproj
@@ -0,0 +1,14 @@
+
+
+
+ Exe
+ net472;netcoreapp3.1;net6.0
+ AnyCPU;x64;ARM64
+
+
+
+
+
+
+
+
diff --git a/tests/ComputeSharp.NuGet/Program.cs b/tests/ComputeSharp.NuGet/Program.cs
new file mode 100644
index 00000000..591d80de
--- /dev/null
+++ b/tests/ComputeSharp.NuGet/Program.cs
@@ -0,0 +1,36 @@
+using System.Diagnostics;
+using System.Linq;
+using ComputeSharp;
+
+float[] array = Enumerable.Range(1, 100).Select(static i => (float)i).ToArray();
+
+// Create the graphics buffer
+using ReadWriteBuffer gpuBuffer = GraphicsDevice.Default.AllocateReadWriteBuffer(array);
+
+// Run the shader
+GraphicsDevice.Default.For(100, new MultiplyByTwo(gpuBuffer));
+
+// Get the data back
+float[] result = gpuBuffer.ToArray();
+
+// Validate results
+for (int i = 0; i < array.Length; i++)
+{
+ Trace.Assert(result[i] == array[i] * 2);
+}
+
+///
+/// A sample kernel that is precompiled.
+///
+[EmbeddedBytecode(DispatchAxis.X)]
+[AutoConstructor]
+internal readonly partial struct MultiplyByTwo : IComputeShader
+{
+ public readonly ReadWriteBuffer buffer;
+
+ ///
+ public void Execute()
+ {
+ buffer[ThreadIds.X] *= 2;
+ }
+}
diff --git a/tests/ComputeSharp.NuGet/nuget.config b/tests/ComputeSharp.NuGet/nuget.config
new file mode 100644
index 00000000..995d3a62
--- /dev/null
+++ b/tests/ComputeSharp.NuGet/nuget.config
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+