diff --git a/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj b/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj index a3fffde8..e4a71062 100644 --- a/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj +++ b/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj @@ -8,6 +8,7 @@ + diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs index 54f7d40b..a3c7fcb8 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs @@ -2,7 +2,6 @@ using System; using System.Buffers; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using ComputeSharp; using ComputeSharp.D2D1; using ComputeSharp.D2D1.Interop; using ComputeSharp.D2D1.Tests.Effects; @@ -323,7 +322,6 @@ namespace ComputeSharp.D2D1.Tests [D2DInputComplex(3)] [D2DShaderProfile(D2D1ShaderProfile.PixelShader50)] [D2DGeneratedPixelShaderDescriptor] - [AutoConstructor] internal partial struct ShaderWithoutResourceTextures : ID2D1PixelShader { public Float4 Execute() @@ -335,7 +333,6 @@ namespace ComputeSharp.D2D1.Tests [D2DInputCount(0)] [D2DShaderProfile(D2D1ShaderProfile.PixelShader50)] [D2DGeneratedPixelShaderDescriptor] - [AutoConstructor] internal readonly partial struct ShaderWithJustOneResourceTextures : ID2D1PixelShader { [D2DResourceTextureIndex(0)] @@ -354,11 +351,8 @@ namespace ComputeSharp.D2D1.Tests [D2DInputComplex(3)] [D2DShaderProfile(D2D1ShaderProfile.PixelShader50)] [D2DGeneratedPixelShaderDescriptor] - [AutoConstructor] - internal readonly partial struct ShaderWithResourceTextures : ID2D1PixelShader + internal readonly partial struct ShaderWithResourceTextures(float number) : ID2D1PixelShader { - readonly float number; - [D2DResourceTextureIndex(4)] readonly D2D1ResourceTexture1D myTexture1; @@ -381,7 +375,7 @@ namespace ComputeSharp.D2D1.Tests float4 pixel6 = this.myTexture3.Sample(0.4f, 0.5f, 0.6f); float number1 = this.myTexture4[0, 2]; float number2 = this.myTexture4.Sample(0.4f, 0.6f); - float number3 = this.number; + float number3 = number; return 0; } @@ -1128,7 +1122,6 @@ namespace ComputeSharp.D2D1.Tests { [D2DInputCount(0)] [D2DGeneratedPixelShaderDescriptor] - [AutoConstructor] public readonly partial struct DeeplyNestedShader : ID2D1PixelShader { public float4 Execute() diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs index 850933b3..cee6a83d 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs @@ -535,11 +535,8 @@ public partial class D2D1ResourceTextureManagerTests [D2DInputCount(0)] [D2DRequiresScenePosition] [D2DGeneratedPixelShaderDescriptor] - [AutoConstructor] - internal readonly partial struct IndexFrom3DResourceTextureShader : ID2D1PixelShader + internal readonly partial struct IndexFrom3DResourceTextureShader(float height) : ID2D1PixelShader { - private readonly int height; - [D2DResourceTextureIndex(0)] private readonly D2D1ResourceTexture3D source; @@ -548,8 +545,8 @@ public partial class D2D1ResourceTextureManagerTests int2 xy = (int2)D2D.GetScenePosition().XY; int x = xy.X; - int y = (int)((uint)xy.Y % (uint)this.height); - int z = (int)((uint)xy.Y / (uint)this.height); + int y = (int)((uint)xy.Y % (uint)height); + int z = (int)((uint)xy.Y / (uint)height); return this.source[x, y, z]; } @@ -895,11 +892,8 @@ public partial class D2D1ResourceTextureManagerTests [D2DInputCount(0)] [D2DRequiresScenePosition] [D2DGeneratedPixelShaderDescriptor] - [AutoConstructor] - internal readonly partial struct CopyFromResourceTexture3DShader : ID2D1PixelShader + internal readonly partial struct CopyFromResourceTexture3DShader(float height) : ID2D1PixelShader { - private readonly int height; - [D2DResourceTextureIndex(0)] private readonly D2D1ResourceTexture3D source; @@ -908,8 +902,8 @@ public partial class D2D1ResourceTextureManagerTests int2 xy = (int2)D2D.GetScenePosition().XY; int x = xy.X; - int y = (int)((uint)xy.Y % (uint)this.height); - int z = (int)((uint)xy.Y / (uint)this.height); + int y = (int)((uint)xy.Y % (uint)height); + int z = (int)((uint)xy.Y / (uint)height); return this.source[x, y, z]; } diff --git a/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs b/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs index 283f6c6e..52e413cc 100644 --- a/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs +++ b/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs @@ -493,10 +493,9 @@ public sealed partial class BokehBlurEffect [D2DShaderProfile(D2D1ShaderProfile.PixelShader50)] [D2DRequiresScenePosition] [D2DGeneratedPixelShaderDescriptor] - [AutoConstructor] - public readonly partial struct Shader : ID2D1PixelShader + public readonly partial struct Shader(int kernelLength) : ID2D1PixelShader { - public readonly int kernelLength; + public readonly int kernelLength = kernelLength; [D2DResourceTextureIndex(1)] private readonly D2D1ResourceTexture1D kernel; @@ -543,12 +542,12 @@ public sealed partial class BokehBlurEffect [D2DShaderProfile(D2D1ShaderProfile.PixelShader50)] [D2DRequiresScenePosition] [D2DGeneratedPixelShaderDescriptor] - [AutoConstructor] - public readonly partial struct Shader : ID2D1PixelShader + public readonly partial struct Shader( + int kernelLength, + float z, + float w) : ID2D1PixelShader { - public readonly int kernelLength; - private readonly float z; - private readonly float w; + public readonly int kernelLength = kernelLength; [D2DResourceTextureIndex(2)] private readonly D2D1ResourceTexture1D kernelReals; @@ -574,7 +573,7 @@ public sealed partial class BokehBlurEffect result.Imaginary += (Vector4)((realFactor * sourceImaginary) + (imaginaryFactor * sourceReal)); } - return result.WeightedSum(this.z, this.w); + return result.WeightedSum(z, w); } } } @@ -588,7 +587,6 @@ public sealed partial class BokehBlurEffect [D2DOutputBuffer(D2D1BufferPrecision.Float32, D2D1ChannelDepth.Four)] [D2DShaderProfile(D2D1ShaderProfile.PixelShader50)] [D2DGeneratedPixelShaderDescriptor] - [AutoConstructor] internal readonly partial struct GammaHighlight : ID2D1PixelShader { /// @@ -611,7 +609,6 @@ public sealed partial class BokehBlurEffect [D2DOutputBuffer(D2D1BufferPrecision.Float32, D2D1ChannelDepth.Four)] [D2DShaderProfile(D2D1ShaderProfile.PixelShader50)] [D2DGeneratedPixelShaderDescriptor] - [AutoConstructor] internal readonly partial struct InverseGammaHighlight : ID2D1PixelShader { /// diff --git a/tests/ComputeSharp.D2D1.WinUI.Tests/ComputeSharp.D2D1.WinUI.Tests.csproj b/tests/ComputeSharp.D2D1.WinUI.Tests/ComputeSharp.D2D1.WinUI.Tests.csproj index ae3d7cdf..4cedb5f2 100644 --- a/tests/ComputeSharp.D2D1.WinUI.Tests/ComputeSharp.D2D1.WinUI.Tests.csproj +++ b/tests/ComputeSharp.D2D1.WinUI.Tests/ComputeSharp.D2D1.WinUI.Tests.csproj @@ -56,6 +56,7 @@ + diff --git a/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj b/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj index 2f541db4..f7937242 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj +++ b/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj @@ -10,6 +10,7 @@ + diff --git a/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj b/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj index 40e033b2..22d5e6e8 100644 --- a/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj +++ b/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj @@ -5,6 +5,7 @@ + diff --git a/tests/ComputeSharp.Tests.GlobalStatements/Program.cs b/tests/ComputeSharp.Tests.GlobalStatements/Program.cs index db039501..9b792313 100644 --- a/tests/ComputeSharp.Tests.GlobalStatements/Program.cs +++ b/tests/ComputeSharp.Tests.GlobalStatements/Program.cs @@ -21,13 +21,10 @@ if (!numbers.SequenceEqual(result)) Console.WriteLine("Test passed successfully!"); -[AutoConstructor] [ThreadGroupSize(DefaultThreadGroupSizes.X)] [GeneratedComputeShaderDescriptor] -public readonly partial struct ApplyFunctionShader : IComputeShader +public readonly partial struct ApplyFunctionShader(ReadWriteBuffer sourceTexture) : IComputeShader { - private readonly ReadWriteBuffer sourceTexture; - public static float AddHalf(float input) { return input + 0.5f; @@ -35,6 +32,6 @@ public readonly partial struct ApplyFunctionShader : IComputeShader public void Execute() { - this.sourceTexture[ThreadIds.X] = AddHalf(this.sourceTexture[ThreadIds.X]); + sourceTexture[ThreadIds.X] = AddHalf(sourceTexture[ThreadIds.X]); } } \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj index 56163588..8246c7ce 100644 --- a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj +++ b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj @@ -5,6 +5,7 @@ + diff --git a/tests/ComputeSharp.Tests.Internals/ShaderDataLoaderTests.cs b/tests/ComputeSharp.Tests.Internals/ShaderDataLoaderTests.cs index df813a78..6378936d 100644 --- a/tests/ComputeSharp.Tests.Internals/ShaderDataLoaderTests.cs +++ b/tests/ComputeSharp.Tests.Internals/ShaderDataLoaderTests.cs @@ -16,7 +16,7 @@ public partial class ShaderDataLoaderTests [GeneratedComputeShaderDescriptor] public readonly partial struct CapturedResourceShader : IComputeShader { - public readonly ReadWriteBuffer _; + public readonly ReadWriteBuffer _buffer; public void Execute() { @@ -52,8 +52,8 @@ public partial class ShaderDataLoaderTests [GeneratedComputeShaderDescriptor] public readonly partial struct MultipleResourcesAndPrimitivesShader : IComputeShader { - public readonly ReadWriteBuffer _0; - public readonly ReadWriteBuffer _1; + public readonly ReadWriteBuffer _buffer0; + public readonly ReadWriteBuffer _buffer1; public readonly int a; public readonly int b; public readonly int c; @@ -98,7 +98,7 @@ public partial class ShaderDataLoaderTests [GeneratedComputeShaderDescriptor] public readonly partial struct ScalarAndVectorTypesShader : IComputeShader { - public readonly ReadWriteBuffer _; + public readonly ReadWriteBuffer _buffer; public readonly float3 f3; public readonly int a; public readonly int b; @@ -149,7 +149,7 @@ public partial class ShaderDataLoaderTests [GeneratedComputeShaderDescriptor] public readonly partial struct ScalarVectorAndMatrixTypesShader : IComputeShader { - public readonly ReadWriteBuffer _; + public readonly ReadWriteBuffer _buffer; public readonly float2x3 f2x3; public readonly int a; public readonly Int1x3 i1x3; @@ -218,16 +218,16 @@ public partial class ShaderDataLoaderTests } [AutoConstructor] - public partial struct SimpleTypes + public readonly partial struct SimpleTypes { - public float2x3 f2x3; - public int a; - public Int1x3 i1x3; - public double2 d2; - public int c; - public Int1x2 i1x2; - public int2x2 i2x2; - public int d; + public readonly float2x3 f2x3; + public readonly int a; + public readonly Int1x3 i1x3; + public readonly double2 d2; + public readonly int c; + public readonly Int1x2 i1x2; + public readonly int2x2 i2x2; + public readonly int d; } [AutoConstructor] @@ -235,7 +235,7 @@ public partial class ShaderDataLoaderTests [GeneratedComputeShaderDescriptor] public readonly partial struct FlatCustomTypeShader : IComputeShader { - public readonly ReadWriteBuffer _0; + public readonly ReadWriteBuffer _buffer0; public readonly SimpleTypes a; public void Execute() @@ -298,28 +298,28 @@ public partial class ShaderDataLoaderTests } [AutoConstructor] - public partial struct CustomType1 + public readonly partial struct CustomType1 { - public float3 a; - public SimpleTypes b; - public int c; - public CustomType2 d; - public CustomType3 e; + public readonly float3 a; + public readonly SimpleTypes b; + public readonly int c; + public readonly CustomType2 d; + public readonly CustomType3 e; } [AutoConstructor] - public partial struct CustomType2 + public readonly partial struct CustomType2 { - public int a; - public float2 b; - public CustomType3 c; + public readonly int a; + public readonly float2 b; + public readonly CustomType3 c; } [AutoConstructor] - public partial struct CustomType3 + public readonly partial struct CustomType3 { - public int a; - public float2 b; + public readonly int a; + public readonly float2 b; } [AutoConstructor] @@ -327,7 +327,7 @@ public partial class ShaderDataLoaderTests [GeneratedComputeShaderDescriptor] public readonly partial struct NestedCustomTypesShader : IComputeShader { - public readonly ReadWriteBuffer _0; + public readonly ReadWriteBuffer _buffer0; public readonly CustomType1 a; public void Execute() diff --git a/tests/ComputeSharp.Tests/ComputeContextTests.cs b/tests/ComputeSharp.Tests/ComputeContextTests.cs index b86e04ef..f0ede1eb 100644 --- a/tests/ComputeSharp.Tests/ComputeContextTests.cs +++ b/tests/ComputeSharp.Tests/ComputeContextTests.cs @@ -1308,7 +1308,6 @@ public partial class ComputeContextTests } } - [AutoConstructor] [ThreadGroupSize(DefaultThreadGroupSizes.XY)] [GeneratedComputeShaderDescriptor] internal readonly partial struct ClearPixelShader : IComputeShader diff --git a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj index 352b5d75..54473c12 100644 --- a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj +++ b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj @@ -10,6 +10,7 @@ + diff --git a/tests/ComputeSharp.Tests/IPixelShaderTests.cs b/tests/ComputeSharp.Tests/IPixelShaderTests.cs index 9bb23915..70a652a6 100644 --- a/tests/ComputeSharp.Tests/IPixelShaderTests.cs +++ b/tests/ComputeSharp.Tests/IPixelShaderTests.cs @@ -34,7 +34,6 @@ public partial class IPixelShaderTests } } - [AutoConstructor] [ThreadGroupSize(DefaultThreadGroupSizes.XY)] [GeneratedComputeShaderDescriptor] internal readonly partial struct EarlyReturnShader : IComputeShader diff --git a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs index 0115bac2..afdbb256 100644 --- a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs +++ b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs @@ -230,10 +230,10 @@ namespace ComputeSharp.Tests } [AutoConstructor] - public partial struct CustomStructType + public readonly partial struct CustomStructType { - public float2 a; - public int b; + public readonly float2 a; + public readonly int b; } [AutoConstructor]