tests/hlsl: Test for loss of precision on integer negation in d3dbc target profiles.

This commit is contained in:
Francisco Casas
2025-03-13 02:35:01 -03:00
committed by Henri Verbeet
parent bc382c6835
commit a3f80061b1
Notes: Henri Verbeet 2025-03-18 16:03:46 +01:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1427

View File

@@ -137,3 +137,31 @@ float4 main() : sv_target
[test]
draw quad
probe (0, 0) rgba (2.0, 3.0, 1.0, 3.0)
% On SM1, negation constant folding is performed with float arithmetic.
[pixel shader]
float4 main() : sv_target
{
int a = -2147483648;
return int4(a, -a, 0, 0);
}
[test]
draw quad
todo if(sm<4) probe (0, 0) rgba(-2147483648.0, 2147483648.0, 0, 0)
if(sm>=4) probe (0, 0) rgba(-2147483648.0, -2147483648.0, 0, 0)
% Note that the negation here causes loss of precision on SM1.
[pixel shader]
float4 main() : sv_target
{
int a = 16782201; // This rounds down to 16782200 when converted to float.
return float4(a + 1, (-(-a)) + 1, 0, 0);
}
[test]
draw quad
todo if(sm<4) probe (0, 0) rgba(16782202, 16782200, 0, 0)
if(sm>=4) probe (0, 0) rgba(16782202, 16782202, 0, 0)