mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
tests/hlsl: Add some tests for the frexp() intrinsic.
This commit is contained in:
committed by
Henri Verbeet
parent
0b8abe754a
commit
ea6104cf5e
Notes:
Henri Verbeet
2025-08-21 16:34:21 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1000
@@ -140,6 +140,7 @@ vkd3d_shader_tests = \
|
|||||||
tests/hlsl/fog.shader_test \
|
tests/hlsl/fog.shader_test \
|
||||||
tests/hlsl/for.shader_test \
|
tests/hlsl/for.shader_test \
|
||||||
tests/hlsl/frac.shader_test \
|
tests/hlsl/frac.shader_test \
|
||||||
|
tests/hlsl/frexp.shader_test \
|
||||||
tests/hlsl/function-cast.shader_test \
|
tests/hlsl/function-cast.shader_test \
|
||||||
tests/hlsl/function-overload.shader_test \
|
tests/hlsl/function-overload.shader_test \
|
||||||
tests/hlsl/function-return.shader_test \
|
tests/hlsl/function-return.shader_test \
|
||||||
|
116
tests/hlsl/frexp.shader_test
Normal file
116
tests/hlsl/frexp.shader_test
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
[pixel shader todo(sm<6)]
|
||||||
|
uniform float4 f;
|
||||||
|
|
||||||
|
float4 main() : sv_target
|
||||||
|
{
|
||||||
|
float exp;
|
||||||
|
float mantissa = frexp(f.x, exp);
|
||||||
|
return float4(exp, mantissa, 0.0, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
uniform 0 float4 3.1415927 0.0 0.0 0.0
|
||||||
|
todo(sm<6 | msl) draw quad
|
||||||
|
probe (0, 0) f32(2.0, 0.785398185, 0.0, 0.0)
|
||||||
|
|
||||||
|
uniform 0 float4 -3.1415927 0.0 0.0 0.0
|
||||||
|
todo(sm<6 | msl) draw quad
|
||||||
|
if(sm<4) probe (0, 0) f32(2.0, -0.785398185, 0.0, 0.0)
|
||||||
|
% Starting with shader model 4, negative inputs give positive mantissa.
|
||||||
|
if(sm>=4) probe (0, 0) f32(2.0, 0.785398185, 0.0, 0.0)
|
||||||
|
|
||||||
|
uniform 0 float4 7604.123 0.0 0.0 0.0
|
||||||
|
todo(sm<6 | msl) draw quad
|
||||||
|
probe (0, 0) f32(13.0, 0.92823765, 0.0, 0.0)
|
||||||
|
|
||||||
|
uniform 0 float4 0.00001234 0.0 0.0 0.0
|
||||||
|
todo(sm<6 | msl) draw quad
|
||||||
|
probe (0, 0) f32(-16.0, 0.8087142, 0.0, 0.0)
|
||||||
|
|
||||||
|
uniform 0 float4 0.0 0.0 0.0 0.0
|
||||||
|
todo(sm<6 | msl) draw quad
|
||||||
|
probe (0, 0) f32(0.0, 0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
uniform 0 float4 -0.0 0.0 0.0 0.0
|
||||||
|
todo(sm<6 | msl) draw quad
|
||||||
|
probe (0, 0) f32(0.0, 0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
uniform 0 float4 INF 0.0 0.0 0.0
|
||||||
|
todo(sm<6 | msl) draw quad
|
||||||
|
if(sm<4) probe (0, 0) f32(-NAN, -NAN, 0, 0)
|
||||||
|
if(sm>=4) probe (0, 0) f32(129, 0.5, 0, 0)
|
||||||
|
|
||||||
|
uniform 0 float4 -INF 0.0 0.0 0.0
|
||||||
|
todo(sm<6 | msl) draw quad
|
||||||
|
if(sm<4) probe (0, 0) f32(-NAN, -NAN, 0, 0)
|
||||||
|
if(sm>=4) probe (0, 0) f32(129, 0.5, 0, 0)
|
||||||
|
|
||||||
|
uniform 0 float4 NAN 0 0 0
|
||||||
|
todo(sm<6 | msl) draw quad
|
||||||
|
if(sm<4) probe (0, 0) f32(NAN, NAN, 0, 0)
|
||||||
|
if(sm>=4) probe (0, 0) f32(129, 0.75, 0, 0)
|
||||||
|
|
||||||
|
% Subnormals.
|
||||||
|
uniform 0 uint4 0x0007ffff 0 0 0
|
||||||
|
todo(sm<6 | msl) draw quad
|
||||||
|
probe (0, 0) f32(0, 0, 0, 0)
|
||||||
|
|
||||||
|
[pixel shader todo(sm<6)]
|
||||||
|
float4 main() : sv_target
|
||||||
|
{
|
||||||
|
int arg = 7604;
|
||||||
|
int exp;
|
||||||
|
/* Integers are promoted to floats. */
|
||||||
|
int mantissa = frexp(arg, exp);
|
||||||
|
return float4(exp, mantissa, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
todo(sm<6) draw quad
|
||||||
|
probe (0, 0) f32(13.0, 0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
[pixel shader todo(sm<6)]
|
||||||
|
float4 main() : sv_target
|
||||||
|
{
|
||||||
|
bool arg = true;
|
||||||
|
bool exp;
|
||||||
|
/* Bools are promoted to floats. */
|
||||||
|
bool mantissa = frexp(arg, exp);
|
||||||
|
return float4(exp, mantissa, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
todo(sm<6) draw quad
|
||||||
|
if(sm<4) probe (0, 0) f32(0.0, 1.0, 0.0, 0.0)
|
||||||
|
if(sm>=4) probe (0, 0) f32(1.0, 1.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
[pixel shader todo(sm<6)]
|
||||||
|
float4 main() : sv_target
|
||||||
|
{
|
||||||
|
half arg = 3.141;
|
||||||
|
half exp;
|
||||||
|
/* Halfs are promoted to floats. */
|
||||||
|
half mantissa = frexp(arg, exp);
|
||||||
|
return float4(exp, mantissa, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
todo(sm<6) draw quad
|
||||||
|
probe (0, 0) f32(2.0, 0.785250008, 0.0, 0.0)
|
||||||
|
|
||||||
|
[require]
|
||||||
|
shader model >= 5.0
|
||||||
|
float64
|
||||||
|
|
||||||
|
[pixel shader todo]
|
||||||
|
float4 main() : sv_target
|
||||||
|
{
|
||||||
|
double arg = 3.14156265358979323;
|
||||||
|
double exp;
|
||||||
|
double mantissa = frexp(arg, exp);
|
||||||
|
return float4(exp, mantissa, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
todo(sm<6) draw quad
|
||||||
|
probe (0, 0) f32(2.0, 0.785390675, 0.0, 0.0)
|
Reference in New Issue
Block a user