anv: assert that we don't overflow

Our exposed limits say we shouldn't be able to, but let's add an assert
in case something changes, and to help Coverity out.

CID: 1662103
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37583>
This commit is contained in:
Dylan Baker 2025-09-25 18:58:01 +00:00 committed by Marge Bot
parent 01cbd0f24a
commit d5199b07d2

View file

@ -1656,6 +1656,7 @@ void genX(CmdDrawIndirectByteCountEXT)(
mi_store(&b, mi_reg32(GFX7_3DPRIM_VERTEX_COUNT), count);
mi_store(&b, mi_reg32(GFX7_3DPRIM_START_VERTEX), mi_imm(firstVertex));
assert(((uint64_t)instanceCount * gfx->instance_multiplier <= UINT32_MAX));
mi_store(&b, mi_reg32(GFX7_3DPRIM_INSTANCE_COUNT),
mi_imm(instanceCount * gfx->instance_multiplier));
mi_store(&b, mi_reg32(GFX7_3DPRIM_START_INSTANCE), mi_imm(firstInstance));