diff --git a/src/DirectX12ComputeShaderSample/DirectX12ComputeShaderSample.csproj b/samples/NetCoreComputeShaderSample/NetCoreComputeShaderSample.csproj similarity index 72% rename from src/DirectX12ComputeShaderSample/DirectX12ComputeShaderSample.csproj rename to samples/NetCoreComputeShaderSample/NetCoreComputeShaderSample.csproj index 33fc9464..bfb20336 100644 --- a/src/DirectX12ComputeShaderSample/DirectX12ComputeShaderSample.csproj +++ b/samples/NetCoreComputeShaderSample/NetCoreComputeShaderSample.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/DirectX12ComputeShaderSample/Program.cs b/samples/NetCoreComputeShaderSample/Program.cs similarity index 87% rename from src/DirectX12ComputeShaderSample/Program.cs rename to samples/NetCoreComputeShaderSample/Program.cs index 84cb626a..8a862cca 100644 --- a/src/DirectX12ComputeShaderSample/Program.cs +++ b/samples/NetCoreComputeShaderSample/Program.cs @@ -4,7 +4,7 @@ using ComputeSharp; using ComputeSharp.Graphics.Buffers; using ComputeSharp.Graphics.Buffers.Extensions; -namespace DirectX12ComputeShaderSample +namespace NetCoreComputeShaderSample { public class Program { @@ -19,7 +19,11 @@ namespace DirectX12ComputeShaderSample array[i] = i + 1; } - using ReadWriteBuffer gpuBuffer = Gpu.Default.AllocateReadWriteBuffer(array.AsSpan()); + // Print the initial matrix + Console.WriteLine("Before:"); + PrintMatrix(array, width, height); + + using ReadWriteBuffer gpuBuffer = Gpu.Default.AllocateReadWriteBuffer(array); // Shader body Action action = id => @@ -31,14 +35,10 @@ namespace DirectX12ComputeShaderSample // Run the shader Gpu.Default.For(100, action); - // Print matrix + // Get the data back + gpuBuffer.GetData(array); - Console.WriteLine("Before:"); - PrintMatrix(array, width, height); - - gpuBuffer.GetData(array.AsSpan()); - - Console.WriteLine(); + // Print the updated matrix Console.WriteLine("After:"); PrintMatrix(array, width, height); } diff --git a/src/ComputeSharp.sln b/src/ComputeSharp.sln index 6d17bb29..56d82d29 100644 --- a/src/ComputeSharp.sln +++ b/src/ComputeSharp.sln @@ -9,13 +9,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Shaders", "Com EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp", "ComputeSharp\ComputeSharp.csproj", "{314EB353-E7E3-4146-8111-685CC83EC1DE}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DirectX12ComputeShaderSample", "DirectX12ComputeShaderSample\DirectX12ComputeShaderSample.csproj", "{7A48A85D-8866-4DED-A404-653ED09BF396}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCoreComputeShaderSample", "..\samples\NetCoreComputeShaderSample\NetCoreComputeShaderSample.csproj", "{7A48A85D-8866-4DED-A404-653ED09BF396}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_SolutionItems", "_SolutionItems", "{1A9C4108-F61A-4ABE-B5CF-F524521EAE2D}" ProjectSection(SolutionItems) = preProject ..\.gitignore = ..\.gitignore EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -60,6 +62,9 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {7A48A85D-8866-4DED-A404-653ED09BF396} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4664C5E3-0340-4E22-BCFD-98AAEDF5F2DC} EndGlobalSection