Skip to content
Snippets Groups Projects
Commit efca37d4 authored by Mike Blumenkrantz's avatar Mike Blumenkrantz :lifter: Committed by Marge Bot
Browse files

util/draw: fix map size of indirect buffer in util_draw_indirect_read


this was incorrectly calculating too small of a map region if
the stride was less than the size of the struct

Fixes: 3eb99323 ("aux/draw: add a util function for reading back indirect draw params")

Reviewed-by: default avatarMarek Olšák <marek.olsak@amd.com>
Part-of: <mesa/mesa!15963>
parent 31727f11
No related branches found
No related tags found
No related merge requests found
...@@ -158,12 +158,11 @@ util_draw_indirect_read(struct pipe_context *pipe, ...@@ -158,12 +158,11 @@ util_draw_indirect_read(struct pipe_context *pipe,
if (!draws) if (!draws)
return NULL; return NULL;
if (indirect->stride) unsigned map_size = (draw_count - 1) * indirect->stride + (num_params * sizeof(uint32_t));
num_params = MIN2(indirect->stride / 4, num_params);
params = pipe_buffer_map_range(pipe, params = pipe_buffer_map_range(pipe,
indirect->buffer, indirect->buffer,
indirect->offset, indirect->offset,
(num_params * indirect->draw_count) * sizeof(uint32_t), map_size,
PIPE_MAP_READ, PIPE_MAP_READ,
&transfer); &transfer);
if (!transfer) { if (!transfer) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment