From c53194d8766202228b0c17fa1719123783ffe258 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Fri, 28 May 2021 12:14:46 +0200 Subject: [PATCH] util/prim_restart: revert part of bad fix When drawing using util_translate_prim_restart_ib, zink explicitly ignores pipe_draw_start_count_bias::start, because util_translate_prim_restart_ib used to create a new index-buffer without padding at the start. This makes a lot of sense, because creating a padded index buffer is just wasteful. So let's walk back on the choice of starting to pad the output buffer. Fixes: 1272c2e0524 ("util/prim_restart: fix util_translate_prim_restart_ib") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4851 Reviewed-By: Mike Blumenkrantz Part-of: (cherry picked from commit 05bb449610fd2d0a96cbb18c70923cabdb15bb36) --- .pick_status.json | 2 +- src/gallium/auxiliary/util/u_prim_restart.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index fe19e7f0a7e..5fc1d511a01 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -661,7 +661,7 @@ "description": "util/prim_restart: revert part of bad fix", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "1272c2e05246cad647324ffdccf56435b97dec1c" }, diff --git a/src/gallium/auxiliary/util/u_prim_restart.c b/src/gallium/auxiliary/util/u_prim_restart.c index 9224bb396e3..071bfdc6205 100644 --- a/src/gallium/auxiliary/util/u_prim_restart.c +++ b/src/gallium/auxiliary/util/u_prim_restart.c @@ -125,14 +125,13 @@ util_translate_prim_restart_ib(struct pipe_context *context, /* Create new index buffer */ *dst_buffer = pipe_buffer_create(screen, PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_STREAM, - (start + count) * dst_index_size); + count * dst_index_size); if (!*dst_buffer) goto error; /* Map new / dest index buffer */ - dst_map = pipe_buffer_map_range(context, *dst_buffer, - start * dst_index_size, count * dst_index_size, - PIPE_MAP_WRITE, &dst_transfer); + dst_map = pipe_buffer_map(context, *dst_buffer, + PIPE_MAP_WRITE, &dst_transfer); if (!dst_map) goto error;