pan/bi: Assert immediate indices fit

This would have caught the assortment of bugs fixed in the previous two
commits, and should help lint going forward.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Maciej Matuszczyk <maccraft123mc@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8427>
This commit is contained in:
Alyssa Rosenzweig 2021-01-11 13:50:43 -05:00 committed by Marge Bot
parent 77209e0500
commit 455cde2562

View file

@ -272,6 +272,7 @@ def pack_variant(opname, states):
for (name, pos, width) in st[1].get("immediates", []):
common_body.append('unsigned {} = I->{};'.format(name, name))
common_body.append('assert({} < {});'.format(name, hex(1 << width)))
for st in pack_exprs:
st.append('({} << {})'.format(name, pos))