Mesa (master): util: fix valgrind errors when dumping pipe_draw_info

Nicolai Hähnle nh at kemper.freedesktop.org
Wed Aug 23 11:55:24 UTC 2017


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

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Fri Aug 18 19:29:49 2017 +0200

util: fix valgrind errors when dumping pipe_draw_info

Various index-related fields are only initialized when required, so
they should only be dumped in those cases.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/auxiliary/util/u_dump_state.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c
index 70bbf5c9fa..c263021a9f 100644
--- a/src/gallium/auxiliary/util/u_dump_state.c
+++ b/src/gallium/auxiliary/util/u_dump_state.c
@@ -919,9 +919,15 @@ util_dump_draw_info(FILE *stream, const struct pipe_draw_info *state)
    util_dump_member(stream, uint, state, max_index);
 
    util_dump_member(stream, bool, state, primitive_restart);
-   util_dump_member(stream, uint, state, restart_index);
-
-   util_dump_member(stream, ptr, state, index.resource);
+   if (state->primitive_restart)
+      util_dump_member(stream, uint, state, restart_index);
+
+   if (state->index_size) {
+      if (state->has_user_indices)
+         util_dump_member(stream, ptr, state, index.user);
+      else
+         util_dump_member(stream, ptr, state, index.resource);
+   }
    util_dump_member(stream, ptr, state, count_from_stream_output);
 
    if (!state->indirect) {




More information about the mesa-commit mailing list