From cf6ce1bb8c3d96e9a26529bb6ad751a208d5e084 Mon Sep 17 00:00:00 2001 From: Lorenzo Rossi Date: Wed, 15 Apr 2026 11:04:04 +0200 Subject: [PATCH] panfrost: Constant-fold io locations after lowering This makes panfrost IO lowering similar to panvk and avoids subtle bugs later in the series. Signed-off-by: Lorenzo Rossi Reviewed-by: Christoph Pillmayer Reviewed-by: Faith Ekstrand Part-of: --- src/gallium/drivers/panfrost/pan_shader.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/drivers/panfrost/pan_shader.c b/src/gallium/drivers/panfrost/pan_shader.c index 86e045bce9c..4d5ae1c6ddc 100644 --- a/src/gallium/drivers/panfrost/pan_shader.c +++ b/src/gallium/drivers/panfrost/pan_shader.c @@ -543,6 +543,12 @@ panfrost_create_shader_state(struct pipe_context *pctx, nir_var_shader_in | nir_var_shader_out, UINT32_MAX); NIR_PASS(_, nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out, glsl_type_size, nir_lower_io_use_interpolated_input_intrinsics); + /* nir_lower_io just computes offsets based on the original deref and + * lower_indirect_derefs ensures that the array derefs have a constant + * index. Constant-fold to get us actual constants in in load/store + * instructions. + */ + NIR_PASS(_, nir, nir_opt_constant_folding); if (nir->info.stage == MESA_SHADER_FRAGMENT) so->noperspective_varyings =