etnaviv/GC7000L: discard does not work correctly with depth buffer
System information
- OS: Debian GNU/Linux bullseye/sid
- GPU: GC7000L in NXP i.MX8MQ
- Kernel version: Linux reform 5.7.0-rc6+ #9 (closed) SMP PREEMPT Fri Jun 5 01:09:27 CEST 2020 aarch64 GNU/Linux
- Mesa version: 2.1 Mesa 20.2.0-devel (git-c448f42e178)
- Xserver version (if applicable): 1.20.99.1
- Desktop manager and compositor: sway version 1.4-8386655
Description
When discard is used in a shader, the fragment that is "behind" the current fragment should be resolved according to correct depth information. It looks like, on GC7000L, discarded pixels either overwrite the depth buffer anyway, or early-Z is not switched off correctly.
Here is a simple test case that I wrote to illustrate the problem:
https://github.com/mntmn/etna-test2
Here is a new, prettier test case for wayland by rasterman+daniels:
This bug causes accelerated rendering in KiCAD to fail and makes some games like Minetest (a sophisticated open source Minecraft clone) unplayable. I attached some screenshot of the problems below.
Bounty
There was originally a bounty of EUR 1000.00 on this bug, but I happened to find the solution myself, so there is no more bounty (see comments).
Screenshots
These are the outputs from the new test case.
Test case (wrong output with etnaviv):
Test case (correct output with radeon):