pan/bi: Call constant folding in postprocess()

The comment explicitly calls out pan_nir_lower_store_component(), which
is in a different function call so it's a bit weird to have it in the
caller.  Also, we already do this in postprocess() on midgard so it
makes more sense to just move it into bifrost.

Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38265>
This commit is contained in:
Faith Ekstrand 2025-11-05 14:02:24 -05:00 committed by Marge Bot
parent 0fae56e100
commit 949a4458ea
3 changed files with 5 additions and 12 deletions

View file

@ -519,12 +519,6 @@ panfrost_create_shader_state(struct pipe_context *pctx,
if (dev->arch >= 6 && nir->info.stage == MESA_SHADER_FRAGMENT)
NIR_PASS(_, nir, pan_nir_lower_noperspective_fs);
/* 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(_, nir, nir_opt_constant_folding);
pan_shader_postprocess(nir, panfrost_device_gpu_id(dev));
if (nir->info.stage == MESA_SHADER_FRAGMENT)

View file

@ -6014,6 +6014,11 @@ bifrost_postprocess_nir(nir_shader *nir, unsigned gpu_id)
VARYING_BIT_PSIZ, false);
}
/* 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 pan_nir_lower_store_component below.
*/
NIR_PASS(_, nir, nir_opt_constant_folding);
NIR_PASS(_, nir, pan_nir_lower_store_component);
}

View file

@ -927,12 +927,6 @@ panvk_lower_nir(struct panvk_device *dev, nir_shader *nir,
if (nir->info.stage == MESA_SHADER_FRAGMENT)
NIR_PASS(_, nir, pan_nir_lower_noperspective_fs);
/* 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(_, nir, nir_opt_constant_folding);
pan_shader_postprocess(nir, compile_input->gpu_id);
if (stage == MESA_SHADER_VERTEX)