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: 86f3c0c4c2 ("ir3: simplify constlen calculation")
(cherry picked from commit 49d29d4f10)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41104>
This commit is contained in:
Connor Abbott 2026-04-14 17:35:51 -04:00 committed by Eric Engestrom
parent c15245f814
commit eb7c92b6a2
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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