diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/FractalTiling.cs b/tests/ComputeSharp.D2D1.Tests/Shaders/FractalTiling.cs
new file mode 100644
index 00000000..191a2d7e
--- /dev/null
+++ b/tests/ComputeSharp.D2D1.Tests/Shaders/FractalTiling.cs
@@ -0,0 +1,54 @@
+namespace ComputeSharp.D2D1.Tests.Shaders;
+
+///
+/// A shader creating a fractal tiling animation.
+/// Ported from .
+/// Created by Inigo Quilez.
+/// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
+///
+[D2DInputCount(0)]
+[D2DRequiresScenePosition]
+[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
+[AutoConstructor]
+internal readonly partial struct FractalTiling : ID2D1PixelShader
+{
+ ///
+ /// The current time since the start of the application.
+ ///
+ public readonly float time;
+
+ ///
+ /// The dispatch size for the current output.
+ ///
+ public readonly int2 dispatchSize;
+
+ ///
+ public float4 Execute()
+ {
+ int2 xy = (int2)D2D.GetScenePosition().XY;
+ float2 position = (((float2)(256 * xy)) / this.dispatchSize.X) + this.time;
+ float4 color = 0;
+
+ for (int i = 0; i < 6; i++)
+ {
+ float2 a = Hlsl.Floor(position);
+ float2 b = Hlsl.Frac(position);
+ float4 w = Hlsl.Frac(
+ (Hlsl.Sin((a.X * 7) + (31.0f * a.Y) + (0.01f * this.time)) +
+ new float4(0.035f, 0.01f, 0, 0.7f))
+ * 13.545317f);
+
+ color.XYZ += w.XYZ *
+ 2.0f * Hlsl.SmoothStep(0.45f, 0.55f, w.W) *
+ Hlsl.Sqrt(16.0f * b.X * b.Y * (1.0f - b.X) * (1.0f - b.Y));
+
+ position /= 2.0f;
+ color /= 2.0f;
+ }
+
+ color.XYZ = Hlsl.Pow(color.XYZ, new float3(0.7f, 0.8f, 0.5f));
+ color.W = 1.0f;
+
+ return color;
+ }
+}
\ No newline at end of file
diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/HelloWorld.cs b/tests/ComputeSharp.D2D1.Tests/Shaders/HelloWorld.cs
index 19332a5a..96f0ed79 100644
--- a/tests/ComputeSharp.D2D1.Tests/Shaders/HelloWorld.cs
+++ b/tests/ComputeSharp.D2D1.Tests/Shaders/HelloWorld.cs
@@ -23,7 +23,7 @@ internal readonly partial struct HelloWorld : ID2D1PixelShader
///
public float4 Execute()
{
- Int2 xy = (int2)D2D.GetScenePosition().XY;
+ int2 xy = (int2)D2D.GetScenePosition().XY;
// Normalized screen space UV coordinates from 0.0 to 1.0
float2 uv = xy / (float2)this.dispatchSize;
diff --git a/tests/ComputeSharp.D2D1.Tests/ShadersTests.cs b/tests/ComputeSharp.D2D1.Tests/ShadersTests.cs
index 7a621718..7da9e1c7 100644
--- a/tests/ComputeSharp.D2D1.Tests/ShadersTests.cs
+++ b/tests/ComputeSharp.D2D1.Tests/ShadersTests.cs
@@ -8,6 +8,12 @@ namespace ComputeSharp.D2D1.Tests;
[TestCategory("Shaders")]
public class ShadersTests
{
+ [TestMethod]
+ public void HelloWorld()
+ {
+ RunTest();
+ }
+
[TestMethod]
public void ColorfulInfinity()
{
@@ -15,9 +21,9 @@ public class ShadersTests
}
[TestMethod]
- public void HelloWorld()
+ public void FractalTiling()
{
- RunTest();
+ RunTest();
}
private static void RunTest()
@@ -25,6 +31,6 @@ public class ShadersTests
{
T shader = (T)Activator.CreateInstance(typeof(T), 0f, new int2(1280, 720))!;
- D2D1TestRunner.RunAndCompareShader(in shader, 1280, 720, $"{typeof(T).Name}.png");
+ D2D1TestRunner.RunAndCompareShader(in shader, 1280, 720, $"{typeof(T).Name}.png", $"{typeof(T).Name}.png");
}
}
\ No newline at end of file