Switch unit tests to AutoConstructor package
このコミットが含まれているのは:
1 親
a4a7836563
コミット
9f4028e949
14ファイル変更
+56
-71
検索条件に一致するファイルはありません
@@ -8,6 +8,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoConstructor" Version="5.1.0" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
|
||||
|
||||
@@ -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<float4> 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()
|
||||
|
||||
@@ -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<float4> 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<float> 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];
|
||||
}
|
||||
|
||||
@@ -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<float> 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<float> 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
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
@@ -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
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoConstructor" Version="5.1.0" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" ExcludeAssets="build" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoConstructor" Version="5.1.0" PrivateAssets="all" />
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.2.2" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
|
||||
|
||||
+1
@@ -5,6 +5,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoConstructor" Version="5.1.0" PrivateAssets="all" />
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.2.2" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
|
||||
|
||||
@@ -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<float> sourceTexture) : IComputeShader
|
||||
{
|
||||
private readonly ReadWriteBuffer<float> 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]);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoConstructor" Version="5.1.0" PrivateAssets="all" />
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.2.2" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
|
||||
|
||||
@@ -16,7 +16,7 @@ public partial class ShaderDataLoaderTests
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
public readonly partial struct CapturedResourceShader : IComputeShader
|
||||
{
|
||||
public readonly ReadWriteBuffer<float> _;
|
||||
public readonly ReadWriteBuffer<float> _buffer;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
@@ -52,8 +52,8 @@ public partial class ShaderDataLoaderTests
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
public readonly partial struct MultipleResourcesAndPrimitivesShader : IComputeShader
|
||||
{
|
||||
public readonly ReadWriteBuffer<float> _0;
|
||||
public readonly ReadWriteBuffer<float> _1;
|
||||
public readonly ReadWriteBuffer<float> _buffer0;
|
||||
public readonly ReadWriteBuffer<float> _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<float> _;
|
||||
public readonly ReadWriteBuffer<float> _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<float> _;
|
||||
public readonly ReadWriteBuffer<float> _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<float> _0;
|
||||
public readonly ReadWriteBuffer<float> _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<float> _0;
|
||||
public readonly ReadWriteBuffer<float> _buffer0;
|
||||
public readonly CustomType1 a;
|
||||
|
||||
public void Execute()
|
||||
|
||||
@@ -1308,7 +1308,6 @@ public partial class ComputeContextTests
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
[ThreadGroupSize(DefaultThreadGroupSizes.XY)]
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
internal readonly partial struct ClearPixelShader : IComputeShader<float4>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoConstructor" Version="5.1.0" PrivateAssets="all" />
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.2.2" />
|
||||
<PackageReference Include="CommunityToolkit.HighPerformance" Version="8.2.2" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
|
||||
@@ -34,7 +34,6 @@ public partial class IPixelShaderTests
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
[ThreadGroupSize(DefaultThreadGroupSizes.XY)]
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
internal readonly partial struct EarlyReturnShader : IComputeShader<float4>
|
||||
|
||||
@@ -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]
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする