From: Francisco Casas fcasas@codeweavers.com
Besides testing both types of derivates, this test is to ensure that for the pixels in coordinates where both X and Y are even, the fine and coarse derivates are equal.
While this is not enforced by the language specification, testing shows it is the case for the WARP driver, and seems to be the case for different GPUs in practice.
If this holds true for all relevant GPUs, it is useful because it allows us to normalize the ddx() and ddy() tests, regardless of whether these functions are implemented as fine or coarse derivates. --- tests/ddxddy.shader_test | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/tests/ddxddy.shader_test b/tests/ddxddy.shader_test index 6efb5ab6..3c840f57 100644 --- a/tests/ddxddy.shader_test +++ b/tests/ddxddy.shader_test @@ -24,3 +24,25 @@ 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 + + +[require] +shader model >= 5.0 + + +[pixel shader todo] +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, 10.0 + ddx_fine(nonlinear) - ddx_coarse(nonlinear), + 10.0 + ddy_fine(nonlinear) - ddy_coarse(nonlinear), 0.0); +} + +[test] +todo draw quad +probe (10, 10) rgba (-0.524999976, 10.0, 10.0, 0.0) +probe (11, 10) rgba (-0.689999819, 10.0, 10.0100002, 0.0) +probe (10, 11) rgba (-0.420000076, 10.0100002, 10.0, 0.0) +probe (11, 11) rgba (-0.574999928, 10.0100002, 10.0100002, 0.0) +probe (12, 12) rgba (-0.625000000, 10.0, 10.0, 0.0)