[Mesa-dev] [PATCH] st/mesa: don't draw if the bound element array buffer is not allocated

Marek Olšák maraeo at gmail.com
Wed Mar 21 17:41:55 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

---
 src/mesa/state_tracker/st_draw.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index b95a2522b2e..73f936bb4a9 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -166,20 +166,27 @@ st_draw_vbo(struct gl_context *ctx,
       }
 
       info.index_size = ib->index_size;
       info.min_index = min_index;
       info.max_index = max_index;
 
       if (_mesa_is_bufferobj(bufobj)) {
          /* indices are in a real VBO */
          info.has_user_indices = false;
          info.index.resource = st_buffer_object(bufobj)->buffer;
+
+         /* Return if the bound element array buffer doesn't have any backing
+          * storage. (nothing to do)
+          */
+         if (!info.index.resource)
+            return;
+
          start = pointer_to_offset(ib->ptr) / info.index_size;
       } else {
          /* indices are in user space memory */
          info.has_user_indices = true;
          info.index.user = ib->ptr;
       }
 
       setup_primitive_restart(ctx, &info);
    }
    else {
-- 
2.15.1



More information about the mesa-dev mailing list