Mesa (main): aux/primconvert: handle singular incomplete restarts
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Nov 4 20:38:37 UTC 2021
Module: Mesa
Branch: main
Commit: bc345281ab95313c2e34fffbd993bd1fbfc016be
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc345281ab95313c2e34fffbd993bd1fbfc016be
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Mon Nov 1 12:48:39 2021 -0400
aux/primconvert: handle singular incomplete restarts
if no restart indices are found, this draw must be discarded to avoid
crashing later on
Fixes: 583070748cb ("util/primconvert: handle rewriting of prim-restart draws with unsupported primtype")
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13630>
---
src/gallium/auxiliary/indices/u_primconvert.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c
index 62956910aa8..5ce8dddfa1f 100644
--- a/src/gallium/auxiliary/indices/u_primconvert.c
+++ b/src/gallium/auxiliary/indices/u_primconvert.c
@@ -202,8 +202,11 @@ util_primconvert_draw_vbo(struct primconvert_context *pc,
&direct_draw_func);
/* this should always be a direct translation */
assert(new_draw.count == total_index_count);
- /* step 3: allocate a temp buffer for an intermediate rewrite step */
- rewrite_buffer = malloc(index_size * total_index_count);
+ /* step 3: allocate a temp buffer for an intermediate rewrite step
+ * if no indices were found, this was a single incomplete restart and can be discarded
+ */
+ if (total_index_count)
+ rewrite_buffer = malloc(index_size * total_index_count);
if (!rewrite_buffer) {
if (src_transfer)
pipe_buffer_unmap(pc->pipe, src_transfer);
More information about the mesa-commit
mailing list