From ae8928b638dc42ca169c91293058cb98c1fe595e Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Thu, 26 Feb 2026 14:26:49 -0500 Subject: [PATCH] ir3: Fix constlen trimming when more than one stage is trimmed The logic is supposed to find the stage with the maximum constlen to trim for each time we have to trim a stage. But by not resetting max_constlen each time, we would "trim" the same stage repeatedly, leaving us thinking the total is below the limit when it actually isn't. Cc: mesa-stable Part-of: --- src/freedreno/ir3/ir3_shader.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c index 1a5a59fdef8..a5322b9ea48 100644 --- a/src/freedreno/ir3/ir3_shader.c +++ b/src/freedreno/ir3/ir3_shader.c @@ -841,11 +841,12 @@ trim_constlens(unsigned *constlens, unsigned first_stage, unsigned last_stage, cur_total += constlens[i]; } - unsigned max_stage = 0; - unsigned max_const = 0; uint32_t trimmed = 0; while (cur_total > combined_limit) { + unsigned max_stage = 0; + unsigned max_const = 0; + for (unsigned i = first_stage; i <= last_stage; i++) { if (constlens[i] >= max_const) { max_stage = i;