Bug 95130 - Derivatives of gl_Color wrong when helper pixels used
Summary: Derivatives of gl_Color wrong when helper pixels used
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/radeonsi (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Default DRI bug account
QA Contact: Default DRI bug account
Depends on:
Reported: 2016-04-25 11:26 UTC by James Legg
Modified: 2016-06-07 23:26 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

Test program (3.46 KB, text/plain)
2016-04-25 11:26 UTC, James Legg
Apitrace trace of test program (51.74 KB, application/octet-stream)
2016-04-25 11:27 UTC, James Legg
Appearance when test is failing (1.91 KB, image/png)
2016-04-25 11:28 UTC, James Legg

Description James Legg 2016-04-25 11:26:46 UTC
Created attachment 123239 [details]
Test program

Along the edges of triangles and around where fragments are rejected due to depth testing, the GLSL functions dFdx, dFdy, and fwidth return incorrect values when the argument is dependant on gl_Color or gl_SecondaryColor.

I've attached a program reproducing the issue. It takes derivatives of a constant, which should be 0. It is expected to produce a black window. However, the edges of the triangle it draws are visible because of this bug.

The error does not occur when environment variable LIBGL_ALWAYS_SOFTWARE is set to 1.

I'm using Mesa git 0831eb9 with an AMD R9 270 on x86_64 Fedora 22.
Comment 1 James Legg 2016-04-25 11:27:27 UTC
Created attachment 123240 [details]
Apitrace trace of test program
Comment 2 James Legg 2016-04-25 11:28:39 UTC
Created attachment 123241 [details]
Appearance when test is failing
Comment 3 Nicolai Hähnle 2016-04-25 17:26:20 UTC
Hi James, thank you for the detailed report. I can reproduce this and am going to investigate.
Comment 4 Nicolai Hähnle 2016-04-25 17:34:59 UTC
As a temporary workaround, the error should disappear when you run with the environment variable setting R600_DEBUG=mono.

The cause is that with non-monolithic shaders, input interpolation happens in the prolog. However, when we compile the prolog we do not see the derivative computations and therefore fail to turn the helper pixels on.
Comment 5 Nicolai Hähnle 2016-06-07 23:26:15 UTC
This is now fixed in Mesa Git b42bc90b6add0d0f81d915d49712761d32329afa with LLVM r272063.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.