Add D2D1 shader to test custom constructors

このコミットが含まれているのは:
Sergio Pedri committed 2023-12-02 23:25:23 +01:00
1 親 2266fe8afd
コミット 4ec30767ce
3ファイル変更
+40

検索条件に一致するファイルはありません

+33
ファイルの表示
@@ -0,0 +1,33 @@
#pragma warning disable IDE0290
namespace ComputeSharp.D2D1.Tests.Effects;
public struct ColorWrapper
{
private float4 value;
public ColorWrapper(float4 color)
{
this.value = color;
}
public float4 Invert()
{
return new(Hlsl.Saturate(1.0f - this.value.RGB), 1);
}
}
[D2DInputCount(1)]
[D2DInputSimple(0)]
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
[D2DGeneratedPixelShaderDescriptor]
public partial struct InvertWithUserTypeWithConstructorEffect : ID2D1PixelShader
{
/// <inheritdoc/>
public float4 Execute()
{
ColorWrapper wrapper = new(D2D.GetInput(0));
return wrapper.Invert();
}
}
+6
ファイルの表示
@@ -33,6 +33,12 @@ public class EffectsTests
D2D1TestRunner.RunAndCompareShader(new InvertWithThresholdEffect(1), null, "Landscape.png", "Landscape_Inverted.png");
}
[TestMethod]
public void InvertWithUserTypeWithConstructor()
{
D2D1TestRunner.RunAndCompareShader(new InvertWithUserTypeWithConstructorEffect(), null, "Landscape.png", "Landscape_Inverted.png");
}
[TestMethod]
public void Pixelate()
{
+1
ファイルの表示
@@ -79,6 +79,7 @@ public partial class UserDefinedTypeConstructorTests
}
}
// See https://github.com/Sergio0694/ComputeSharp/issues/481
[CombinatorialTestMethod]
[Device(Device.Warp)]
public void ConstructorWithParameters(Device device)