Bug 97207

Summary: [IVY BRIDGE] Fragment shader discard writing to depth
Product: Mesa Reporter: SaschaWillems <webmaster>
Component: Drivers/Vulkan/intelAssignee: Intel 3D Bugs Mailing List <intel-3d-bugs>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: jason
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Discard with depth not being discarded on Sky Lake
Discard with depth being discarded on GTX980

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.