vbo/dlist: fix max_index_count value

We just need an upper bound anyway.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12646>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2021-08-13 17:11:51 +02:00
parent fc2030b8f3
commit 0b8dcdec9d

View file

@ -579,12 +579,9 @@ compile_vertex_list(struct gl_context *ctx)
node->cold->min_index = node->cold->prims[0].start;
node->cold->max_index = end - 1;
/* Estimate for the worst case: all prims are line strips (the +1 is because
* wrap_buffers may call use but the last primitive may not be complete) */
int max_indices_count = MAX2(total_vert_count * 2 - (node->cold->prim_count * 2) + 1,
total_vert_count);
int max_index_count = total_vert_count * 2;
int size = max_indices_count * sizeof(uint32_t);
int size = max_index_count * sizeof(uint32_t);
uint32_t* indices = (uint32_t*) malloc(size);
struct _mesa_prim *merged_prims = NULL;
@ -692,7 +689,7 @@ compile_vertex_list(struct gl_context *ctx)
merged_prims[last_valid_prim].mode = mode;
}
assert(idx > 0 && idx <= max_indices_count);
assert(idx > 0 && idx <= max_index_count);
unsigned merged_prim_count = last_valid_prim + 1;
node->cold->ib.ptr = NULL;