From 132ffc46dccfd680dfd467eea846004c0620b249 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 7 Dec 2021 13:01:37 +1000 Subject: [PATCH] mesa/st: move compute to direct call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Acked-by: Marek Olšák Part-of: --- src/mesa/main/compute.c | 8 +++++--- src/mesa/main/dd.h | 17 ----------------- src/mesa/state_tracker/st_cb_compute.c | 20 +++++++------------- src/mesa/state_tracker/st_cb_compute.h | 11 +++++++---- src/mesa/state_tracker/st_context.c | 1 - 5 files changed, 19 insertions(+), 38 deletions(-) diff --git a/src/mesa/main/compute.c b/src/mesa/main/compute.c index dc05cb37002..43952c9232e 100644 --- a/src/mesa/main/compute.c +++ b/src/mesa/main/compute.c @@ -26,6 +26,8 @@ #include "compute.h" #include "context.h" +#include "state_tracker/st_cb_compute.h" + static bool check_valid_to_compute(struct gl_context *ctx, const char *function) { @@ -297,7 +299,7 @@ dispatch_compute(GLuint num_groups_x, GLuint num_groups_y, if (num_groups_x == 0u || num_groups_y == 0u || num_groups_z == 0u) return; - ctx->Driver.DispatchCompute(ctx, num_groups); + st_dispatch_compute(ctx, num_groups); if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) _mesa_flush(ctx); @@ -331,7 +333,7 @@ dispatch_compute_indirect(GLintptr indirect, bool no_error) if (!no_error && !valid_dispatch_indirect(ctx, indirect)) return; - ctx->Driver.DispatchComputeIndirect(ctx, indirect); + st_dispatch_compute_indirect(ctx, indirect); if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) _mesa_flush(ctx); @@ -374,7 +376,7 @@ 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; - ctx->Driver.DispatchComputeGroupSize(ctx, num_groups, group_size); + st_dispatch_compute_group_size(ctx, num_groups, group_size); if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) _mesa_flush(ctx); diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 80e7ad5e745..2cd1bc3737c 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -339,23 +339,6 @@ struct dd_function_table { */ GLenum (*GetGraphicsResetStatus)(struct gl_context *ctx); - /** - * \name GL_ARB_compute_shader interface - */ - /*@{*/ - void (*DispatchCompute)(struct gl_context *ctx, const GLuint *num_groups); - void (*DispatchComputeIndirect)(struct gl_context *ctx, GLintptr indirect); - /*@}*/ - - /** - * \name GL_ARB_compute_variable_group_size interface - */ - /*@{*/ - void (*DispatchComputeGroupSize)(struct gl_context *ctx, - const GLuint *num_groups, - const GLuint *group_size); - /*@}*/ - /** * \name GL_ARB_get_program_binary */ diff --git a/src/mesa/state_tracker/st_cb_compute.c b/src/mesa/state_tracker/st_cb_compute.c index 3ae017b22a4..c087eba0bb7 100644 --- a/src/mesa/state_tracker/st_cb_compute.c +++ b/src/mesa/state_tracker/st_cb_compute.c @@ -71,14 +71,14 @@ static void st_dispatch_compute_common(struct gl_context *ctx, pipe->launch_grid(pipe, &info); } -static void st_dispatch_compute(struct gl_context *ctx, - const GLuint *num_groups) +void st_dispatch_compute(struct gl_context *ctx, + const GLuint *num_groups) { st_dispatch_compute_common(ctx, num_groups, NULL, NULL, 0); } -static void st_dispatch_compute_indirect(struct gl_context *ctx, - GLintptr indirect_offset) +void st_dispatch_compute_indirect(struct gl_context *ctx, + GLintptr indirect_offset) { struct gl_buffer_object *indirect_buffer = ctx->DispatchIndirectBuffer; struct pipe_resource *indirect = st_buffer_object(indirect_buffer)->buffer; @@ -86,16 +86,10 @@ static void st_dispatch_compute_indirect(struct gl_context *ctx, st_dispatch_compute_common(ctx, NULL, NULL, indirect, indirect_offset); } -static void st_dispatch_compute_group_size(struct gl_context *ctx, - const GLuint *num_groups, - const GLuint *group_size) +void st_dispatch_compute_group_size(struct gl_context *ctx, + const GLuint *num_groups, + const GLuint *group_size) { st_dispatch_compute_common(ctx, num_groups, group_size, NULL, 0); } -void st_init_compute_functions(struct dd_function_table *functions) -{ - functions->DispatchCompute = st_dispatch_compute; - functions->DispatchComputeIndirect = st_dispatch_compute_indirect; - functions->DispatchComputeGroupSize = st_dispatch_compute_group_size; -} diff --git a/src/mesa/state_tracker/st_cb_compute.h b/src/mesa/state_tracker/st_cb_compute.h index e9fe458dfca..1f686b5ce40 100644 --- a/src/mesa/state_tracker/st_cb_compute.h +++ b/src/mesa/state_tracker/st_cb_compute.h @@ -28,9 +28,12 @@ #ifndef ST_CB_COMPUTE_H #define ST_CB_COMPUTE_H -struct dd_function_table; - -extern void -st_init_compute_functions(struct dd_function_table *functions); +void st_dispatch_compute(struct gl_context *ctx, + const GLuint *num_groups); +void st_dispatch_compute_indirect(struct gl_context *ctx, + GLintptr indirect_offset); +void st_dispatch_compute_group_size(struct gl_context *ctx, + const GLuint *num_groups, + const GLuint *group_size); #endif /* ST_CB_COMPUTE_H */ diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 26bdc0ddbe8..5ca1c0acb4b 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -925,7 +925,6 @@ st_init_driver_functions(struct pipe_screen *screen, st_init_program_functions(functions); st_init_flush_functions(screen, functions); - st_init_compute_functions(functions); st_init_vdpau_functions(functions);