From 490226aa4d4251b3d4878ff264f06ec7d35b9270 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 13 Oct 2023 11:09:20 +0200 Subject: [PATCH] Disable dynamic shader compilation support --- .../Blas/BlasHelpers.cs | 1 + .../ComputeSharp.Benchmark.csproj | 1 - .../Dispatching/DispatchingBenchmark.cs | 1 + .../ComputeSharp.ImageProcessing.csproj | 1 - .../HlslBokehBlurProcessor{TPixel}.cs | 4 +++ .../HlslGaussianBlurProcessor{TPixel}.cs | 2 ++ .../ComputeSharp.Sample.FSharp.Shaders.csproj | 1 - .../MultiplyByTwo.cs | 1 + .../ComputeSharp.Sample.FSharp.fsproj | 1 - .../ComputeSharp.Sample.csproj | 1 - samples/ComputeSharp.Sample/Program.cs | 1 + .../ComputeSharp.SwapChain.Cli.csproj | 1 - .../ColorfulInfinity.cs | 2 -- .../ContouredLayers.cs | 2 -- .../ExtrudedTruchetPattern.cs | 2 -- .../FourColorGradient.cs | 2 -- .../FractalTiling.cs | 2 -- .../HelloWorld.cs | 2 -- .../MengerJourney.cs | 2 -- .../Octagrams.cs | 2 -- .../ProteanClouds.cs | 2 -- .../PyramidPattern.cs | 2 -- .../TerracedHills.cs | 2 -- .../TriangleGridContouring.cs | 2 -- .../TwoTiledTruchet.cs | 2 -- .../ComputeSharp.SwapChain.WinUI.csproj | 1 - .../ComputeSharp.SwapChain.csproj | 1 - ...ator.CreateBuildHlslSourceMethod.Syntax.cs | 4 +-- .../IShaderGenerator.Helpers.cs | 11 -------- .../IShaderGenerator.cs | 4 +-- tests/ComputeSharp.Dynamic.NuGet/Program.cs | 13 +++++++--- .../ShaderDataLoaderTests.cs | 7 ++++++ .../DynamicNativeLibrariesResolverTests.cs | 2 +- .../PixNativeLibrariesResolverTests.cs | 2 +- tests/ComputeSharp.Tests/BufferTests.cs | 4 +++ .../ComputeSharp.Tests/ComputeContextTests.cs | 12 +++++++++ tests/ComputeSharp.Tests/DispatchTests.cs | 9 +++++++ tests/ComputeSharp.Tests/IPixelShaderTests.cs | 1 + .../ComputeSharp.Tests/InitializationTests.cs | 1 + .../ResourceDimensionsTests.g.cs | 25 ++++++++++++++++++- .../ResourceDimensionsTests.tt | 3 ++- .../ComputeSharp.Tests/ShaderCompilerTests.cs | 17 +++++++++++++ .../ComputeSharp.Tests/ShaderMembersTests.cs | 4 +++ .../ComputeSharp.Tests/ShaderRewriterTests.cs | 12 +++++++++ .../Shaders/Compute/ColorfulInfinity.cs | 1 + .../Shaders/Compute/ContouredLayers.cs | 1 + .../Shaders/Compute/ExtrudedTruchetPattern.cs | 1 + .../Shaders/Compute/FourColorGradient.cs | 1 + .../Shaders/Compute/FractalTiling.cs | 1 + .../Shaders/Compute/HelloWorld.cs | 1 + .../Shaders/Compute/MengerJourney.cs | 1 + .../Shaders/Compute/Octagrams.cs | 1 + .../Shaders/Compute/ProteanClouds.cs | 1 + .../Shaders/Compute/PyramidPattern.cs | 1 + .../Shaders/Compute/TerracedHills.cs | 1 + .../Shaders/Compute/TriangleGridContouring.cs | 1 + .../Shaders/Compute/TwoTiledTruchet.cs | 1 + .../Texture1DTests.Pixels.cs | 1 + .../Texture1DTests.Pixels.g.cs | 9 ++++++- .../Texture1DTests.Pixels.tt | 3 ++- tests/ComputeSharp.Tests/Texture1DTests.cs | 2 ++ .../Texture2DTests.Pixels.cs | 2 ++ .../Texture2DTests.Pixels.g.cs | 9 ++++++- .../Texture2DTests.Pixels.tt | 3 ++- tests/ComputeSharp.Tests/Texture2DTests.cs | 2 ++ .../Texture3DTests.Pixels.g.cs | 9 ++++++- .../Texture3DTests.Pixels.tt | 3 ++- tests/ComputeSharp.Tests/Texture3DTests.cs | 2 ++ 68 files changed, 169 insertions(+), 64 deletions(-) diff --git a/samples/ComputeSharp.Benchmark/Blas/BlasHelpers.cs b/samples/ComputeSharp.Benchmark/Blas/BlasHelpers.cs index a2d94d21..7f092b09 100644 --- a/samples/ComputeSharp.Benchmark/Blas/BlasHelpers.cs +++ b/samples/ComputeSharp.Benchmark/Blas/BlasHelpers.cs @@ -81,6 +81,7 @@ internal static partial class BlasHelpers /// Kernel for . /// [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] public readonly partial struct FullyConnectedForwardKernel : IComputeShader { private readonly int n; diff --git a/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj b/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj index a1795f40..7cd14f1c 100644 --- a/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj +++ b/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj @@ -28,7 +28,6 @@ - \ No newline at end of file diff --git a/samples/ComputeSharp.Benchmark/Dispatching/DispatchingBenchmark.cs b/samples/ComputeSharp.Benchmark/Dispatching/DispatchingBenchmark.cs index a3ec85a8..5c477a7a 100644 --- a/samples/ComputeSharp.Benchmark/Dispatching/DispatchingBenchmark.cs +++ b/samples/ComputeSharp.Benchmark/Dispatching/DispatchingBenchmark.cs @@ -109,6 +109,7 @@ public partial class DispatchingBenchmark : IDisposable } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct TestShader : IComputeShader { private readonly ReadWriteBuffer buffer; diff --git a/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj b/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj index 1670863e..dcbc7cad 100644 --- a/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj +++ b/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj @@ -19,7 +19,6 @@ - diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs index cb4a3949..6c8d9fc8 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs @@ -314,6 +314,7 @@ public sealed partial class HlslBokehBlurProcessor /// Kernel for the vertical convolution pass. /// [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct VerticalConvolutionProcessor : IComputeShader { private readonly IReadWriteNormalizedTexture2D source; @@ -351,6 +352,7 @@ public sealed partial class HlslBokehBlurProcessor /// Kernel for the horizontal convolution pass. /// [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct HorizontalConvolutionAndAccumulatePartialsProcessor : IComputeShader { private readonly float z; @@ -390,6 +392,7 @@ public sealed partial class HlslBokehBlurProcessor /// Kernel for the gamma highlight pass. /// [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct GammaHighlightProcessor : IComputeShader { private readonly IReadWriteNormalizedTexture2D source; @@ -414,6 +417,7 @@ public sealed partial class HlslBokehBlurProcessor /// Kernel for the inverse gamma highlight pass. /// [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct InverseGammaHighlightProcessor : IComputeShader { private readonly ReadWriteTexture2D source; diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs index e24a82a2..d35ac808 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs @@ -118,6 +118,7 @@ public sealed partial class HlslGaussianBlurProcessor /// Kernel for the vertical convolution pass. /// [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct VerticalConvolutionProcessor : IComputeShader { private readonly IReadWriteNormalizedTexture2D source; @@ -150,6 +151,7 @@ public sealed partial class HlslGaussianBlurProcessor /// Kernel for the horizontal convolution pass. /// [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct HorizontalConvolutionProcessor : IComputeShader { private readonly IReadWriteNormalizedTexture2D source; diff --git a/samples/ComputeSharp.Sample.FSharp.Shaders/ComputeSharp.Sample.FSharp.Shaders.csproj b/samples/ComputeSharp.Sample.FSharp.Shaders/ComputeSharp.Sample.FSharp.Shaders.csproj index 220912b1..3cda0b7d 100644 --- a/samples/ComputeSharp.Sample.FSharp.Shaders/ComputeSharp.Sample.FSharp.Shaders.csproj +++ b/samples/ComputeSharp.Sample.FSharp.Shaders/ComputeSharp.Sample.FSharp.Shaders.csproj @@ -8,7 +8,6 @@ - diff --git a/samples/ComputeSharp.Sample.FSharp.Shaders/MultiplyByTwo.cs b/samples/ComputeSharp.Sample.FSharp.Shaders/MultiplyByTwo.cs index 3b9e6f98..ac8d99a2 100644 --- a/samples/ComputeSharp.Sample.FSharp.Shaders/MultiplyByTwo.cs +++ b/samples/ComputeSharp.Sample.FSharp.Shaders/MultiplyByTwo.cs @@ -4,6 +4,7 @@ namespace ComputeSharp.Sample.FSharp.Shaders; /// A sample shader thaat just multiplies items in a buffer by two. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct MultiplyByTwo : IComputeShader { private readonly ReadWriteBuffer buffer; diff --git a/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj b/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj index b4da66d3..8a0392e9 100644 --- a/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj +++ b/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj @@ -19,7 +19,6 @@ - diff --git a/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj b/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj index 884e0a6e..2ab6faf3 100644 --- a/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj +++ b/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj @@ -10,7 +10,6 @@ - diff --git a/samples/ComputeSharp.Sample/Program.cs b/samples/ComputeSharp.Sample/Program.cs index 21e050fa..761aecc4 100644 --- a/samples/ComputeSharp.Sample/Program.cs +++ b/samples/ComputeSharp.Sample/Program.cs @@ -24,6 +24,7 @@ Formatting.PrintMatrix(array, 10, 10, "AFTER"); /// The sample kernel that multiples all items by two. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct MultiplyByTwo : IComputeShader { private readonly ReadWriteBuffer buffer; diff --git a/samples/ComputeSharp.SwapChain.Cli/ComputeSharp.SwapChain.Cli.csproj b/samples/ComputeSharp.SwapChain.Cli/ComputeSharp.SwapChain.Cli.csproj index 299c5aa6..9274944d 100644 --- a/samples/ComputeSharp.SwapChain.Cli/ComputeSharp.SwapChain.Cli.csproj +++ b/samples/ComputeSharp.SwapChain.Cli/ComputeSharp.SwapChain.Cli.csproj @@ -10,7 +10,6 @@ WinExe net7.0 x64;ARM64 - $(DefineConstants);SAMPLE_APP $(NoWarn);CA1416 computesharp.cli diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs index 932b1ffc..224ba76f 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs @@ -7,9 +7,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. /// [AutoConstructor] -#if SAMPLE_APP [EmbeddedBytecode(DispatchAxis.XY)] -#endif internal readonly partial struct ColorfulInfinity : IPixelShader { /// diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs index aaa46d77..99b50e94 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs @@ -6,9 +6,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// Created by Shane. /// [AutoConstructor] -#if SAMPLE_APP [EmbeddedBytecode(DispatchAxis.XY)] -#endif internal readonly partial struct ContouredLayers : IPixelShader { /// diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs index 888530d8..ceea8dce 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs @@ -6,9 +6,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// Created by Shane. /// [AutoConstructor] -#if SAMPLE_APP [EmbeddedBytecode(DispatchAxis.XY)] -#endif internal readonly partial struct ExtrudedTruchetPattern : IPixelShader { /// diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs index dc14ebe5..92bff991 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs @@ -7,9 +7,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. /// [AutoConstructor] -#if SAMPLE_APP [EmbeddedBytecode(DispatchAxis.XY)] -#endif internal readonly partial struct FourColorGradient : IPixelShader { /// diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs index 5b7b8d56..4478d2dc 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs @@ -7,9 +7,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. /// [AutoConstructor] -#if SAMPLE_APP [EmbeddedBytecode(DispatchAxis.XY)] -#endif internal readonly partial struct FractalTiling : IPixelShader { /// diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs index 1fa112b7..192ec941 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs @@ -5,9 +5,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// Ported from . /// [AutoConstructor] -#if SAMPLE_APP [EmbeddedBytecode(DispatchAxis.XY)] -#endif internal readonly partial struct HelloWorld : IPixelShader { /// diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs index d3727452..958726ae 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs @@ -6,9 +6,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// Created by Syntopia. /// [AutoConstructor] -#if SAMPLE_APP [EmbeddedBytecode(DispatchAxis.XY)] -#endif internal readonly partial struct MengerJourney : IPixelShader { /// diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs index b9ed0603..3190d925 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs @@ -6,9 +6,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// Created by whisky_shusuky. /// [AutoConstructor] -#if SAMPLE_APP [EmbeddedBytecode(DispatchAxis.XY)] -#endif internal readonly partial struct Octagrams : IPixelShader { /// diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs index 33b358bc..ef98690e 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs @@ -7,9 +7,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. /// [AutoConstructor] -#if SAMPLE_APP [EmbeddedBytecode(DispatchAxis.XY)] -#endif internal readonly partial struct ProteanClouds : IPixelShader { /// diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs index ce8988f3..5ffc2fa2 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs @@ -7,9 +7,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// Created by Shane. /// [AutoConstructor] -#if SAMPLE_APP [EmbeddedBytecode(DispatchAxis.XY)] -#endif internal readonly partial struct PyramidPattern : IPixelShader { /// diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/TerracedHills.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/TerracedHills.cs index 7cf960b8..1d8ab189 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/TerracedHills.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/TerracedHills.cs @@ -6,9 +6,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// Created by Shane. /// [AutoConstructor] -#if SAMPLE_APP [EmbeddedBytecode(DispatchAxis.XY)] -#endif internal readonly partial struct TerracedHills : IPixelShader { /// diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs index 4486624e..60e1af58 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs @@ -6,9 +6,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// Created by Shane. /// [AutoConstructor] -#if SAMPLE_APP [EmbeddedBytecode(DispatchAxis.XY)] -#endif internal readonly partial struct TriangleGridContouring : IPixelShader { /// diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs index b7855082..3e44c208 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs @@ -6,9 +6,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// Created by Shane. /// [AutoConstructor] -#if SAMPLE_APP [EmbeddedBytecode(DispatchAxis.XY)] -#endif internal readonly partial struct TwoTiledTruchet : IPixelShader { /// diff --git a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj index ddd61735..e789e5ba 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj +++ b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj @@ -10,7 +10,6 @@ win10-$(Platform).pubxml true true - $(DefineConstants);SAMPLE_APP diff --git a/samples/ComputeSharp.SwapChain/ComputeSharp.SwapChain.csproj b/samples/ComputeSharp.SwapChain/ComputeSharp.SwapChain.csproj index 2694547c..fc340cf9 100644 --- a/samples/ComputeSharp.SwapChain/ComputeSharp.SwapChain.csproj +++ b/samples/ComputeSharp.SwapChain/ComputeSharp.SwapChain.csproj @@ -3,7 +3,6 @@ Exe net6.0 x64;ARM64 - $(DefineConstants);SAMPLE_APP $(NoWarn);CA1416;IDE0210 diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.Syntax.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.Syntax.cs index 54d2ab01..e41f96a7 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.Syntax.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.Syntax.cs @@ -28,9 +28,7 @@ partial class IShaderGenerator public static MethodDeclarationSyntax GetSyntax(HlslShaderSourceInfo hlslSourceInfo, bool supportsDynamicShaders, int hierarchyDepth) { // Generate the necessary body statements depending on whether dynamic shaders are supported - ImmutableArray bodyStatements = supportsDynamicShaders - ? GenerateRenderMethodBody(hlslSourceInfo, hierarchyDepth) - : GenerateEmptyMethodBody(); + ImmutableArray bodyStatements = GenerateRenderMethodBody(hlslSourceInfo, hierarchyDepth); // This code produces a method declaration as follows: // diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.Helpers.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.Helpers.cs index 0fa64a96..465269b7 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.Helpers.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.Helpers.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Linq; using ComputeSharp.SourceGeneration.Models; using ComputeSharp.SourceGenerators.Models; using Microsoft.CodeAnalysis; @@ -45,16 +44,6 @@ partial class IShaderGenerator return null; } - /// - /// Checks whether dynamic shaders are supported in a given compilation. - /// - /// The instance currently in use. - /// Whether dynamic shaders are supported in the input compilation. - private static bool IsDynamicCompilationSupported(Compilation compilation) - { - return compilation.ReferencedAssemblyNames.Any(static identity => identity.Name is "ComputeSharp.Dynamic"); - } - /// /// Creates a instance wrapping the given method. /// diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.cs index 2594f0a6..20698149 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.cs @@ -25,7 +25,7 @@ public sealed partial class IShaderGenerator : IIncrementalGenerator // Check whether or not dynamic shaders are supported IncrementalValueProvider supportsDynamicShaders = context.CompilationProvider - .Select(static (compilation, _) => IsDynamicCompilationSupported(compilation)); + .Select(static (compilation, _) => false); // Discover all shader types and extract all the necessary info from each of them IncrementalValuesProvider shaderInfoWithErrors = @@ -88,7 +88,7 @@ public sealed partial class IShaderGenerator : IIncrementalGenerator ThreadIdsInfo threadIds = LoadBytecode.GetInfo( diagnostics, typeSymbol, - IsDynamicCompilationSupported(context.SemanticModel.Compilation)); + false); token.ThrowIfCancellationRequested(); diff --git a/tests/ComputeSharp.Dynamic.NuGet/Program.cs b/tests/ComputeSharp.Dynamic.NuGet/Program.cs index 32dccd17..8a1cb76c 100644 --- a/tests/ComputeSharp.Dynamic.NuGet/Program.cs +++ b/tests/ComputeSharp.Dynamic.NuGet/Program.cs @@ -1,13 +1,10 @@ using System.Diagnostics; using System.Linq; -#if NET6_0_OR_GREATER using System.Runtime.Versioning; -#endif using ComputeSharp; +using ComputeSharp.Interop; -#if NET6_0_OR_GREATER [assembly: SupportedOSPlatform("windows6.2")] -#endif float[] array = Enumerable.Range(1, 100).Select(static i => (float)i).ToArray(); @@ -26,10 +23,18 @@ for (int i = 0; i < array.Length; i++) Trace.Assert(result[i] == array[i] * 2); } +// Also get the shader info (this requires DXC to be present) +ShaderInfo shaderInfo = ReflectionServices.GetShaderInfo(); + +// Validate a couple properties as a sanity check +Trace.Assert(shaderInfo.HlslSource is { Length: > 0 }); +Trace.Assert(shaderInfo.BoundResourceCount == 2); + /// /// A sample kernel that requires dynamic compilation, as it's not precompiled. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct MultiplyByTwo : IComputeShader { public readonly ReadWriteBuffer buffer; diff --git a/tests/ComputeSharp.Tests.Internals/ShaderDataLoaderTests.cs b/tests/ComputeSharp.Tests.Internals/ShaderDataLoaderTests.cs index 766f597d..847a95c8 100644 --- a/tests/ComputeSharp.Tests.Internals/ShaderDataLoaderTests.cs +++ b/tests/ComputeSharp.Tests.Internals/ShaderDataLoaderTests.cs @@ -11,6 +11,7 @@ namespace ComputeSharp.Tests.Internals; public partial class ShaderDataLoaderTests { [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public partial struct CapturedResourceShader : IComputeShader { public ReadWriteBuffer _; @@ -39,6 +40,7 @@ public partial class ShaderDataLoaderTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public partial struct MultipleResourcesAndPrimitivesShader : IComputeShader { public ReadWriteBuffer _0; @@ -76,6 +78,7 @@ public partial class ShaderDataLoaderTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public partial struct ScalarAndVectorTypesShader : IComputeShader { public ReadWriteBuffer _; @@ -127,6 +130,7 @@ public partial class ShaderDataLoaderTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public partial struct ScalarVectorAndMatrixTypesShader : IComputeShader { public ReadWriteBuffer _; @@ -213,6 +217,7 @@ public partial class ShaderDataLoaderTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public partial struct FlatCustomTypeShader : IComputeShader { public ReadWriteBuffer _0; @@ -305,6 +310,7 @@ public partial class ShaderDataLoaderTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public partial struct NestedCustomTypesShader : IComputeShader { public ReadWriteBuffer _0; @@ -397,6 +403,7 @@ public partial class ShaderDataLoaderTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public partial struct AmbiguousNamesShader : IComputeShader { public ReadWriteBuffer a; diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/DynamicNativeLibrariesResolverTests.cs b/tests/ComputeSharp.Tests.NativeLibrariesResolver/DynamicNativeLibrariesResolverTests.cs index 9f31da5e..539562d0 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/DynamicNativeLibrariesResolverTests.cs +++ b/tests/ComputeSharp.Tests.NativeLibrariesResolver/DynamicNativeLibrariesResolverTests.cs @@ -26,7 +26,7 @@ public class DynamicNativeLibrariesResolverTests : NativeLibrariesResolverTestsB } string coreProjectPath = Path.Combine(path, "src", "ComputeSharp.Core", "ComputeSharp.Core.csproj"); - string projectPath = Path.Combine(path, "src", "ComputeSharp.Package", "ComputeSharp.Package.csproj"); + string projectPath = Path.Combine(path, "src", "ComputeSharp", "ComputeSharp.csproj"); string dynamicProjectPath = Path.Combine(path, "src", "ComputeSharp.Dynamic", "ComputeSharp.Dynamic.csproj"); Process.Start("dotnet", $"pack {coreProjectPath} -c Release").WaitForExit(); diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/PixNativeLibrariesResolverTests.cs b/tests/ComputeSharp.Tests.NativeLibrariesResolver/PixNativeLibrariesResolverTests.cs index 42d1a734..c44e8061 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/PixNativeLibrariesResolverTests.cs +++ b/tests/ComputeSharp.Tests.NativeLibrariesResolver/PixNativeLibrariesResolverTests.cs @@ -26,7 +26,7 @@ public class PixNativeLibrariesResolverTests : NativeLibrariesResolverTestsBase } string coreProjectPath = Path.Combine(path, "src", "ComputeSharp.Core", "ComputeSharp.Core.csproj"); - string projectPath = Path.Combine(path, "src", "ComputeSharp.Package", "ComputeSharp.Package.csproj"); + string projectPath = Path.Combine(path, "src", "ComputeSharp", "ComputeSharp.csproj"); string pixProjectPath = Path.Combine(path, "src", "ComputeSharp.Pix", "ComputeSharp.Pix.csproj"); // Run dotnet pack and on the packaging projects, to ensure the local NuGet packages are available diff --git a/tests/ComputeSharp.Tests/BufferTests.cs b/tests/ComputeSharp.Tests/BufferTests.cs index 7de26fd0..6d6c3dcd 100644 --- a/tests/ComputeSharp.Tests/BufferTests.cs +++ b/tests/ComputeSharp.Tests/BufferTests.cs @@ -278,6 +278,7 @@ public partial class BufferTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ConstantBufferKernel : IComputeShader { public readonly ConstantBuffer source; @@ -306,6 +307,7 @@ public partial class BufferTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadOnlyBufferKernel : IComputeShader { public readonly ReadOnlyBuffer source; @@ -334,6 +336,7 @@ public partial class BufferTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteBufferKernel : IComputeShader { public readonly ReadWriteBuffer source; @@ -369,6 +372,7 @@ public partial class BufferTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct DoublePrecisionSupportShader : IComputeShader { public readonly ReadWriteBuffer buffer; diff --git a/tests/ComputeSharp.Tests/ComputeContextTests.cs b/tests/ComputeSharp.Tests/ComputeContextTests.cs index 78ce0ab5..07f12e49 100644 --- a/tests/ComputeSharp.Tests/ComputeContextTests.cs +++ b/tests/ComputeSharp.Tests/ComputeContextTests.cs @@ -1294,6 +1294,7 @@ public partial class ComputeContextTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct OffsetComputeShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -1307,6 +1308,7 @@ public partial class ComputeContextTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct ClearPixelShader : IPixelShader { /// @@ -1317,6 +1319,7 @@ public partial class ComputeContextTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct ColorPixelShader : IPixelShader { public readonly float4 color; @@ -1329,6 +1332,7 @@ public partial class ComputeContextTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct LinearSampling2DPixelShader : IPixelShader { public readonly IReadOnlyTexture2D source; @@ -1341,6 +1345,7 @@ public partial class ComputeContextTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct LinearSampling3DComputeShader : IComputeShader { public readonly IReadOnlyTexture3D source; @@ -1359,6 +1364,7 @@ public partial class ComputeContextTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct LinearSamplingFromNormalized2DPixelShader : IPixelShader { public readonly IReadOnlyNormalizedTexture2D source; @@ -1371,6 +1377,7 @@ public partial class ComputeContextTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct CopyToOutputPixelShader : IPixelShader { public readonly IReadOnlyNormalizedTexture2D source; @@ -1383,6 +1390,7 @@ public partial class ComputeContextTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct InvertPixelShader : IPixelShader { public readonly IReadWriteNormalizedTexture2D source; @@ -1395,6 +1403,7 @@ public partial class ComputeContextTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct LinearSamplingFromNormalized3DComputeShader : IComputeShader { public readonly IReadOnlyNormalizedTexture3D source; @@ -1413,6 +1422,7 @@ public partial class ComputeContextTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct Dotted2DPixelShader : IComputeShader { public readonly IReadWriteNormalizedTexture2D source; @@ -1441,6 +1451,7 @@ public partial class ComputeContextTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct Dotted3DPixelShader : IComputeShader { public readonly IReadWriteNormalizedTexture3D source; @@ -1469,6 +1480,7 @@ public partial class ComputeContextTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct ConvertToNonNormalized2DShader : IComputeShader { public readonly IReadOnlyNormalizedTexture2D source; diff --git a/tests/ComputeSharp.Tests/DispatchTests.cs b/tests/ComputeSharp.Tests/DispatchTests.cs index 7e93e0a4..e551fb06 100644 --- a/tests/ComputeSharp.Tests/DispatchTests.cs +++ b/tests/ComputeSharp.Tests/DispatchTests.cs @@ -57,6 +57,7 @@ public partial class DispatchTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct ThreadIdsShader : IComputeShader { public readonly ReadWriteTexture3D buffer; @@ -111,6 +112,7 @@ public partial class DispatchTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct ThreadIdsNormalizedShader : IComputeShader { public readonly ReadWriteTexture3D buffer; @@ -172,6 +174,7 @@ public partial class DispatchTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct GroupIdsShader : IComputeShader { public readonly ReadWriteTexture3D buffer; @@ -202,6 +205,7 @@ public partial class DispatchTests } [AutoConstructor] + [EmbeddedBytecode(4, 15, 7)] internal readonly partial struct GroupSizeShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -234,6 +238,7 @@ public partial class DispatchTests } [AutoConstructor] + [EmbeddedBytecode(32, 1, 1)] internal readonly partial struct GridIdsShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -265,6 +270,7 @@ public partial class DispatchTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct DispatchSizeShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -304,6 +310,7 @@ public partial class DispatchTests } } + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct DispatchPixelShader : IPixelShader { public float4 Execute() @@ -333,6 +340,7 @@ public partial class DispatchTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct FixedGroupSharedPixelShader : IComputeShader { private readonly ReadWriteBuffer buffer; @@ -376,6 +384,7 @@ public partial class DispatchTests } [AutoConstructor] + [EmbeddedBytecode(32, 1, 1)] internal readonly partial struct DynamicGroupSharedPixelShader : IComputeShader { private readonly ReadWriteBuffer buffer; diff --git a/tests/ComputeSharp.Tests/IPixelShaderTests.cs b/tests/ComputeSharp.Tests/IPixelShaderTests.cs index 0c2c60cc..f81606a4 100644 --- a/tests/ComputeSharp.Tests/IPixelShaderTests.cs +++ b/tests/ComputeSharp.Tests/IPixelShaderTests.cs @@ -35,6 +35,7 @@ public partial class IPixelShaderTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct EarlyReturnShader : IPixelShader { public float4 Execute() diff --git a/tests/ComputeSharp.Tests/InitializationTests.cs b/tests/ComputeSharp.Tests/InitializationTests.cs index 5e3332dc..005502f9 100644 --- a/tests/ComputeSharp.Tests/InitializationTests.cs +++ b/tests/ComputeSharp.Tests/InitializationTests.cs @@ -73,6 +73,7 @@ public partial class InitializationTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct SampleShader : IComputeShader { public readonly ReadWriteBuffer buffer; diff --git a/tests/ComputeSharp.Tests/ResourceDimensionsTests.g.cs b/tests/ComputeSharp.Tests/ResourceDimensionsTests.g.cs index f6d3e5ec..426325ff 100644 --- a/tests/ComputeSharp.Tests/ResourceDimensionsTests.g.cs +++ b/tests/ComputeSharp.Tests/ResourceDimensionsTests.g.cs @@ -1,4 +1,4 @@ -using ComputeSharp.Tests.Attributes; +using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -29,6 +29,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadOnlyBuffer_T1_AsReadOnlyBufferShader : IComputeShader { public readonly ReadOnlyBuffer source; @@ -61,6 +62,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteBuffer_T1_AsReadWriteBufferShader : IComputeShader { public readonly ReadWriteBuffer source; @@ -93,6 +95,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadOnlyTexture1D_T1_AsReadOnlyTexture1DShader : IComputeShader { public readonly ReadOnlyTexture1D source; @@ -125,6 +128,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteTexture1D_T1_AsReadWriteTexture1DShader : IComputeShader { public readonly ReadWriteTexture1D source; @@ -161,6 +165,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteTexture1D_T1_AsIReadOnlyTexture1DShader : IComputeShader { public readonly IReadOnlyTexture1D source; @@ -193,6 +198,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadOnlyTexture1D_T2_AsReadOnlyTexture1DShader : IComputeShader { public readonly ReadOnlyTexture1D source; @@ -225,6 +231,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadOnlyTexture1D_T2_AsIReadOnlyNormalizedTexture1DShader : IComputeShader { public readonly IReadOnlyNormalizedTexture1D source; @@ -257,6 +264,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteTexture1D_T2_AsReadWriteTexture1DShader : IComputeShader { public readonly ReadWriteTexture1D source; @@ -289,6 +297,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteTexture1D_T2_AsIReadWriteNormalizedTexture1DShader : IComputeShader { public readonly IReadWriteNormalizedTexture1D source; @@ -321,6 +330,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadOnlyTexture2D_T1_AsReadOnlyTexture2DShader : IComputeShader { public readonly ReadOnlyTexture2D source; @@ -354,6 +364,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteTexture2D_T1_AsReadWriteTexture2DShader : IComputeShader { public readonly ReadWriteTexture2D source; @@ -391,6 +402,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteTexture2D_T1_AsIReadOnlyTexture2DShader : IComputeShader { public readonly IReadOnlyTexture2D source; @@ -424,6 +436,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadOnlyTexture2D_T2_AsReadOnlyTexture2DShader : IComputeShader { public readonly ReadOnlyTexture2D source; @@ -457,6 +470,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadOnlyTexture2D_T2_AsIReadOnlyNormalizedTexture2DShader : IComputeShader { public readonly IReadOnlyNormalizedTexture2D source; @@ -490,6 +504,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteTexture2D_T2_AsReadWriteTexture2DShader : IComputeShader { public readonly ReadWriteTexture2D source; @@ -523,6 +538,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteTexture2D_T2_AsIReadWriteNormalizedTexture2DShader : IComputeShader { public readonly IReadWriteNormalizedTexture2D source; @@ -556,6 +572,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadOnlyTexture3D_T1_AsReadOnlyTexture3DShader : IComputeShader { public readonly ReadOnlyTexture3D source; @@ -590,6 +607,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteTexture3D_T1_AsReadWriteTexture3DShader : IComputeShader { public readonly ReadWriteTexture3D source; @@ -628,6 +646,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteTexture3D_T1_AsIReadOnlyTexture3DShader : IComputeShader { public readonly IReadOnlyTexture3D source; @@ -662,6 +681,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadOnlyTexture3D_T2_AsReadOnlyTexture3DShader : IComputeShader { public readonly ReadOnlyTexture3D source; @@ -696,6 +716,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadOnlyTexture3D_T2_AsIReadOnlyNormalizedTexture3DShader : IComputeShader { public readonly IReadOnlyNormalizedTexture3D source; @@ -730,6 +751,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteTexture3D_T2_AsReadWriteTexture3DShader : IComputeShader { public readonly ReadWriteTexture3D source; @@ -764,6 +786,7 @@ public partial class ResourceDimensionsTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteTexture3D_T2_AsIReadWriteNormalizedTexture3DShader : IComputeShader { public readonly IReadWriteNormalizedTexture3D source; diff --git a/tests/ComputeSharp.Tests/ResourceDimensionsTests.tt b/tests/ComputeSharp.Tests/ResourceDimensionsTests.tt index a315d0d5..b39c5b09 100644 --- a/tests/ComputeSharp.Tests/ResourceDimensionsTests.tt +++ b/tests/ComputeSharp.Tests/ResourceDimensionsTests.tt @@ -1,4 +1,4 @@ -<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ template debug="false" hostspecific="false" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text.RegularExpressions" #> @@ -132,6 +132,7 @@ foreach (var pair in typesMap) } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct <#=testMethodName#>Shader : IComputeShader { public readonly <#=shaderResourceType#> source; diff --git a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs index d17c8344..34ee62e0 100644 --- a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs +++ b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs @@ -18,6 +18,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct ReservedKeywordsShader : IComputeShader { public readonly ReadWriteBuffer row_major; @@ -53,6 +54,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct ReservedKeywordsInCustomTypesShader : IComputeShader { public readonly ReadWriteBuffer row_major; @@ -80,6 +82,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct ReservedKeywordsFromHlslTypesAndBuiltInValuesShader : IComputeShader { public readonly ReadWriteBuffer fragmentKeyword; @@ -158,6 +161,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct SpecialTypeAsReturnTypeShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -179,6 +183,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct LocalFunctionInExternalMethodsShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -210,6 +215,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct CapturedNestedStructTypeShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -229,6 +235,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct ExternalStructTypeShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -250,6 +257,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct OutOfOrderMethodsShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -285,6 +293,7 @@ namespace ComputeSharp.Tests Assert.AreEqual(info.BoundResourceCount, 2u); } + [EmbeddedBytecode(DispatchAxis.XY)] public readonly partial struct StatelessPixelShader : IPixelShader { /// @@ -295,6 +304,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct LoopWithVarCounterShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -324,6 +334,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct DoublePrecisionSupportShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -343,6 +354,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct FieldAccessWithThisExpressionShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -369,6 +381,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ComputeShaderWithInheritedShaderInterfaceShader : IMyBaseShader { int IMyBaseShader.A => 42; @@ -402,6 +415,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct PixelShaderWithInheritedShaderInterfaceShader : IMyBaseShader { int IMyBaseShader.A => 42; @@ -450,6 +464,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct StructInstanceMethodsShader : IComputeShader { public readonly MyStructTypeA a; @@ -483,6 +498,7 @@ namespace ComputeSharp.Tests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct PixelShaderWithScopedParameterInMethodsShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -520,6 +536,7 @@ namespace ExternalNamespace public partial class ShaderCompilerTestsInExternalNamespace { [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct UserDefinedTypeShader : IComputeShader { public readonly ReadWriteBuffer buffer; diff --git a/tests/ComputeSharp.Tests/ShaderMembersTests.cs b/tests/ComputeSharp.Tests/ShaderMembersTests.cs index 17708f73..b48a2840 100644 --- a/tests/ComputeSharp.Tests/ShaderMembersTests.cs +++ b/tests/ComputeSharp.Tests/ShaderMembersTests.cs @@ -31,6 +31,7 @@ public partial class ShaderMembersTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct StaticConstantsShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -70,6 +71,7 @@ public partial class ShaderMembersTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct GlobalVariableShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -104,6 +106,7 @@ public partial class ShaderMembersTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct BoolInstanceFieldsShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -167,6 +170,7 @@ public partial class ShaderMembersTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct BoolInstanceFieldInCustomStructShader : IComputeShader { public readonly ReadWriteBuffer buffer; diff --git a/tests/ComputeSharp.Tests/ShaderRewriterTests.cs b/tests/ComputeSharp.Tests/ShaderRewriterTests.cs index 1037d14e..034bfaf8 100644 --- a/tests/ComputeSharp.Tests/ShaderRewriterTests.cs +++ b/tests/ComputeSharp.Tests/ShaderRewriterTests.cs @@ -52,6 +52,7 @@ public partial class ShaderRewriterTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct NanAndInfiniteShader : IComputeShader { public readonly ReadWriteBuffer buffer1; @@ -112,6 +113,7 @@ public partial class ShaderRewriterTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ModAndComparisonOperatorsShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -173,6 +175,7 @@ public partial class ShaderRewriterTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct BitwiseOperatorsShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -225,6 +228,7 @@ public partial class ShaderRewriterTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct BooleanOperatorsShader : IComputeShader { public readonly ReadWriteBuffer buffer; @@ -274,6 +278,7 @@ public partial class ShaderRewriterTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ToBooleanConversionIntrinsicsShader : IComputeShader { public readonly ReadOnlyBuffer buffer1; @@ -357,6 +362,7 @@ public partial class ShaderRewriterTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct FromBooleanConversionIntrinsicsShader : IComputeShader { public readonly ReadOnlyBuffer source; @@ -439,6 +445,7 @@ public partial class ShaderRewriterTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ConstantsInShaderConstantFieldsShader : IComputeShader { public const float rot_angle = (float)(137.2 / 180.0 * Math.PI); @@ -516,6 +523,7 @@ public partial class ShaderRewriterTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct DoubleConstantsInShaderConstantFieldsShader : IComputeShader { public const float DoubleToFloatConstant = (float)(1 / 255.0); @@ -622,6 +630,7 @@ public partial class ShaderRewriterTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct GlslStyleMulOperatorsShader : IComputeShader { public readonly ReadOnlyBuffer source1; @@ -762,6 +771,7 @@ public partial class ShaderRewriterTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct CustomStructTypeShader : IComputeShader { public readonly ReadWriteBuffer source; @@ -799,6 +809,7 @@ public partial class ShaderRewriterTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct MiscHlslIntrinsicsShader : IComputeShader { public readonly ReadWriteBuffer buffer1; @@ -841,6 +852,7 @@ public partial class ShaderRewriterTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadonlyModifierInMethodsShader : IComputeShader { private readonly ReadWriteBuffer buffer; diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/ColorfulInfinity.cs b/tests/ComputeSharp.Tests/Shaders/Compute/ColorfulInfinity.cs index 74e2c88d..07a6b4f5 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/ColorfulInfinity.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/ColorfulInfinity.cs @@ -9,6 +9,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct ColorfulInfinity : IComputeShader { /// diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/ContouredLayers.cs b/tests/ComputeSharp.Tests/Shaders/Compute/ContouredLayers.cs index b47e909d..267b42c7 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/ContouredLayers.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/ContouredLayers.cs @@ -8,6 +8,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// Created by Shane. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct ContouredLayers : IComputeShader { /// diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/ExtrudedTruchetPattern.cs b/tests/ComputeSharp.Tests/Shaders/Compute/ExtrudedTruchetPattern.cs index 7ef2f2b5..d6fc5a22 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/ExtrudedTruchetPattern.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/ExtrudedTruchetPattern.cs @@ -8,6 +8,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// Created by Shane. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct ExtrudedTruchetPattern : IComputeShader { /// diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/FourColorGradient.cs b/tests/ComputeSharp.Tests/Shaders/Compute/FourColorGradient.cs index 4a88ee95..781c3977 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/FourColorGradient.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/FourColorGradient.cs @@ -9,6 +9,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct FourColorGradient : IComputeShader { /// diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/FractalTiling.cs b/tests/ComputeSharp.Tests/Shaders/Compute/FractalTiling.cs index a1a79924..63b95527 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/FractalTiling.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/FractalTiling.cs @@ -9,6 +9,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct FractalTiling : IComputeShader { /// diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs b/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs index bd58fde3..5b0a6bad 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs @@ -7,6 +7,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// Ported from . /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct HelloWorld : IPixelShader { /// diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/MengerJourney.cs b/tests/ComputeSharp.Tests/Shaders/Compute/MengerJourney.cs index 13d6cc1b..eddb7030 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/MengerJourney.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/MengerJourney.cs @@ -8,6 +8,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// Created by Syntopia. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct MengerJourney : IComputeShader { /// diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/Octagrams.cs b/tests/ComputeSharp.Tests/Shaders/Compute/Octagrams.cs index 5c4b9141..6d82537d 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/Octagrams.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/Octagrams.cs @@ -8,6 +8,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// Created by whisky_shusuky. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct Octagrams : IComputeShader { /// diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/ProteanClouds.cs b/tests/ComputeSharp.Tests/Shaders/Compute/ProteanClouds.cs index 81091c26..837d8c33 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/ProteanClouds.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/ProteanClouds.cs @@ -9,6 +9,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct ProteanClouds : IComputeShader { /// diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/PyramidPattern.cs b/tests/ComputeSharp.Tests/Shaders/Compute/PyramidPattern.cs index 97b689a7..dd78a284 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/PyramidPattern.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/PyramidPattern.cs @@ -9,6 +9,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// Created by Shane. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct PyramidPattern : IComputeShader { /// diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/TerracedHills.cs b/tests/ComputeSharp.Tests/Shaders/Compute/TerracedHills.cs index 50bb13bd..4b70114c 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/TerracedHills.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/TerracedHills.cs @@ -6,6 +6,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// Created by Shane. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct TerracedHills : IComputeShader { /// diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/TriangleGridContouring.cs b/tests/ComputeSharp.Tests/Shaders/Compute/TriangleGridContouring.cs index 74f9d9a8..64df5c0f 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/TriangleGridContouring.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/TriangleGridContouring.cs @@ -8,6 +8,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// Created by Shane. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct TriangleGridContouring : IComputeShader { /// diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/TwoTiledTruchet.cs b/tests/ComputeSharp.Tests/Shaders/Compute/TwoTiledTruchet.cs index 142da84e..ae6ee711 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/TwoTiledTruchet.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/TwoTiledTruchet.cs @@ -8,6 +8,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// Created by Shane. /// [AutoConstructor] +[EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct TwoTiledTruchet : IComputeShader { /// diff --git a/tests/ComputeSharp.Tests/Texture1DTests.Pixels.cs b/tests/ComputeSharp.Tests/Texture1DTests.Pixels.cs index 522f8af8..014dec14 100644 --- a/tests/ComputeSharp.Tests/Texture1DTests.Pixels.cs +++ b/tests/ComputeSharp.Tests/Texture1DTests.Pixels.cs @@ -89,6 +89,7 @@ partial class Texture1DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] public readonly partial struct SamplingComputeShader : IComputeShader { public readonly IReadOnlyNormalizedTexture1D source; diff --git a/tests/ComputeSharp.Tests/Texture1DTests.Pixels.g.cs b/tests/ComputeSharp.Tests/Texture1DTests.Pixels.g.cs index a2971a09..4a791f90 100644 --- a/tests/ComputeSharp.Tests/Texture1DTests.Pixels.g.cs +++ b/tests/ComputeSharp.Tests/Texture1DTests.Pixels.g.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; @@ -69,6 +69,7 @@ partial class Texture1DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct Shader_Unorm_Bgra32_Float4 : IComputeShader { public readonly ReadOnlyTexture1D source; @@ -81,6 +82,7 @@ partial class Texture1DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct Shader_Unorm_R16_float : IComputeShader { public readonly ReadOnlyTexture1D source; @@ -93,6 +95,7 @@ partial class Texture1DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct Shader_Unorm_R8_float : IComputeShader { public readonly ReadOnlyTexture1D source; @@ -105,6 +108,7 @@ partial class Texture1DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct Shader_Unorm_Rg16_Float2 : IComputeShader { public readonly ReadOnlyTexture1D source; @@ -117,6 +121,7 @@ partial class Texture1DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct Shader_Unorm_Rg32_Float2 : IComputeShader { public readonly ReadOnlyTexture1D source; @@ -129,6 +134,7 @@ partial class Texture1DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct Shader_Unorm_Rgba32_Float4 : IComputeShader { public readonly ReadOnlyTexture1D source; @@ -141,6 +147,7 @@ partial class Texture1DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct Shader_Unorm_Rgba64_Float4 : IComputeShader { public readonly ReadOnlyTexture1D source; diff --git a/tests/ComputeSharp.Tests/Texture1DTests.Pixels.tt b/tests/ComputeSharp.Tests/Texture1DTests.Pixels.tt index 29e2195d..10c63aeb 100644 --- a/tests/ComputeSharp.Tests/Texture1DTests.Pixels.tt +++ b/tests/ComputeSharp.Tests/Texture1DTests.Pixels.tt @@ -1,4 +1,4 @@ -<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ template debug="false" hostspecific="false" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> @@ -65,6 +65,7 @@ foreach (var (t, tPixel) in EnumerateTypes()) #> [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct Shader_Unorm_<#=t#>_<#=tPixel#> : IComputeShader { public readonly ReadOnlyTexture1D<<#=t#>, <#=tPixel#>> source; diff --git a/tests/ComputeSharp.Tests/Texture1DTests.cs b/tests/ComputeSharp.Tests/Texture1DTests.cs index 21468a7c..ef323c0b 100644 --- a/tests/ComputeSharp.Tests/Texture1DTests.cs +++ b/tests/ComputeSharp.Tests/Texture1DTests.cs @@ -363,6 +363,7 @@ public partial class Texture1DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadOnlyTexture1DKernel : IComputeShader { public readonly ReadOnlyTexture1D source; @@ -393,6 +394,7 @@ public partial class Texture1DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.X)] internal readonly partial struct ReadWriteTexture1DKernel : IComputeShader { public readonly ReadWriteTexture1D source; diff --git a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs index 5fe9fec1..f204cb24 100644 --- a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs +++ b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs @@ -72,6 +72,7 @@ partial class Texture2DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] public readonly partial struct SamplingComputeShader : IComputeShader { public readonly IReadOnlyNormalizedTexture2D source; @@ -105,6 +106,7 @@ partial class Texture2DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] public readonly partial struct SamplingPixelShader : IPixelShader { public readonly IReadOnlyNormalizedTexture2D texture; diff --git a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.g.cs b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.g.cs index b0815b9f..51fd801e 100644 --- a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.g.cs +++ b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.g.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; @@ -69,6 +69,7 @@ partial class Texture2DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct Shader_Unorm_Bgra32_Float4 : IComputeShader { public readonly ReadOnlyTexture2D source; @@ -81,6 +82,7 @@ partial class Texture2DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct Shader_Unorm_R16_float : IComputeShader { public readonly ReadOnlyTexture2D source; @@ -93,6 +95,7 @@ partial class Texture2DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct Shader_Unorm_R8_float : IComputeShader { public readonly ReadOnlyTexture2D source; @@ -105,6 +108,7 @@ partial class Texture2DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct Shader_Unorm_Rg16_Float2 : IComputeShader { public readonly ReadOnlyTexture2D source; @@ -117,6 +121,7 @@ partial class Texture2DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct Shader_Unorm_Rg32_Float2 : IComputeShader { public readonly ReadOnlyTexture2D source; @@ -129,6 +134,7 @@ partial class Texture2DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct Shader_Unorm_Rgba32_Float4 : IComputeShader { public readonly ReadOnlyTexture2D source; @@ -141,6 +147,7 @@ partial class Texture2DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct Shader_Unorm_Rgba64_Float4 : IComputeShader { public readonly ReadOnlyTexture2D source; diff --git a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.tt b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.tt index da622b25..f5577e31 100644 --- a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.tt +++ b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.tt @@ -1,4 +1,4 @@ -<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ template debug="false" hostspecific="false" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> @@ -65,6 +65,7 @@ foreach (var (t, tPixel) in EnumerateTypes()) #> [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct Shader_Unorm_<#=t#>_<#=tPixel#> : IComputeShader { public readonly ReadOnlyTexture2D<<#=t#>, <#=tPixel#>> source; diff --git a/tests/ComputeSharp.Tests/Texture2DTests.cs b/tests/ComputeSharp.Tests/Texture2DTests.cs index a9dec703..5cf79486 100644 --- a/tests/ComputeSharp.Tests/Texture2DTests.cs +++ b/tests/ComputeSharp.Tests/Texture2DTests.cs @@ -428,6 +428,7 @@ public partial class Texture2DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct ReadOnlyTexture2DKernel : IComputeShader { public readonly ReadOnlyTexture2D source; @@ -458,6 +459,7 @@ public partial class Texture2DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XY)] internal readonly partial struct ReadWriteTexture2DKernel : IComputeShader { public readonly ReadWriteTexture2D source; diff --git a/tests/ComputeSharp.Tests/Texture3DTests.Pixels.g.cs b/tests/ComputeSharp.Tests/Texture3DTests.Pixels.g.cs index 5f3c08b7..f2601e67 100644 --- a/tests/ComputeSharp.Tests/Texture3DTests.Pixels.g.cs +++ b/tests/ComputeSharp.Tests/Texture3DTests.Pixels.g.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; @@ -69,6 +69,7 @@ partial class Texture3DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct Shader_Unorm_Bgra32_Float4 : IComputeShader { public readonly ReadOnlyTexture3D source; @@ -81,6 +82,7 @@ partial class Texture3DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct Shader_Unorm_R16_float : IComputeShader { public readonly ReadOnlyTexture3D source; @@ -93,6 +95,7 @@ partial class Texture3DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct Shader_Unorm_R8_float : IComputeShader { public readonly ReadOnlyTexture3D source; @@ -105,6 +108,7 @@ partial class Texture3DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct Shader_Unorm_Rg16_Float2 : IComputeShader { public readonly ReadOnlyTexture3D source; @@ -117,6 +121,7 @@ partial class Texture3DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct Shader_Unorm_Rg32_Float2 : IComputeShader { public readonly ReadOnlyTexture3D source; @@ -129,6 +134,7 @@ partial class Texture3DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct Shader_Unorm_Rgba32_Float4 : IComputeShader { public readonly ReadOnlyTexture3D source; @@ -141,6 +147,7 @@ partial class Texture3DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct Shader_Unorm_Rgba64_Float4 : IComputeShader { public readonly ReadOnlyTexture3D source; diff --git a/tests/ComputeSharp.Tests/Texture3DTests.Pixels.tt b/tests/ComputeSharp.Tests/Texture3DTests.Pixels.tt index 003696f7..f18c826b 100644 --- a/tests/ComputeSharp.Tests/Texture3DTests.Pixels.tt +++ b/tests/ComputeSharp.Tests/Texture3DTests.Pixels.tt @@ -1,4 +1,4 @@ -<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ template debug="false" hostspecific="false" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> @@ -65,6 +65,7 @@ foreach (var (t, tPixel) in EnumerateTypes()) #> [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct Shader_Unorm_<#=t#>_<#=tPixel#> : IComputeShader { public readonly ReadOnlyTexture3D<<#=t#>, <#=tPixel#>> source; diff --git a/tests/ComputeSharp.Tests/Texture3DTests.cs b/tests/ComputeSharp.Tests/Texture3DTests.cs index 62c4f4e7..faa111a4 100644 --- a/tests/ComputeSharp.Tests/Texture3DTests.cs +++ b/tests/ComputeSharp.Tests/Texture3DTests.cs @@ -533,6 +533,7 @@ public partial class Texture3DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct ReadOnlyTexture3DKernel : IComputeShader { public readonly ReadOnlyTexture3D source; @@ -563,6 +564,7 @@ public partial class Texture3DTests } [AutoConstructor] + [EmbeddedBytecode(DispatchAxis.XYZ)] internal readonly partial struct ReadWriteTexture3DKernel : IComputeShader { public readonly ReadWriteTexture3D source;