Mesa (master): pan/bi: Assert immediate indices fit

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 11 22:43:59 UTC 2021


Module: Mesa
Branch: master
Commit: 455cde2562b6480bf31a46feb98e8d95eb81add8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=455cde2562b6480bf31a46feb98e8d95eb81add8

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Mon Jan 11 13:50:43 2021 -0500

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 at collabora.com>
Tested-by: Maciej Matuszczyk <maccraft123mc at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8427>

---

 src/panfrost/bifrost/bi_packer.c.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/panfrost/bifrost/bi_packer.c.py b/src/panfrost/bifrost/bi_packer.c.py
index 13b31c3afa9..85af8619329 100644
--- a/src/panfrost/bifrost/bi_packer.c.py
+++ b/src/panfrost/bifrost/bi_packer.c.py
@@ -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))



More information about the mesa-commit mailing list