diff --git a/tests/ComputeSharp.D2D1.Tests/Assets/Green32x32.png b/tests/ComputeSharp.D2D1.Tests/Assets/Green32x32.png
new file mode 100644
index 00000000..7cacfc9d
Binary files /dev/null and b/tests/ComputeSharp.D2D1.Tests/Assets/Green32x32.png differ
diff --git a/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj b/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj
index 6b7b3491..a42cbe0a 100644
--- a/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj
+++ b/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj
@@ -96,6 +96,9 @@
PreserveNewest
+
+ PreserveNewest
+
diff --git a/tests/ComputeSharp.D2D1.Tests/ShaderRewriterTests.cs b/tests/ComputeSharp.D2D1.Tests/ShaderRewriterTests.cs
index 36a6220f..b1fab05a 100644
--- a/tests/ComputeSharp.D2D1.Tests/ShaderRewriterTests.cs
+++ b/tests/ComputeSharp.D2D1.Tests/ShaderRewriterTests.cs
@@ -1,4 +1,5 @@
using ComputeSharp.D2D1.Interop;
+using ComputeSharp.D2D1.Tests.Helpers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
#pragma warning disable CA1822
@@ -179,4 +180,32 @@ public partial class ShaderRewriterTests
mask2x3_r_or.M11 ? 1 : 0);
}
}
+
+ // See https://github.com/Sergio0694/ComputeSharp/issues/780
+ [TestMethod]
+ public void ProblematicFloatLiteralValue_IsRewrittenCorrectly()
+ {
+ D2D1TestRunner.RunAndCompareShader(
+ new ProblematicFloatLiteralValueShader(131072.65f),
+ 32,
+ 32,
+ "Green32x32.png");
+ }
+
+ [D2DInputCount(0)]
+ [D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
+ [D2DOutputBuffer(D2D1BufferPrecision.Float32)]
+ [D2DGeneratedPixelShaderDescriptor]
+ internal readonly partial struct ProblematicFloatLiteralValueShader(float x) : ID2D1PixelShader
+ {
+ public float4 Execute()
+ {
+ if (x != 131072.65f)
+ {
+ return 0;
+ }
+
+ return new float4(0.0f, 1.0f, 0.0f, 1.0f);
+ }
+ }
}
\ No newline at end of file