Mesa (master): panfrost: Fix index calculation types and asserts

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Mar 31 04:43:10 UTC 2019


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

Author: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Date:   Sun Mar 31 04:27:29 2019 +0000

panfrost: Fix index calculation types and asserts

Fixes crash in
dEQP-GLES2.functional.draw.draw_elements.points.single_attribute.

Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>

---

 src/gallium/drivers/panfrost/pan_context.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 973b9c6ae93..bafe67e138f 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1461,8 +1461,8 @@ panfrost_draw_vbo(
 
                 const uint8_t *ibuf8 = panfrost_get_index_buffer_raw(info);
 
-                int min_index = INT_MAX;
-                int max_index = 0;
+                unsigned min_index = UINT_MAX;
+                unsigned max_index = 0;
 
                 if (info->index_size == 1) {
                         CALCULATE_MIN_MAX_INDEX(uint8_t, ibuf8, info->start, info->count);
@@ -1477,9 +1477,8 @@ panfrost_draw_vbo(
                 }
 
                 /* Make sure we didn't go crazy */
-                assert(min_index < INT_MAX);
-                assert(max_index > 0);
-                assert(max_index > min_index);
+                assert(min_index < UINT_MAX);
+                assert(max_index >= min_index);
 
                 /* Use the corresponding values */
                 invocation_count = max_index - min_index + 1;




More information about the mesa-commit mailing list