Add runtime test for float literal values

このコミットが含まれているのは:
Sergio Pedri committed 2024-06-04 19:11:41 -07:00
1 親 3b6500eac4
コミット 9aa8395e70
3ファイル変更
+32

検索条件に一致するファイルはありません

バイナリファイルは表示されません。

変更後

幅:  |  高さ:  |  サイズ: 123 B

+3
ファイルの表示
@@ -96,6 +96,9 @@
<None Update="Assets\RadialFadeOut.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Green32x32.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\samples\ComputeSharp.SwapChain\Textures\RustyMetal.png" Link="Assets\Textures\RustyMetal.png" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
+29
ファイルの表示
@@ -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);
}
}
}