Mesa (main): mesa/compute: refactor compute launch to look more like draw

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Dec 20 04:34:29 UTC 2021


Module: Mesa
Branch: main
Commit: b6fd811d2ceb4d9eb2b09dd1726719e551f2646c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6fd811d2ceb4d9eb2b09dd1726719e551f2646c

Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Dec 15 11:46:36 2021 +1000

mesa/compute: refactor compute launch to look more like draw

Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14256>

---

 src/mesa/main/compute.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/compute.c b/src/mesa/main/compute.c
index 2e2e91a7be2..331d67cc790 100644
--- a/src/mesa/main/compute.c
+++ b/src/mesa/main/compute.c
@@ -285,11 +285,9 @@ valid_dispatch_indirect(struct gl_context *ctx,  GLintptr indirect)
 }
 
 static void
-do_dispatch_compute(struct gl_context *ctx,
-                    struct pipe_grid_info *info)
+prepare_compute(struct gl_context *ctx)
 {
    struct st_context *st = st_context(ctx);
-   struct pipe_context *pipe = st->pipe;
 
    st_flush_bitmap_cache(st);
    st_invalidate_readpix_cache(st);
@@ -302,7 +300,6 @@ do_dispatch_compute(struct gl_context *ctx,
        st->compute_shader_may_be_dirty)
       st_validate_state(st, ST_PIPELINE_COMPUTE);
 
-   pipe->launch_grid(pipe, info);
 }
 
 static ALWAYS_INLINE void
@@ -334,7 +331,8 @@ dispatch_compute(GLuint num_groups_x, GLuint num_groups_y,
    info.block[1] = prog->info.workgroup_size[1];
    info.block[2] = prog->info.workgroup_size[2];
 
-   do_dispatch_compute(ctx, &info);
+   prepare_compute(ctx);
+   ctx->pipe->launch_grid(ctx->pipe, &info);
 
    if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
       _mesa_flush(ctx);
@@ -378,7 +376,8 @@ dispatch_compute_indirect(GLintptr indirect, bool no_error)
    info.block[1] = prog->info.workgroup_size[1];
    info.block[2] = prog->info.workgroup_size[2];
 
-   do_dispatch_compute(ctx, &info);
+   prepare_compute(ctx);
+   ctx->pipe->launch_grid(ctx->pipe, &info);
 
    if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
       _mesa_flush(ctx);
@@ -427,7 +426,8 @@ dispatch_compute_group_size(GLuint num_groups_x, GLuint num_groups_y,
    if (num_groups_x == 0u || num_groups_y == 0u || num_groups_z == 0u)
        return;
 
-   do_dispatch_compute(ctx, &info);
+   prepare_compute(ctx);
+   ctx->pipe->launch_grid(ctx->pipe, &info);
 
    if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
       _mesa_flush(ctx);



More information about the mesa-commit mailing list