From 2437556d83bc588efb97b81468695879ff23529e Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Mon, 20 Nov 2023 15:42:23 +0200 Subject: [PATCH] intel/fs: rerun divergence prior to lowering non-uniform interpolate at sample Signed-off-by: Lionel Landwerlin Fixes: 74a40cc4b6 ("intel/fs: move lower of non-uniform at_sample barycentric to NIR") Reviewed-by: Kenneth Graunke Part-of: --- src/intel/compiler/brw_nir.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index 7f91b411a7a..4512241b517 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -1686,6 +1686,7 @@ brw_postprocess_nir(nir_shader *nir, const struct brw_compiler *compiler, OPT(nir_opt_move, nir_move_comparisons); OPT(nir_opt_dead_cf); + bool divergence_analysis_dirty = false; NIR_PASS(_, nir, nir_convert_to_lcssa, true, true); NIR_PASS_V(nir, nir_divergence_analysis); @@ -1711,11 +1712,19 @@ brw_postprocess_nir(nir_shader *nir, const struct brw_compiler *compiler, if (OPT(nir_lower_int64)) brw_nir_optimize(nir, is_scalar, devinfo); + + divergence_analysis_dirty = true; } /* Do this only after the last opt_gcm. GCM will undo this lowering. */ - if (nir->info.stage == MESA_SHADER_FRAGMENT) + if (nir->info.stage == MESA_SHADER_FRAGMENT) { + if (divergence_analysis_dirty) { + NIR_PASS(_, nir, nir_convert_to_lcssa, true, true); + NIR_PASS_V(nir, nir_divergence_analysis); + } + OPT(brw_nir_lower_non_uniform_barycentric_at_sample); + } /* Clean up LCSSA phis */ OPT(nir_opt_remove_phis);