From: Zebediah Figura zfigura@codeweavers.com
--- Makefile.am | 1 + tests/entry-point-overload.shader_test | 114 +++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 tests/entry-point-overload.shader_test
diff --git a/Makefile.am b/Makefile.am index e12259ce..71545a94 100644 --- a/Makefile.am +++ b/Makefile.am @@ -59,6 +59,7 @@ vkd3d_shader_tests = \ tests/cbuffer.shader_test \ tests/compute.shader_test \ tests/conditional.shader_test \ + tests/entry-point-overload.shader_test \ tests/floor.shader_test \ tests/function-return.shader_test \ tests/hlsl-array-dimension.shader_test \ diff --git a/tests/entry-point-overload.shader_test b/tests/entry-point-overload.shader_test new file mode 100644 index 00000000..9de4dd87 --- /dev/null +++ b/tests/entry-point-overload.shader_test @@ -0,0 +1,114 @@ +% The last function to be declared is the one that's used. + +[vertex shader] +void main(out float tex : texcoord, inout float4 pos : sv_position) +{ + tex = 0.2; +} + +[pixel shader] + +float4 main() : sv_target +{ + return 0.1; +} + +float4 main(float tex : texcoord) : sv_target +{ + return tex; +} + +[test] +draw quad +todo probe (0, 0) rgba (0.2, 0.2, 0.2, 0.2) + +[pixel shader] + +float4 main(float tex : texcoord) : sv_target +{ + return tex; +} + +float4 main() : sv_target +{ + return 0.1; +} + +[test] +draw quad +probe (0, 0) rgba (0.1, 0.1, 0.1, 0.1) + +% Subsequent declarations don't matter. + +[pixel shader] + +float4 main(float tex : texcoord) : sv_target +{ + return tex; +} + +float4 main() : sv_target +{ + return 0.1; +} + +float4 main(float tex : texcoord) : sv_target; + +[test] +draw quad +probe (0, 0) rgba (0.1, 0.1, 0.1, 0.1) + +% Rather, it's the last function to be declared, whether it's defined at the time or not. + +[pixel shader] + +float4 main() : sv_target; + +float4 main(float tex : texcoord) : sv_target +{ + return tex; +} + +float4 main() : sv_target +{ + return 0.1; +} + +[test] +draw quad +todo probe (0, 0) rgba (0.2, 0.2, 0.2, 0.2) + +[pixel shader] + +float4 main(); +float4 main(float tex : texcoord); + +float4 main(float tex : texcoord) : sv_target +{ + return tex; +} + +float4 main() : sv_target +{ + return 0.1; +} + +[test] +draw quad +todo probe (0, 0) rgba (0.2, 0.2, 0.2, 0.2) + +% Functions that are never defined are ignored. + +[pixel shader] + +float4 main(); +float4 main(float tex : texcoord) : sv_target; + +float4 main() : sv_target +{ + return 0.1; +} + +[test] +draw quad +probe (0, 0) rgba (0.1, 0.1, 0.1, 0.1)