gallium/pp: typedef and use pp_st_invalidate_state_func to avoid cast
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20042>
This commit is contained in:
@@ -35,6 +35,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
struct cso_context;
|
||||
struct st_context;
|
||||
|
||||
struct pp_queue_t; /* Forward definition */
|
||||
struct pp_program;
|
||||
@@ -43,6 +44,9 @@ struct pp_program;
|
||||
typedef void (*pp_func) (struct pp_queue_t *, struct pipe_resource *,
|
||||
struct pipe_resource *, unsigned int);
|
||||
|
||||
typedef void (*pp_st_invalidate_state_func)(struct st_context *st,
|
||||
unsigned flags);
|
||||
|
||||
/* Main functions */
|
||||
|
||||
/**
|
||||
@@ -53,8 +57,8 @@ typedef void (*pp_func) (struct pp_queue_t *, struct pipe_resource *,
|
||||
struct pp_queue_t *pp_init(struct pipe_context *pipe,
|
||||
const unsigned int *enabled,
|
||||
struct cso_context *,
|
||||
void *st,
|
||||
void (*st_invalidate_state)(void *st, unsigned flags));
|
||||
struct st_context *st,
|
||||
pp_st_invalidate_state_func st_invalidate_state);
|
||||
|
||||
void pp_run(struct pp_queue_t *, struct pipe_resource *,
|
||||
struct pipe_resource *, struct pipe_resource *);
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
/** Initialize the post-processing queue. */
|
||||
struct pp_queue_t *
|
||||
pp_init(struct pipe_context *pipe, const unsigned int *enabled,
|
||||
struct cso_context *cso, void *st,
|
||||
void (*st_invalidate_state)(void *st, unsigned flags))
|
||||
struct cso_context *cso, struct st_context *st,
|
||||
pp_st_invalidate_state_func st_invalidate_state)
|
||||
{
|
||||
unsigned int num_filters = 0;
|
||||
unsigned int curpos = 0, i, tmp_req = 0;
|
||||
|
||||
@@ -43,8 +43,8 @@ struct pp_program
|
||||
struct cso_context *cso;
|
||||
|
||||
/* For notifying st_context to rebind states that we clobbered. */
|
||||
void *st;
|
||||
void (*st_invalidate_state)(void *st, unsigned flags);
|
||||
struct st_context *st;
|
||||
pp_st_invalidate_state_func st_invalidate_state;
|
||||
|
||||
struct pipe_blend_state blend;
|
||||
struct pipe_depth_stencil_alpha_state depthstencil;
|
||||
@@ -98,8 +98,8 @@ void pp_free_fbos(struct pp_queue_t *);
|
||||
void pp_debug(const char *, ...);
|
||||
|
||||
struct pp_program *pp_init_prog(struct pp_queue_t *, struct pipe_context *pipe,
|
||||
struct cso_context *, void *st,
|
||||
void (*st_invalidate_state)(void *st, unsigned flags));
|
||||
struct cso_context *, struct st_context *st,
|
||||
pp_st_invalidate_state_func st_invalidate_state);
|
||||
|
||||
void pp_blit(struct pipe_context *pipe,
|
||||
struct pipe_resource *src_tex,
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
/** Initialize the internal details */
|
||||
struct pp_program *
|
||||
pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe,
|
||||
struct cso_context *cso, void *st,
|
||||
void (*st_invalidate_state)(void *st, unsigned flags))
|
||||
struct cso_context *cso, struct st_context *st,
|
||||
pp_st_invalidate_state_func st_invalidate_state)
|
||||
{
|
||||
struct pp_program *p;
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ dri_create_context(struct dri_screen *screen,
|
||||
|
||||
if (ctx->st->cso_context) {
|
||||
ctx->pp = pp_init(ctx->st->pipe, screen->pp_enabled, ctx->st->cso_context,
|
||||
ctx->st, (void*)st_context_invalidate_state);
|
||||
ctx->st, st_context_invalidate_state);
|
||||
ctx->hud = hud_create(ctx->st->cso_context,
|
||||
share_ctx ? share_ctx->hud : NULL,
|
||||
ctx->st, st_context_invalidate_state);
|
||||
|
||||
@@ -796,7 +796,7 @@ OSMesaMakeCurrent(OSMesaContext osmesa, void *buffer, GLenum type,
|
||||
osmesa->pp_enabled,
|
||||
osmesa->st->cso_context,
|
||||
osmesa->st,
|
||||
(void*)st_context_invalidate_state);
|
||||
st_context_invalidate_state);
|
||||
|
||||
pp_init_fbos(osmesa->pp, width, height);
|
||||
}
|
||||
|
||||
@@ -204,13 +204,13 @@ GalliumContext::CreateContext(HGLWinsysContext *wsContext)
|
||||
assert(!context->st->frontend_context);
|
||||
context->st->frontend_context = (void*)context;
|
||||
|
||||
struct st_context *stContext = (struct st_context*)context->st;
|
||||
struct st_context *stContext = context->st;
|
||||
|
||||
// Init Gallium3D Post Processing
|
||||
// TODO: no pp filters are enabled yet through postProcessEnable
|
||||
context->postProcess = pp_init(stContext->pipe, context->postProcessEnable,
|
||||
stContext->cso_context, stContext,
|
||||
(void*)st_context_invalidate_state);
|
||||
st_context_invalidate_state);
|
||||
|
||||
context_id contextNext = -1;
|
||||
Lock();
|
||||
|
||||
Reference in New Issue
Block a user