Created attachment 100932 [details]
Patch to piglit test showing the discard problem.
Commit 17c7ead7 exposed a bug in how uniform loading happens in the presence of discard. It manifested itself in an application as randomly incorrect pixels on the borders of conditional areas.
We've boiled it down to a piglit test case, attached as a patch to existing test. When you run it on HSW with mesa 10.2 or later, notice the white line along the diagonal axis. That shouldn't be there. The white is coming from a texture sample to make it easy to see the problem. It should have been multiplied by the uniform values as the rest of the fragments were. The key bits are in the second fragment shader.
I believe we've root caused it and I'll next attach a fix that I'll send to the mesa-dev list.
Created attachment 100933 [details] [review]
Proposed patch to fix the issue, widening the discard mask.
Added a proposed fix.
Created attachment 100938 [details] [review]
Proposed patch to fix the issue, widening the discard mask, v2
Updated version of patch.
Patches are supposed to be sent to the mailing list for review. Otherwise the people who should see and review them are unlikely to ever know the patches exist.
Here is the email I sent out at the same time.
I thought doing the bug first, followed by mail to the dev list referencing it would be most effective. I guess I should have also added the archive link here.
(In reply to comment #4)
> Here is the email I sent out at the same time.
> I thought doing the bug first, followed by mail to the dev list referencing
> it would be most effective. I guess I should have also added the archive
> link here.
Yes. :) I was just going to point out that the best-practice is to do something like bug #80115 comment #4.
Also... if you're actively working on a bug, please assign it to yourself, and put it in the assigned state.
Regarding the test case attachment #100932 [details], I can't see how that would even run, at all, on Mesa. It tries to use a UBO in a compatibility profile without enabling GL_ARB_uniform_buffer_objects.
I think the right approach is to basically clone tests/spec/arb_uniform_buffer_object/rendering.c (call the new test rendering-discard.c) and modify it to hit the paths you want to hit.
Yeah, the test case is just cobbled together to show the problem, using steps similar to the application that exposed it.
I'll follow up with a full test using your recommendation.
Okay, I resent the patch to mesa-dev with all requested changes incorporated:
And I sent a full test (arb_uniform_buffer_object-rendering-discard) to the piglit dev list:
on Jan 19, 2017 at 21:16:47.
(provided by the Example extension).