panvk: assert that shader_present isn't zero

If it is, util_last_bit() will return zero, and the subtraction that
follows will underflow. Make it obvious that this can't happen, by
adding an assert here.

CID: 1665297
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37903>
This commit is contained in:
Erik Faye-Lund 2025-10-15 10:47:06 +02:00 committed by Marge Bot
parent 22d929f265
commit c8e30c7a9f

View file

@ -457,6 +457,7 @@ panvk_preprocess_nir(struct vk_physical_device *vk_pdev,
NIR_PASS(_, nir, nir_split_var_copies);
NIR_PASS(_, nir, nir_lower_var_copies);
assert(pdev->kmod.props.shader_present != 0);
uint64_t core_max_id = util_last_bit(pdev->kmod.props.shader_present) - 1;
NIR_PASS(_, nir, nir_inline_sysval, nir_intrinsic_load_core_max_id_arm,
core_max_id);