From 10e75aae1bddee9795b1ff04ffd656b0da79b5b5 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Sat, 2 Sep 2023 18:53:13 +0300 Subject: [PATCH] intel/nir: rerun lower_tex if it lowers something MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit nir_lower_tex can lower tg4 coords into tg4 offset which on DG2+ we also need to lower into constant offsets. Unfortunately the nir_lower_tex pass is not able to lower the instructions it itself generates, so the easy fix for when nir_lower_tex lowers tg4 coords into tg4 offsets is to rerun the pass. Signed-off-by: Lionel Landwerlin Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9735 Cc: mesa-stable Reviewed-by: Tapani Pälli Tested-by: Yiwei Zhang Part-of: --- src/intel/compiler/brw_nir.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index 27a9d74..821d0e9 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -947,7 +947,13 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir, .lower_invalid_implicit_lod = true, }; - OPT(nir_lower_tex, &tex_options); + /* In the case where TG4 coords are lowered to offsets and we have a + * lower_xehp_tg4_offset_filter lowering those offsets further, we need to + * rerun the pass because the instructions inserted by the first lowering + * are not visible during that first pass. + */ + if (OPT(nir_lower_tex, &tex_options)) + OPT(nir_lower_tex, &tex_options); OPT(nir_normalize_cubemap_coords); OPT(nir_lower_global_vars_to_local); -- 2.7.4