diff --git a/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs b/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs
index ab224b80..39e3c3f7 100644
--- a/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs
+++ b/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs
@@ -5,7 +5,6 @@ using System.IO;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-using ComputeSharp.D2D1;
using ComputeSharp.D2D1.Interop;
using ComputeSharp.D2D1.Tests.Extensions;
using ComputeSharp.D2D1.Tests.Helpers;
@@ -15,7 +14,7 @@ using Win32.Graphics.Direct2D;
#pragma warning disable IDE0065
-namespace ComputeSharp.BokehBlur.Processors;
+namespace ComputeSharp.D2D1.Tests.Effects;
using D2D1_BORDER_EDGE_MODE = BorderEdgeMode;
using D2D1_BORDER_PROP = BorderProp;
diff --git a/tests/ComputeSharp.D2D1.Tests/EffectsTests.cs b/tests/ComputeSharp.D2D1.Tests/EffectsTests.cs
index 1719be3d..2063222d 100644
--- a/tests/ComputeSharp.D2D1.Tests/EffectsTests.cs
+++ b/tests/ComputeSharp.D2D1.Tests/EffectsTests.cs
@@ -1,6 +1,5 @@
using System.IO;
using System.Reflection;
-using ComputeSharp.BokehBlur.Processors;
using ComputeSharp.D2D1.Interop;
using ComputeSharp.D2D1.Tests.Effects;
using ComputeSharp.D2D1.Tests.Helpers;
@@ -23,19 +22,19 @@ public class EffectsTests
}
[TestMethod]
- public unsafe void Invert()
+ public void Invert()
{
D2D1TestRunner.RunAndCompareShader(new InvertEffect(), null, "Landscape.png", "Landscape_Inverted.png");
}
[TestMethod]
- public unsafe void InvertWithThreshold()
+ public void InvertWithThreshold()
{
D2D1TestRunner.RunAndCompareShader(new InvertWithThresholdEffect(1), null, "Landscape.png", "Landscape_Inverted.png");
}
[TestMethod]
- public unsafe void Pixelate()
+ public void Pixelate()
{
D2D1TestRunner.RunAndCompareShader(
new PixelateEffect(new PixelateEffect.Constants(1280, 840, 16)),
@@ -45,13 +44,13 @@ public class EffectsTests
}
[TestMethod]
- public unsafe void ZonePlate()
+ public void ZonePlate()
{
D2D1TestRunner.RunAndCompareShader(new ZonePlateEffect(1280, 720, 800), 1280, 720, "ZonePlate.png");
}
[TestMethod]
- public unsafe void CheckerboardClip()
+ public void CheckerboardClip()
{
D2D1TestRunner.RunAndCompareShader(new CheckerboardClipEffect(1280, 840, 32), null, "Landscape.png", "Landscape_CheckerboardClip.png");
}
diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/ColorfulInfinity.cs b/tests/ComputeSharp.D2D1.Tests/Shaders/ColorfulInfinity.cs
new file mode 100644
index 00000000..06a496f0
--- /dev/null
+++ b/tests/ComputeSharp.D2D1.Tests/Shaders/ColorfulInfinity.cs
@@ -0,0 +1,77 @@
+namespace ComputeSharp.D2D1.Tests.Shaders;
+
+///
+/// A shader creating an abstract and colorful animation.
+/// Ported from .
+/// Created by Benoit Marini.
+/// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
+///
+[D2DInputCount(0)]
+[D2DRequiresScenePosition]
+[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
+[AutoConstructor]
+internal readonly partial struct ColorfulInfinity : 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;
+
+ ///
+ /// The total number of layers for the final animation.
+ ///
+ private const float NumberOfLayers = 16.0f;
+
+ ///
+ /// The number of iterations to calculate a texel value.
+ ///
+ private const int NumberOfIterations = 23;
+
+ ///
+ /// Makes some magic happen.
+ ///
+ private float4 Tex(float3 p)
+ {
+ float t = this.time + 78.0f;
+ float4 o = new(p.X, p.Y, p.Z, 3.0f * Hlsl.Sin(t * 0.1f));
+ float4 dec =
+ new float4(1.0f, 0.9f, 0.1f, 0.15f) +
+ new float4(0.06f * Hlsl.Cos(t * 0.1f), 0, 0, 0.14f * Hlsl.Cos(t * 0.23f));
+
+ for (int i = 0; i++ < NumberOfIterations;)
+ {
+ o.XZYW = Hlsl.Abs((o / Hlsl.Dot(o, o)) - dec);
+ }
+
+ return o;
+ }
+
+ ///
+ public float4 Execute()
+ {
+ int2 xy = (int2)D2D.GetScenePosition().XY;
+ float2 uv = (xy - ((float2)this.dispatchSize * 0.5f)) / this.dispatchSize.Y;
+ float3 col = 0;
+ float t = this.time * 0.3f;
+
+ for (float i = 0.0f; i <= 1.0f; i += 1.0f / NumberOfLayers)
+ {
+ float d = Hlsl.Frac(i + t);
+ float s = Hlsl.Lerp(5.0f, 0.5f, d);
+ float f = d * Hlsl.SmoothStep(1.0f, 0.9f, d);
+
+ col += Tex(new float3(uv.X * s, uv.Y * s, i * 4.0f)).XYZ * f;
+ }
+
+ col /= NumberOfLayers;
+ col *= new float3(2, 1.0f, 2.0f);
+ col = Hlsl.Pow(col, 0.5f);
+
+ return new(col.X, col.Y, col.Z, 1.0f);
+ }
+}
\ No newline at end of file
diff --git a/tests/ComputeSharp.D2D1.Tests/ShadersTests.cs b/tests/ComputeSharp.D2D1.Tests/ShadersTests.cs
index eacde97b..e2c909f1 100644
--- a/tests/ComputeSharp.D2D1.Tests/ShadersTests.cs
+++ b/tests/ComputeSharp.D2D1.Tests/ShadersTests.cs
@@ -1,3 +1,5 @@
+using System;
+using ComputeSharp.D2D1.Tests.Helpers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ComputeSharp.D2D1.Tests;
@@ -6,4 +8,17 @@ namespace ComputeSharp.D2D1.Tests;
[TestCategory("Shaders")]
public class ShadersTests
{
+ [TestMethod]
+ public void ColorfulInfinity()
+ {
+ RunTest();
+ }
+
+ private static void RunTest()
+ where T : unmanaged, ID2D1PixelShader
+ {
+ T shader = (T)Activator.CreateInstance(typeof(T), 0f, new int2(1280, 720))!;
+
+ D2D1TestRunner.RunAndCompareShader(in shader, 1280, 720, $"{typeof(T).Name}.png");
+ }
}
\ No newline at end of file