tests: Add yet more overload resolution tests.

This commit is contained in:
Henri Verbeet 2024-12-10 20:53:43 +01:00
parent 5827197246
commit cdf6100fe5
Notes: Henri Verbeet 2024-12-16 17:26:51 +01:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1313

View File

@ -153,6 +153,16 @@ float4 main() : sv_target
return func(float4(0.0, 0.0, 0.0, 0.0)); return func(float4(0.0, 0.0, 0.0, 0.0));
} }
% That applies to widening as well.
[pixel shader fail]
float f(float3 x) { return 1.0; }
float f(float4 x) { return 2.0; }
float4 main() : sv_target
{
return f(float(0.0));
}
% Even if one axis has less narrowing. % Even if one axis has less narrowing.
[pixel shader fail] [pixel shader fail]
@ -173,6 +183,34 @@ float4 main() : sv_target
return func(mtx); return func(mtx);
} }
% An exact match is preferred over widening.
[pixel shader todo]
float f(float x) { return 1.0; }
float f(float2 x) { return 2.0; }
float4 main() : sv_target
{
return f(float(0.0));
}
[test]
todo(sm<6) draw quad
probe (0, 0) rgba(1.0, 1.0, 1.0, 1.0)
% Component type narrowing is preferred over component count narrowing.
[pixel shader todo]
float f(half4 x) { return 1.0; }
float f(float2 x) { return 2.0; }
float4 main() : sv_target
{
return f(float4(0.0, 0.0, 0.0, 0.0));
}
[test]
todo(sm<6) draw quad
probe (0, 0) rgba(1.0, 1.0, 1.0, 1.0)
% Let C be the common type that would be produced in an arithmetic expression % Let C be the common type that would be produced in an arithmetic expression
% between the parameter and argument types. If C is the same as the parameter, the % between the parameter and argument types. If C is the same as the parameter, the
% overload is preferred to the case where C is the same base type as the argument but % overload is preferred to the case where C is the same base type as the argument but
@ -208,10 +246,40 @@ todo(sm<6) probe (0, 0) rgba(0.0, 0.0, 0.0, 0.0)
% the first function (same as the argument) and "float" for the second function % the first function (same as the argument) and "float" for the second function
% (same as the parameter), so the first function is preferred. % (same as the parameter), so the first function is preferred.
% This is ambiguous; "bool" is no closer to "int" than it is to "float".
[pixel shader fail]
float f(int x) { return 1.0; }
float f(float x) { return 2.0; }
float4 main() : sv_target
{
return f(true);
}
[require] [require]
% No minimum precision types prior to SM4. % No minimum precision types prior to SM4.
shader model >= 4.0 shader model >= 4.0
% The amount of component type narrowing doesn't matter.
[pixel shader fail]
float f(min16float x) { return 1.0; }
float f(min10float x) { return 2.0; }
float4 main() : sv_target
{
return f(float(0.0));
}
% Even for half to min16float conversion.
[pixel shader fail]
float f(min16float x) { return 1.0; }
float f(min10float x) { return 2.0; }
float4 main() : sv_target
{
return f(half(0.0));
}
[pixel shader todo(sm<6)] [pixel shader todo(sm<6)]
float4 func(min16int x) float4 func(min16int x)
@ -283,6 +351,20 @@ float4 main() : sv_target
todo(sm<6) draw quad todo(sm<6) draw quad
todo(sm<6) probe (0, 0) rgba(2.0, 2.0, 2.0, 2.0) todo(sm<6) probe (0, 0) rgba(2.0, 2.0, 2.0, 2.0)
% An exact match is preferred for minimum precision types as well.
[pixel shader todo]
float f(min16int x) { return 1.0; }
float f(int x) { return 2.0; }
float4 main() : sv_target
{
return f(min16int(0));
}
[test]
todo(sm<6) draw quad
probe (0, 0) rgba(1.0, 1.0, 1.0, 1.0)
[require] [require]
% Need SM5 for doubles. % Need SM5 for doubles.
shader model >= 5.0 shader model >= 5.0
@ -315,6 +397,47 @@ float4 main() : sv_target
todo(sm<6) draw quad todo(sm<6) draw quad
todo(sm<6) probe (0, 0) rgba(2.0, 2.0, 2.0, 2.0) todo(sm<6) probe (0, 0) rgba(2.0, 2.0, 2.0, 2.0)
% Component type widening is preferred over component type narrowing.
[pixel shader todo]
float f(half x) { return 1.0; }
float f(double x) { return 2.0; }
float4 main() : sv_target
{
return f(float(0.0));
}
[test]
todo(sm<6) draw quad
probe (0, 0) rgba(2.0, 2.0, 2.0, 2.0)
% Component count widening is preferred over component type narrowing.
[pixel shader todo]
float f(half x) { return 1.0; }
float f(double2 x) { return 2.0; }
float4 main() : sv_target
{
return f(float(0.0));
}
[test]
todo(sm<6) draw quad
probe (0, 0) rgba(2.0, 2.0, 2.0, 2.0)
% Component count widening is preferred over component type class conversion.
[pixel shader todo]
float f(int x) { return 1.0; }
float f(double2 x) { return 2.0; }
float4 main() : sv_target
{
return f(float(0.0));
}
[test]
todo(sm<6) draw quad
probe (0, 0) rgba(2.0, 2.0, 2.0, 2.0)
% Let C be the common type that would be produced in an arithmetic expression % Let C be the common type that would be produced in an arithmetic expression
% between the parameter and argument types. If C has the same base type as the argument, % between the parameter and argument types. If C has the same base type as the argument,
% but with more components, it is preferred over all other cases. % but with more components, it is preferred over all other cases.