Mesa (master): r600: update pipe_draw_info::restart_index only when primitive_restart is enabled
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 26 17:42:12 UTC 2021
Module: Mesa
Branch: master
Commit: ad853fc0e1a4ba5f561d5bfca488cbbae0b055f0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad853fc0e1a4ba5f561d5bfca488cbbae0b055f0
Author: Gert Wollny <gert.wollny at collabora.com>
Date: Sun Apr 25 12:22:20 2021 +0200
r600: update pipe_draw_info::restart_index only when primitive_restart is enabled
This avoids the use of uninitialized memory:
Conditional jump or move depends on uninitialised value(s)
at 0x5EDBF87: r600_draw_vbo (r600_state_common.c:2232)
by 0x5DEFA00: u_vbuf_draw_vbo (u_vbuf.c:1329)
by 0x5D990EF: cso_multi_draw (cso_context.c:1445)
by 0x59B7EF4: _mesa_draw_arrays (draw.c:1346)
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10442>
---
src/gallium/drivers/r600/r600_state_common.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 2ded6c82212..89a21c9c690 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -2229,8 +2229,11 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
}
/* Set the index offset and primitive restart. */
- if (rctx->vgt_state.vgt_multi_prim_ib_reset_en != info->primitive_restart ||
- rctx->vgt_state.vgt_multi_prim_ib_reset_indx != info->restart_index ||
+ bool restart_index_changed = info->primitive_restart &&
+ rctx->vgt_state.vgt_multi_prim_ib_reset_indx != info->restart_index;
+
+ if (rctx->vgt_state.vgt_multi_prim_ib_reset_en != info->primitive_restart ||
+ restart_index_changed ||
rctx->vgt_state.vgt_indx_offset != index_bias ||
(rctx->vgt_state.last_draw_was_indirect && !indirect)) {
rctx->vgt_state.vgt_multi_prim_ib_reset_en = info->primitive_restart;
More information about the mesa-commit
mailing list