llvmpipe: Make sure to not divide by zero on debug output

Check that lp->nr_cs_variants is not zero before dividing by it as done in a few
lines above.

CID: 1531786 Division or modulo by zero
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35091>
This commit is contained in:
Corentin Noël 2025-05-21 15:46:55 +02:00 committed by Marge Bot
parent 383684596c
commit d4d37ead82

View file

@ -1406,7 +1406,8 @@ llvmpipe_update_cs_variant(struct llvmpipe_context *lp,
"\t%u instrs,\t%u instrs/variant\n",
shader->variants_cached,
lp->nr_cs_variants, lp->nr_cs_instrs,
lp->nr_cs_instrs / lp->nr_cs_variants);
lp->nr_cs_variants
? lp->nr_cs_instrs / lp->nr_cs_variants : 0);
}
/*