intel/nir: rerun lower_tex if it lowers something

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 <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9735
Cc: mesa-stable
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25015>
This commit is contained in:
Lionel Landwerlin 2023-09-02 18:53:13 +03:00 committed by Marge Bot
parent c4506b5af5
commit 10e75aae1b

View file

@ -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);