vkd3d/tests/hlsl/function-overload.shader_test
2023-11-09 21:15:08 +01:00

96 lines
1.3 KiB
Plaintext

[pixel shader fail]
/* The same function signature cannot be defined twice. */
float func(int arg)
{
return 0.1;
}
float func(int arg)
{
return 0.1;
}
float4 main() : sv_target
{
return 0;
}
[pixel shader todo]
/* Test a basic overload. */
float func(int arg)
{
return 0.1;
}
float func(uint arg)
{
return 0.2;
}
float4 main() : sv_target
{
int i = 1;
uint u = 1;
return float4(func(i), func(u), func(int2(1, 1)), func(uint2(1, 1)));
}
[test]
todo(sm<6) draw quad
probe all rgba (0.1, 0.2, 0.1, 0.2)
% float and float1 can be defined separately...
[pixel shader todo]
void func(float arg) {}
void func(float1 arg) {}
float4 main() : sv_target
{
return 1.0;
}
% ...but invoking them is considered ambiguous and fails.
[pixel shader fail]
void func(float arg) {}
void func(float1 arg) {}
float4 main() : sv_target
{
float x = 1.0;
func(x);
return 1.0;
}
[pixel shader fail]
void func(float arg) {}
void func(float1 arg) {}
float4 main() : sv_target
{
float1 x = {1.0};
func(x);
return 1.0;
}
% This holds true even if one variant isn't actually defined.
[pixel shader fail todo]
void func(float arg);
void func(float1 arg) {}
float4 main() : sv_target
{
float1 x = {1.0};
func(x);
return 1.0;
}