Add D2D1 shader to test custom constructors
このコミットが含まれているのは:
1 親
2266fe8afd
コミット
4ec30767ce
3ファイル変更
+40
検索条件に一致するファイルはありません
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,6 +33,12 @@ public class EffectsTests
|
|||||||
D2D1TestRunner.RunAndCompareShader(new InvertWithThresholdEffect(1), null, "Landscape.png", "Landscape_Inverted.png");
|
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]
|
[TestMethod]
|
||||||
public void Pixelate()
|
public void Pixelate()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public partial class UserDefinedTypeConstructorTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See https://github.com/Sergio0694/ComputeSharp/issues/481
|
||||||
[CombinatorialTestMethod]
|
[CombinatorialTestMethod]
|
||||||
[Device(Device.Warp)]
|
[Device(Device.Warp)]
|
||||||
public void ConstructorWithParameters(Device device)
|
public void ConstructorWithParameters(Device device)
|
||||||
|
|||||||
新しいイシューから参照
ユーザーをブロックする