Mesa (main): agx: Call nir_lower_discard_if

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 4 19:57:49 UTC 2022


Module: Mesa
Branch: main
Commit: f8feaee0dd7bfa34dcd5d6c630cde38f605541e7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f8feaee0dd7bfa34dcd5d6c630cde38f605541e7

Author: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Date:   Wed Dec 15 20:39:02 2021 -0500

agx: Call nir_lower_discard_if

We still need to implement discard itself, but this means we don't need
to worry about discard_if. This compiles down to the same idiom as
the vendor compiler (Metal) generates

Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14217>

---

 src/asahi/compiler/agx_compile.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c
index 657837dfedd..383c0c02286 100644
--- a/src/asahi/compiler/agx_compile.c
+++ b/src/asahi/compiler/agx_compile.c
@@ -1481,6 +1481,9 @@ agx_compile_shader_nir(nir_shader *nir,
 
    agx_optimize_nir(nir);
 
+   /* Implement conditional discard with real control flow like Metal */
+   NIR_PASS_V(nir, nir_lower_discard_if);
+
    /* Must be last since NIR passes can remap driver_location freely */
    if (ctx->stage == MESA_SHADER_VERTEX) {
       agx_remap_varyings_vs(nir, &out->varyings, ctx->varyings);



More information about the mesa-commit mailing list