Bug 97207 - [IVY BRIDGE] Fragment shader discard writing to depth
Summary: [IVY BRIDGE] Fragment shader discard writing to depth
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/intel (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
Depends on:
Reported: 2016-08-04 18:08 UTC by SaschaWillems
Modified: 2016-08-05 22:26 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Discard with depth not being discarded on Sky Lake (342.66 KB, image/jpeg)
2016-08-04 18:08 UTC, SaschaWillems
Discard with depth being discarded on GTX980 (489.91 KB, image/jpeg)
2016-08-04 18:09 UTC, SaschaWillems

Description SaschaWillems 2016-08-04 18:08:12 UTC
Created attachment 125542 [details]
Discard with depth not being discarded on Sky Lake

In the indirect draw example of my Vulkan examples I use discard in the fragment shader for discarding transparent fragments.

As per spec, discarding fragments should also discard depth, but this doesn't seem to work on Ivy Bridge with current MESA drivers, color is discarded, but depth is written, even though the fragment shader does not specify early_fragment_tests.

I have attached a screenshot from Ubuntu with Ivy Brdige showing the clear color of the scene where the fragments are discarded and one from a GTX 980 rendering as expected.
Comment 1 SaschaWillems 2016-08-04 18:09:04 UTC
Created attachment 125543 [details]
Discard with depth being discarded on GTX980
Comment 2 Jason Ekstrand 2016-08-04 21:58:39 UTC
I just ran on my Sky Lake and it seems to work fine.  Unfortunately, gen7 isn't terribly smart about when it applies the depth test.  It's not hard to fix, we just need to go patch it up.
Comment 3 Nanley Chery 2016-08-04 22:43:54 UTC
I just found the missing piece of state setup to fix this. I'll send out patch out soon.
Comment 4 Nanley Chery 2016-08-04 23:48:34 UTC
This patch should fix the issue: https://patchwork.freedesktop.org/patch/103267/
Comment 5 Nanley Chery 2016-08-05 22:26:39 UTC
The patch has been pushed to master. Thanks for the bug report!

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.