From 49d29d4f109fafb2ecacb3d5ec61faec45dacfc1 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Tue, 14 Apr 2026 17:35:51 -0400 Subject: [PATCH] ir3: Use correct immediate size for constlen calculation "size" is the allocated size of the array, not the number of immediates actually used. We could wind up returning a too-large constlen, larger than 512, and since the binning variant uses the non-binning variant's constlen as it's max_const we could make binning variants use c512.x and crash when encoding. Fixes: 86f3c0c4c2c ("ir3: simplify constlen calculation") Part-of: --- src/freedreno/ir3/ir3_shader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/freedreno/ir3/ir3_shader.h b/src/freedreno/ir3/ir3_shader.h index a6d7be5676c..ec04ae8170b 100644 --- a/src/freedreno/ir3/ir3_shader.h +++ b/src/freedreno/ir3/ir3_shader.h @@ -1085,7 +1085,7 @@ static inline unsigned ir3_constlen(const struct ir3_shader_variant *v) { return ir3_const_state(v)->allocs.max_const_offset_vec4 + - v->imm_state.size / 4; + DIV_ROUND_UP(v->imm_state.count, 4); } static inline unsigned