From 0b8dcdec9d2700ccef2a5ed58bf94fd849dc1140 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 13 Aug 2021 17:11:51 +0200 Subject: [PATCH] vbo/dlist: fix max_index_count value MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We just need an upper bound anyway. Reviewed-by: Marek Olšák Part-of: --- src/mesa/vbo/vbo_save_api.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 25f6b29..4a94d1a 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -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; -- 2.7.4