vkd3d-shader/hlsl: Implement tests for the rcp() intrinsic.

This commit is contained in:
Petrichor Park 2024-04-29 12:45:52 -05:00 committed by Henri Verbeet
parent c792114a6a
commit 3a49852075
Notes: Henri Verbeet 2024-07-11 17:16:15 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/822
2 changed files with 77 additions and 0 deletions

View File

@ -176,6 +176,7 @@ vkd3d_shader_tests = \
tests/hlsl/pow.shader_test \
tests/hlsl/precise-modifier.shader_test \
tests/hlsl/rasteriser-ordered-views.shader_test \
tests/hlsl/rcp.shader_test \
tests/hlsl/reflect.shader_test \
tests/hlsl/refract.shader_test \
tests/hlsl/register-reservations-numeric.shader_test \

View File

@ -0,0 +1,76 @@
[pixel shader todo]
uniform float4 f;
float4 main() : sv_target
{
return rcp(f);
}
[test]
uniform 0 float4 1.0 2.0 3.0 4.0
todo(sm<6) draw quad
probe (0, 0) rgba (1.0, 0.5, 0.3333333, 0.25) 8
uniform 0 float4 -1.0 -2.0 -3.0 -4.0
todo(sm<6) draw quad
probe (0, 0) rgba (-1.0, -0.5, -0.3333333, -0.25) 8
uniform 0 float4 12.34 56.78 -90.12 -34.56
todo(sm<6) draw quad
probe (0, 0) rgba (0.081037275, 0.017611835, -0.011096316, -0.028935184) 8
uniform 0 float4 0.25 0.125 0.0625 0.3333333
todo(sm<6) draw quad
probe (0, 0) rgba (4.0, 8.0, 16.0, 3.0) 8
% Degenerate cases
uniform 0 float4 0.0 -0.0 1.0e39 -1.0e39
todo(sm<6) draw quad
probe (0, 0) rgba (1.0e39, -1.0e39, 0.0, -0.0) 8
[pixel shader todo]
% Check invertibility
uniform float4 f;
float4 main() : sv_target
{
return rcp(rcp(f));
}
[test]
uniform 0 float4 1.0 2.0 3.0 4.0
todo(sm<6) draw quad
probe (0, 0) rgba (1.0, 2.0, 3.0, 4.0) 8
uniform 0 float4 7.604 3.1415 2.72 9.876
todo(sm<6) draw quad
probe (0, 0) rgba (7.604, 3.1415, 2.72, 9.876) 8
uniform 0 float4 0.0 -0.0 1.0e39 -1.0e39
todo(sm<6) draw quad
probe (0, 0) rgba (0.0, -0.0, 1.0e39, -1.0e39)
[pixel shader todo]
% Make sure swizzling works
uniform float4 f;
float4 main() : sv_target
{
float a = rcp(f.x);
float2 b = rcp(f.zy);
float3 c = rcp(f.wxz);
float4 d = rcp(f.zyxw);
return float4(a, b.y, c.z, d.w);
}
[test]
uniform 0 float4 1.0 2.0 3.0 4.0
todo(sm<6) draw quad
probe (0, 0) rgba (1.0, 0.5, 0.3333333, 0.25) 8
uniform 0 float4 -1.0 -2.0 -3.0 -4.0
todo(sm<6) draw quad
probe (0, 0) rgba (-1.0, -0.5, -0.3333333, -0.25) 8