List of affected tests:
The tests check derivative of a float, a vec2, a vec3 and a vec4 respectively. For this they render a quad using two triangles and for each vertex they pass a coord parameter (a float, vec2, vec3 or vec4 parameter depending on the test) that they use to compute the derivative. For the second component of this coord parameter there seems to be a precision error after computing its derivative (that is why the float tests work fine, because they only use the first and only component but it fails for all the other cases, since all vec types have at least two components).
In these cases that fail, the argument of the derivative is constant in X, so the result is expected to be 0, however, the actual result is slightly different from 0 for a number of pixels. More specifically, of the two triangles rendered, one of them is perfect (the derivative is perfect 0 for all pixels) while the other packs some level of noise in almost all of its pixels (the highest level of noise is in the order of 10^-6, so it is not too big, but big enough for deqp to complain). A few things worth mentioning:
- The problem also exists for dfdy, but for some reason the deqp tests for dfdy do not catch this.
- The fact that this only happens for one of the two triangles is very weird. Altering the order in which the triangles are rendered does not change the result.
- The implementation of dfdx and dfdy seem straight forward enough (it is basically a subtraction of two values), that it is hard to imagine that the cause of this may live in the driver code but I can probably be missing something.
I checked that the source of the problem are not the color values computed for the gradient: if I paint the gradient, and then read the pixels, I see the exact same color for all the pixels in the same row/col (depending on the direction of the gradient), even across the two triangles in the quad, so the source data for the dfdx/dfdy operations seems to come without precision errors. That means that the error is produced by the dfdx operation itself.
Created attachment 114426 [details]
Sample program reproducing the problem
This renders a quad with two triangles. The fragment shader will compute a derivative like the dEQP tests and use the result as the output color (so it should be all black if no precision errors are present). If there is a precision error > 1.0e-8 for a fragment it will render that fragment in green.
The output shows how one of the two triangles is rendered in black and the other one has plenty of fragments in green.
The test program uses libglm.
Created attachment 114427 [details]
Output of the attached program showcasing the problem