From f8feaee0dd7bfa34dcd5d6c630cde38f605541e7 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 15 Dec 2021 20:39:02 -0500 Subject: [PATCH] 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 Part-of: --- 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);