mesa/st: move compute to direct call

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14100>
This commit is contained in:
Dave Airlie 2021-12-07 13:01:37 +10:00 committed by Marge Bot
parent 28bd406f50
commit 132ffc46dc
5 changed files with 19 additions and 38 deletions

View file

@ -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);

View file

@ -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
*/

View file

@ -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;
}

View file

@ -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 */

View file

@ -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);