nir: Make nir_lower_discard_if() handle demotes and terminates, too.

AGX and zink both want all of these lowered, but nir_to_tgsi will want
only demote (and terminate if it was possible from GLSL but it's not)

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15932>
This commit is contained in:
Emma Anholt
2022-04-13 16:22:47 -07:00
committed by Marge Bot
parent d3b1579a1f
commit 28b2252d0a
4 changed files with 53 additions and 17 deletions

View File

@@ -1717,7 +1717,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);
NIR_PASS_V(nir, nir_lower_discard_if, (nir_lower_discard_if_to_cf |
nir_lower_demote_if_to_cf |
nir_lower_terminate_if_to_cf));
/* Must be last since NIR passes can remap driver_location freely */
if (ctx->stage == MESA_SHADER_VERTEX)