From aee78a350453c392bcff95d2f62b8d549f7d6868 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 21 May 2021 06:02:18 -0400 Subject: [PATCH] util/prim_restart: store index bounds while rewriting draws may as well Reviewed-by: Erik Faye-Lund Part-of: --- src/gallium/auxiliary/util/u_prim_restart.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_prim_restart.c b/src/gallium/auxiliary/util/u_prim_restart.c index 3e59ce50bb1..59be6cf5b02 100644 --- a/src/gallium/auxiliary/util/u_prim_restart.c +++ b/src/gallium/auxiliary/util/u_prim_restart.c @@ -177,6 +177,7 @@ struct range { struct range_info { struct range *ranges; unsigned count, max; + unsigned min_index, max_index; }; @@ -209,6 +210,8 @@ add_range(enum pipe_prim_type mode, struct range_info *info, unsigned start, uns info->max *= 2; } + info->min_index = MIN2(info->min_index, start); + info->max_index = MAX2(info->max_index, start + count - 1); /* save the range */ info->ranges[info->count].start = start; @@ -233,7 +236,7 @@ util_draw_vbo_without_prim_restart(struct pipe_context *context, const struct pipe_draw_start_count_bias *draw) { const void *src_map; - struct range_info ranges = {0}; + struct range_info ranges = { .min_index = UINT32_MAX, 0 }; struct pipe_draw_info new_info; struct pipe_draw_start_count_bias new_draw; struct pipe_transfer *src_transfer = NULL;