ir3: Use correct immediate size for constlen calculation
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

"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")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40961>
This commit is contained in:
Connor Abbott 2026-04-14 17:35:51 -04:00 committed by Marge Bot
parent 280c64d720
commit 49d29d4f10

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