Add ComputeSharp.Pix.NuGet test project
このコミットが含まれているのは:
1 親
3476aef589
コミット
3e1f18b659
5ファイル変更
+114
-2
検索条件に一致するファイルはありません
@@ -270,6 +270,45 @@ jobs:
|
||||
run: tests\ComputeSharp.NuGet\bin\x64\Release\net472\ComputeSharp.NuGet.exe
|
||||
shell: cmd
|
||||
|
||||
# Download the NuGet packages and test the ComputeSharp.Pix dependency
|
||||
verify-packages-pix:
|
||||
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.Pix.NuGet (.NET 6)
|
||||
run: dotnet build tests\ComputeSharp.Pix.NuGet\ComputeSharp.Pix.NuGet.csproj -c Release -f net6.0
|
||||
shell: cmd
|
||||
- name: Run ComputeSharp.Pix.NuGet (.NET 6)
|
||||
run: dotnet tests\ComputeSharp.Pix.NuGet\bin\Release\net6.0\ComputeSharp.Pix.NuGet.dll
|
||||
shell: cmd
|
||||
- name: Build ComputeSharp.Pix.NuGet (.NET Core 3.1)
|
||||
run: dotnet build tests\ComputeSharp.Pix.NuGet\ComputeSharp.Pix.NuGet.csproj -c Release -f netcoreapp3.1 -r win-x64
|
||||
shell: cmd
|
||||
- name: Run ComputeSharp.Pix.NuGet (.NET Core 3.1)
|
||||
run: tests\ComputeSharp.Pix.NuGet\bin\Release\netcoreapp3.1\win-x64\ComputeSharp.Pix.NuGet.exe
|
||||
shell: cmd
|
||||
- name: Build ComputeSharp.Pix.NuGet (.NET Framework 4.7.2)
|
||||
run: dotnet build tests\ComputeSharp.Pix.NuGet\ComputeSharp.Pix.NuGet.csproj -c Release -f net472 /p:Platform=x64
|
||||
shell: cmd
|
||||
- name: Run ComputeSharp.Pix.NuGet (.NET Framework 4.7.2)
|
||||
run: tests\ComputeSharp.Pix.NuGet\bin\x64\Release\net472\ComputeSharp.Pix.NuGet.exe
|
||||
shell: cmd
|
||||
|
||||
# Run the extra tests to validate a number of build and publishing configurations.
|
||||
# This is used to ensure the native dependencies can always be loaded correctly
|
||||
# regardless of whether the app is shipping with R2R, self-contained, etc.
|
||||
@@ -290,7 +329,7 @@ jobs:
|
||||
|
||||
# Publish the packages to GitHub packages
|
||||
publish-nightlies-github:
|
||||
needs: [ run-dx12-tests, run-d2d1-tests, run-dx12-samples, verify-packages, verify-package-native-libs ]
|
||||
needs: [run-dx12-tests, run-d2d1-tests, run-dx12-samples, verify-packages, verify-packages-pix, verify-package-native-libs]
|
||||
runs-on: windows-2022
|
||||
if: ${{github.event_name == 'push'}}
|
||||
steps:
|
||||
@@ -306,7 +345,7 @@ jobs:
|
||||
|
||||
# Publish the packages to Azure DevOps
|
||||
publish-nightlies-azure-devops:
|
||||
needs: [ run-dx12-tests, run-d2d1-tests, run-dx12-samples, verify-packages, verify-package-native-libs ]
|
||||
needs: [run-dx12-tests, run-d2d1-tests, run-dx12-samples, verify-packages, verify-packages-pix, verify-package-native-libs]
|
||||
runs-on: windows-2022
|
||||
if: ${{github.event_name == 'push'}}
|
||||
steps:
|
||||
|
||||
@@ -110,6 +110,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComputeSharp.NuGet", "Compu
|
||||
tests\ComputeSharp.NuGet\Program.cs = tests\ComputeSharp.NuGet\Program.cs
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComputeSharp.Pix.NuGet", "ComputeSharp.Pix.NuGet", "{C0B903AA-F32C-4760-B4B6-199AC4FE1C5A}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
tests\ComputeSharp.Pix.NuGet\ComputeSharp.Pix.NuGet.csproj = tests\ComputeSharp.Pix.NuGet\ComputeSharp.Pix.NuGet.csproj
|
||||
tests\ComputeSharp.Pix.NuGet\nuget.config = tests\ComputeSharp.Pix.NuGet\nuget.config
|
||||
tests\ComputeSharp.Pix.NuGet\Program.cs = tests\ComputeSharp.Pix.NuGet\Program.cs
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -462,6 +469,7 @@ Global
|
||||
{209C95A3-FA53-431B-B688-3299CA6C29D2} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
{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}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4664C5E3-0340-4E22-BCFD-98AAEDF5F2DC}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net472;netcoreapp3.1;net6.0</TargetFrameworks>
|
||||
<Platforms>AnyCPU;x64;ARM64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ComputeSharp.Core" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="ComputeSharp" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="ComputeSharp.Pix" Version="$(PackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,42 @@
|
||||
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<float> gpuBuffer = GraphicsDevice.Default.AllocateReadWriteBuffer(array);
|
||||
|
||||
// Run the shader
|
||||
using (var context = GraphicsDevice.Default.CreateComputeContext())
|
||||
{
|
||||
context.Log("Dispatching shader");
|
||||
context.BeginEvent("Dispatching event");
|
||||
context.For(100, new MultiplyByTwo(gpuBuffer));
|
||||
context.EndEvent();
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A sample kernel that is precompiled.
|
||||
/// </summary>
|
||||
[EmbeddedBytecode(DispatchAxis.X)]
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct MultiplyByTwo : IComputeShader
|
||||
{
|
||||
public readonly ReadWriteBuffer<float> buffer;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] *= 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
|
||||
<!-- This source is for the local NuGet packages, which are all generated in the centralized artifacts root folder -->
|
||||
<add key="artifacts" value="..\..\artifacts" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
新しいイシューから参照
ユーザーをブロックする