diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj b/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj
index 095fcb7d..254db83b 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj
+++ b/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj
@@ -20,6 +20,7 @@
+
diff --git a/tests/ComputeSharp.D2D1.Tests/Assets/Landscape_CheckerboardClip.png b/tests/ComputeSharp.D2D1.Tests/Assets/Landscape_CheckerboardClip.png
new file mode 100644
index 00000000..bed52a7d
Binary files /dev/null and b/tests/ComputeSharp.D2D1.Tests/Assets/Landscape_CheckerboardClip.png differ
diff --git a/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj b/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj
index 5816c386..8c49cd29 100644
--- a/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj
+++ b/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj
@@ -29,6 +29,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
diff --git a/tests/ComputeSharp.D2D1.Tests/Effects/CheckerboardClipEffect.cs b/tests/ComputeSharp.D2D1.Tests/Effects/CheckerboardClipEffect.cs
new file mode 100644
index 00000000..028f59b6
--- /dev/null
+++ b/tests/ComputeSharp.D2D1.Tests/Effects/CheckerboardClipEffect.cs
@@ -0,0 +1,32 @@
+namespace ComputeSharp.D2D1.Tests.Effects;
+
+[D2DInputCount(1)]
+[D2DInputSimple(0)]
+[D2DRequiresScenePosition]
+[D2DEmbeddedBytecode(D2D1ShaderProfile.PixelShader50)]
+[AutoConstructor]
+public partial struct CheckerboardClipEffect : ID2D1PixelShader
+{
+ public int width;
+ public int height;
+ public int cellSize;
+
+ ///
+ public float4 Execute()
+ {
+ float2 position = D2D.GetScenePosition().XY;
+ uint x = (uint)Hlsl.Floor(position.X);
+ uint y = (uint)Hlsl.Floor(position.Y);
+
+ uint cellX = (uint)(int)Hlsl.Floor(x / cellSize);
+ uint cellY = (uint)(int)Hlsl.Floor(y / cellSize);
+
+ if ((cellX % 2 == 0 && cellY % 2 == 0) ||
+ (cellX % 2 == 1 && cellY % 2 == 1))
+ {
+ Hlsl.Clip(-1);
+ }
+
+ return D2D.GetInput(0);
+ }
+}
diff --git a/tests/ComputeSharp.D2D1.Tests/EndToEndTests.cs b/tests/ComputeSharp.D2D1.Tests/EndToEndTests.cs
index 47e91438..d82fb789 100644
--- a/tests/ComputeSharp.D2D1.Tests/EndToEndTests.cs
+++ b/tests/ComputeSharp.D2D1.Tests/EndToEndTests.cs
@@ -41,6 +41,12 @@ public class EndToEndTests
RunAndCompareShader(new ZonePlateEffect(1280, 720, 800), null, 1280, 720, "ZonePlate.png");
}
+ [TestMethod]
+ public unsafe void CheckerboardClip()
+ {
+ RunAndCompareShader(new CheckerboardClipEffect(1280, 840, 32), null, "Landscape.png", "Landscape_CheckerboardClip.png");
+ }
+
///
/// Executes a pixel shader and compares the expected results.
///