diff --git a/src/gallium/auxiliary/util/u_prim_restart.c b/src/gallium/auxiliary/util/u_prim_restart.c index aea0c0c58cd..be31163ca1c 100644 --- a/src/gallium/auxiliary/util/u_prim_restart.c +++ b/src/gallium/auxiliary/util/u_prim_restart.c @@ -125,13 +125,14 @@ 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, - count * dst_index_size); + (start + count) * dst_index_size); if (!*dst_buffer) goto error; /* Map new / dest index buffer */ - dst_map = pipe_buffer_map(context, *dst_buffer, - PIPE_MAP_WRITE, &dst_transfer); + dst_map = pipe_buffer_map_range(context, *dst_buffer, + start * dst_index_size, count * dst_index_size, + PIPE_MAP_WRITE, &dst_transfer); if (!dst_map) goto error; @@ -148,7 +149,7 @@ util_translate_prim_restart_ib(struct pipe_context *context, goto error; util_translate_prim_restart_data(src_index_size, src_map, dst_map, - draw->count, info->restart_index); + count, info->restart_index); if (src_transfer) pipe_buffer_unmap(context, src_transfer);