Add unit tests for empty D2D1 shader
このコミットが含まれているのは:
1 親
8a6da6b30a
コミット
8af20e13b9
3ファイル変更
+28
-5
検索条件に一致するファイルはありません
@@ -6,13 +6,11 @@
|
||||
[AutoConstructor]
|
||||
public partial struct InvertEffect : ID2D1PixelShader
|
||||
{
|
||||
public float number;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
float4 color = D2D.GetInput(0);
|
||||
float3 rgb = Hlsl.Saturate(this.number - color.RGB);
|
||||
float3 rgb = Hlsl.Saturate(1.0f - color.RGB);
|
||||
|
||||
return new(rgb, 1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace ComputeSharp.D2D1.Tests.Effects;
|
||||
|
||||
[D2DInputCount(1)]
|
||||
[D2DInputSimple(0)]
|
||||
[D2DEmbeddedBytecode(D2D1ShaderProfile.PixelShader50)]
|
||||
[AutoConstructor]
|
||||
public partial struct InvertWithThresholdEffect : ID2D1PixelShader
|
||||
{
|
||||
public float number;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
float4 color = D2D.GetInput(0);
|
||||
float3 rgb = Hlsl.Saturate(this.number - color.RGB);
|
||||
|
||||
return new(rgb, 1);
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,15 @@ namespace ComputeSharp.D2D1.Tests;
|
||||
public class EndToEndTests
|
||||
{
|
||||
[TestMethod]
|
||||
public unsafe void InvertWithCustomThreshold()
|
||||
public unsafe void Invert()
|
||||
{
|
||||
RunAndCompareShader(new InvertEffect(1), null, "Landscape.png", "Landscape_Inverted.png");
|
||||
RunAndCompareShader(new InvertEffect(), null, "Landscape.png", "Landscape_Inverted.png");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public unsafe void InvertWithThreshold()
|
||||
{
|
||||
RunAndCompareShader(new InvertWithThresholdEffect(1), null, "Landscape.png", "Landscape_Inverted.png");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする