Mesa (staging/21.0): panfrost: Disable early-z when alpha test is used

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 25 18:01:53 UTC 2021


Module: Mesa
Branch: staging/21.0
Commit: ffd661d50bc7b5e4b9604116e88ecbc731249997
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ffd661d50bc7b5e4b9604116e88ecbc731249997

Author: Icecream95 <ixn at disroot.org>
Date:   Thu Mar 18 20:02:22 2021 +1300

panfrost: Disable early-z when alpha test is used

Fixes rendering artefacts in Minetest on Midgard.

Fixes: 275277a2b48 ("panfrost: Implement alpha testing natively")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9676>
(cherry picked from commit ae62fb3737634fdf1c376f3d27c2eae5b751dccc)

Conflicts:
	src/gallium/drivers/panfrost/pan_cmdstream.c

---

 .pick_status.json                            | 2 +-
 src/gallium/drivers/panfrost/pan_cmdstream.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index e0aaffe2802..f54d08281b9 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2956,7 +2956,7 @@
         "description": "panfrost: Disable early-z when alpha test is used",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "275277a2b48ce38fba1d5203941e987fdc856e92"
     },
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 9922c76e29d..6506ebe0122 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -436,7 +436,8 @@ panfrost_prepare_midgard_fs_state(struct panfrost_context *ctx,
         } else {
                 /* Reasons to disable early-Z from a shader perspective */
                 bool late_z = fs->can_discard || fs->writes_global ||
-                              fs->writes_depth || fs->writes_stencil;
+                              fs->writes_depth || fs->writes_stencil ||
+                              (zsa->alpha_func != MALI_FUNC_ALWAYS);
 
                 /* If either depth or stencil is enabled, discard matters */
                 bool zs_enabled =



More information about the mesa-commit mailing list