Mesa (master): gallium/u_threaded: don't make a local copy of pipe_draw_start_count

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 8 18:06:43 UTC 2020


Module: Mesa
Branch: master
Commit: 4a483ec027e752e1f95ff900bfc5a293ec281134
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4a483ec027e752e1f95ff900bfc5a293ec281134

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sat Nov 28 05:24:06 2020 -0500

gallium/u_threaded: don't make a local copy of pipe_draw_start_count

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7719>

---

 src/gallium/auxiliary/util/u_threaded_context.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index c4349a9d355..9d6dfa77206 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -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);
 }



More information about the mesa-commit mailing list