From eb7c92b6a281ecf45d20c8c92b5548cee2b45e6f 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") (cherry picked from commit 49d29d4f109fafb2ecacb3d5ec61faec45dacfc1) Part-of: --- .pick_status.json | 2 +- src/freedreno/ir3/ir3_shader.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 65deefd26e0..ed6349b9210 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2274,7 +2274,7 @@ "description": "ir3: Use correct immediate size for constlen calculation", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "86f3c0c4c2c0044e3b75bcb68079bbf7b5e77243", "notes": null 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