gallium/u_threaded: don't make a local copy of pipe_draw_start_count
authorMarek Olšák <marek.olsak@amd.com>
Sat, 28 Nov 2020 10:24:06 +0000 (05:24 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 8 Dec 2020 17:47:56 +0000 (17:47 +0000)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7719>

src/gallium/auxiliary/util/u_threaded_context.c

index c4349a9..9d6dfa7 100644 (file)
@@ -2290,16 +2290,18 @@ static void
 tc_call_draw_single(struct pipe_context *pipe, union tc_payload *payload)
 {
    struct tc_draw_single *info = (struct tc_draw_single*)payload;
-   struct pipe_draw_start_count draw;
 
    /* u_threaded_context stores start/count in min/max_index for single draws. */
    /* Drivers using u_threaded_context shouldn't use min/max_index. */
-   draw.start = info->info.min_index;
-   draw.count = info->info.max_index;
+   struct pipe_draw_start_count *draw =
+      (struct pipe_draw_start_count *)&info->info.min_index;
+   STATIC_ASSERT(offsetof(struct pipe_draw_start_count, start) == 0);
+   STATIC_ASSERT(offsetof(struct pipe_draw_start_count, count) == 4);
+
    info->info.index_bounds_valid = false;
    info->info.has_user_indices = false;
 
-   pipe->draw_vbo(pipe, &info->info, NULL, &draw, 1);
+   pipe->draw_vbo(pipe, &info->info, NULL, draw, 1);
    if (info->info.index_size)
       pipe_resource_reference(&info->info.index.resource, NULL);
 }