diff options
author | Mike Blumenkrantz <michael.blumenkrantz@gmail.com> | 2021-11-01 12:48:39 -0400 |
---|---|---|
committer | Dylan Baker <dylan.c.baker@intel.com> | 2021-11-24 15:47:19 -0800 |
commit | 5537232fca3975a4a5c14eb1b7c579373fe0910a (patch) | |
tree | 75d7a07756c29730759beaf29ca87d59ff8caa03 | |
parent | 809dee45dd3e92c409284aa21a2d7e2a467b194a (diff) |
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@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13630>
(cherry picked from commit bc345281ab95313c2e34fffbd993bd1fbfc016be)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/indices/u_primconvert.c | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/.pick_status.json b/.pick_status.json index 9515ed4f69b..995e64c112b 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -283,7 +283,7 @@ "description": "aux/primconvert: handle singular incomplete restarts", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "583070748cb103560b173b5789998302d517b587" }, 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); |