bifrost: Constant fold after lower_explicit_io

nir_lower_explicit_io generates mul+add chains even for constants.  One
round of constant folding should get rid of these.  This fixes all of
the dEQP-VK.glsl.conversions.* tests on panvk.

GoGoGoGo'd-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15349>
This commit is contained in:
Jason Ekstrand 2022-03-11 12:47:21 -06:00 committed by Marge Bot
parent e0b6493c49
commit 65db6b0e7c
1 changed files with 6 additions and 0 deletions

View File

@ -3947,6 +3947,12 @@ bi_finalize_nir(nir_shader *nir, unsigned gpu_id, bool is_blend)
NIR_PASS_V(nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
glsl_type_size, 0);
/* nir_lower[_explicit]_io is lazy and emits mul+add chains even for
* offsets it could figure out are constant. Do some constant folding
* before bifrost_nir_lower_store_component below.
*/
NIR_PASS_V(nir, nir_opt_constant_folding);
if (nir->info.stage == MESA_SHADER_FRAGMENT) {
NIR_PASS_V(nir, nir_lower_mediump_io, nir_var_shader_out,
~0, false);