Module: vkd3d Branch: master Commit: d3876e49bc8df422c0446e5fa3174b510f79364b URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/d3876e49bc8df422c0446e5fa3174b...
Author: Ethan Lee flibitijibibo@gmail.com Date: Wed Apr 26 10:29:14 2023 -0400
tests: Add tests for ddx(), ddy() intrinsics.
Thanks to Giovanni for the second set of tests! Note that the tolerance for the final pixel was set much higher than the others; this test seems to be an issue for some devices (in my case, a 7900 XTX running RADV).
Co-authored-by: Giovanni Mascellani gmascellani@codeweavers.com Signed-off-by: Ethan Lee flibitijibibo@gmail.com
---
Makefile.am | 1 + tests/ddxddy.shader_test | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+)
diff --git a/Makefile.am b/Makefile.am index 3f1ec171..8e94658d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -63,6 +63,7 @@ vkd3d_shader_tests = \ tests/cbuffer.shader_test \ tests/compute.shader_test \ tests/conditional.shader_test \ + tests/ddxddy.shader_test \ tests/distance.shader_test \ tests/entry-point-semantics.shader_test \ tests/exp.shader_test \ diff --git a/tests/ddxddy.shader_test b/tests/ddxddy.shader_test new file mode 100644 index 00000000..6efb5ab6 --- /dev/null +++ b/tests/ddxddy.shader_test @@ -0,0 +1,26 @@ +[pixel shader] +float4 main(float4 pos : sv_position) : sv_target +{ + return float4(ddx(pos.x), ddy(pos.y), 0, 0); +} + +[test] +draw quad +probe all rgba (1.0, 1.0, 0.0, 0.0) + +[pixel shader] +float4 main(float4 pos : sv_position) : sv_target +{ + pos /= 10.0; + float nonlinear = pos.x * pos.y - pos.x * (pos.x + 0.5); + return float4(nonlinear, ddx(nonlinear), ddy(nonlinear), 0.0); +} + +[test] +draw quad +probe (10, 10) rgba (-0.524999976, -0.164999843, 0.104999900, 0.0) 8 +probe (11, 10) rgba (-0.689999819, -0.164999843, 0.104999900, 0.0) 8 +probe (10, 11) rgba (-0.420000076, -0.164999843, 0.104999900, 0.0) 8 +probe (11, 11) rgba (-0.574999928, -0.164999843, 0.104999900, 0.0) 8 +probe (12, 10) rgba (-0.874999881, -0.205000162, 0.124999881, 0.0) 8 +probe (150, 150) rgba (-7.52500916, -1.56500244, 1.50500488, 0.0) 40