Mesa (main): panfrost: Fix off-by-one in varying count assert

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 5 21:42:39 UTC 2021


Module: Mesa
Branch: main
Commit: 9c8311b737935e6adcab25b16808da2ae5548288
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c8311b737935e6adcab25b16808da2ae5548288

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Mon Sep 27 16:51:32 2021 -0400

panfrost: Fix off-by-one in varying count assert

We want to assert that the number of varyings (the count) is at most the
the maximum count. This is <=, not <, with the assertion previously
failing for exactly the maximum.

Fixes: 2c2cf0ecfe6 ("panfrost: Streamline varying linking code")
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13070>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 692e7e0075a..9f5ea5074c5 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -2106,8 +2106,8 @@ panfrost_emit_varying_descs(
 
         /* Offsets within the general varying buffer, indexed by location */
         signed offsets[PIPE_MAX_ATTRIBS];
-        assert(producer_count < ARRAY_SIZE(offsets));
-        assert(consumer_count < ARRAY_SIZE(offsets));
+        assert(producer_count <= ARRAY_SIZE(offsets));
+        assert(consumer_count <= ARRAY_SIZE(offsets));
 
         /* Allocate enough descriptors for both shader stages */
         struct panfrost_ptr T =



More information about the mesa-commit mailing list