anv: assert we haven't gone over the maximum number of push_buffers
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Coverity notes that we break out of the loop walking the analysis_ranges
early if n_push_ranges >= max_push_buffers, so it notes that
n_push_ranges could already be 3 or 4 (depending on whether we're doing
mesh), and that then if we need the padding we insert another, which
would write past the end of the array.

I don't think this is actually possible in practice, but we can add an
assert to both keep coverity happy and detect that this has actually
happened.

CID: 1681478
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40147>
This commit is contained in:
Dylan Baker 2026-02-27 09:21:35 -08:00 committed by Marge Bot
parent d7f67171ef
commit a8ba682919

View file

@ -549,6 +549,7 @@ anv_nir_compute_push_layout(nir_shader *nir,
}
if (needs_padding_per_primitive) {
assert(n_push_ranges < max_push_buffers);
struct anv_push_range push_constant_padding_range = {
.set = ANV_DESCRIPTOR_SET_PER_PRIM_PADDING,
.start = 0,