vkd3d/tests/hlsl/rcp.shader_test
Petrichor Park b3f0cd5788 vkd3d-shader/hlsl: Implement the rcp() intrinisic.
SM1 already has the RCP opcode implemented; SM4 implementation is in the
next commit.
2024-07-11 16:44:02 +02:00

77 lines
1.7 KiB
Plaintext

[pixel shader todo(sm>=4)]
uniform float4 f;
float4 main() : sv_target
{
return rcp(f);
}
[test]
uniform 0 float4 1.0 2.0 3.0 4.0
todo(sm>=4 & 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>=4 & 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>=4 & 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>=4 & 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>=4 & sm<6) draw quad
probe (0, 0) rgba (1.0e39, -1.0e39, 0.0, -0.0) 8
[pixel shader todo(sm>=4)]
% 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>=4 & 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>=4 & 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>=4 & sm<6) draw quad
probe (0, 0) rgba (0.0, -0.0, 1.0e39, -1.0e39)
[pixel shader todo(sm>=4)]
% 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>=4 & 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>=4 & sm<6) draw quad
probe (0, 0) rgba (-1.0, -0.5, -0.3333333, -0.25) 8