lvp: fixup multi draw memcpys
authorDave Airlie <airlied@redhat.com>
Wed, 14 Jul 2021 05:01:32 +0000 (15:01 +1000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 14 Jul 2021 18:06:18 +0000 (18:06 +0000)
This doesn't fix the tests but it fixes a bunch of valgrind
uninitialised value warnings

Fixes: f99f7c06e71d ("lavapipe: implement multidraw ext")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-By: Joshua Ashton <joshua@froggi.es>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11870>

src/gallium/frontends/lavapipe/lvp_cmd_buffer.c

index c1e7fee..c62765c 100644 (file)
@@ -522,7 +522,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdDrawMultiEXT(
    else {
       unsigned i = 0;
       vk_foreach_multi_draw(draw, i, pVertexInfo, drawCount, stride)
-         memcpy(cmd->u.draw.draws, draw, sizeof(struct pipe_draw_start_count_bias));
+         memcpy(&cmd->u.draw.draws[i], draw, sizeof(struct VkMultiDrawInfoEXT));
    }
 
    cmd_buf_queue(cmd_buffer, cmd);
@@ -808,7 +808,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdDrawMultiIndexedEXT(
    else {
       unsigned i = 0;
       vk_foreach_multi_draw_indexed(draw, i, pIndexInfo, drawCount, stride)
-         memcpy(cmd->u.draw_indexed.draws, draw, sizeof(struct pipe_draw_start_count_bias));
+         memcpy(&cmd->u.draw_indexed.draws[i], draw, sizeof(struct pipe_draw_start_count_bias));
    }
    /* only the first member is read if vertex_offset_changes is true */
    if (pVertexOffset)