diff --git a/src/gallium/auxiliary/postprocess/postprocess.h b/src/gallium/auxiliary/postprocess/postprocess.h index 293bd5a12d0..d19bcd03093 100644 --- a/src/gallium/auxiliary/postprocess/postprocess.h +++ b/src/gallium/auxiliary/postprocess/postprocess.h @@ -54,7 +54,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 *, - struct st_context_iface *st); + void *st, + void (*st_invalidate_state)(void *st, unsigned flags)); void pp_run(struct pp_queue_t *, struct pipe_resource *, struct pipe_resource *, struct pipe_resource *); diff --git a/src/gallium/auxiliary/postprocess/pp_init.c b/src/gallium/auxiliary/postprocess/pp_init.c index bbab41b9100..7733e25bc6c 100644 --- a/src/gallium/auxiliary/postprocess/pp_init.c +++ b/src/gallium/auxiliary/postprocess/pp_init.c @@ -40,7 +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, struct st_context_iface *st) + struct cso_context *cso, void *st, + void (*st_invalidate_state)(void *st, unsigned flags)) { unsigned int num_filters = 0; unsigned int curpos = 0, i, tmp_req = 0; @@ -78,7 +79,7 @@ pp_init(struct pipe_context *pipe, const unsigned int *enabled, goto error; } - ppq->p = pp_init_prog(ppq, pipe, cso, st); + ppq->p = pp_init_prog(ppq, pipe, cso, st, st_invalidate_state); if (ppq->p == NULL) { pp_debug("pp_init_prog returned NULL.\n"); goto error; diff --git a/src/gallium/auxiliary/postprocess/pp_private.h b/src/gallium/auxiliary/postprocess/pp_private.h index 922b93c7ec7..45fbe843110 100644 --- a/src/gallium/auxiliary/postprocess/pp_private.h +++ b/src/gallium/auxiliary/postprocess/pp_private.h @@ -41,7 +41,10 @@ struct pp_program struct pipe_screen *screen; struct pipe_context *pipe; struct cso_context *cso; - struct st_context_iface *st; + + /* For notifying st_context to rebind states that we clobbered. */ + void *st; + void (*st_invalidate_state)(void *st, unsigned flags); struct pipe_blend_state blend; struct pipe_depth_stencil_alpha_state depthstencil; @@ -95,7 +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 *, struct st_context_iface *st); + struct cso_context *, void *st, + void (*st_invalidate_state)(void *st, unsigned flags)); void pp_blit(struct pipe_context *pipe, struct pipe_resource *src_tex, diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c index cf367f5140b..c0786782ef0 100644 --- a/src/gallium/auxiliary/postprocess/pp_program.c +++ b/src/gallium/auxiliary/postprocess/pp_program.c @@ -41,7 +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, struct st_context_iface *st) + struct cso_context *cso, void *st, + void (*st_invalidate_state)(void *st, unsigned flags)) { struct pp_program *p; @@ -57,6 +58,7 @@ pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe, p->pipe = pipe; p->cso = cso; p->st = st; + p->st_invalidate_state = st_invalidate_state; { static const float verts[4][2][4] = { diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c index 93e0fa7b717..320f3c5e9dc 100644 --- a/src/gallium/auxiliary/postprocess/pp_run.c +++ b/src/gallium/auxiliary/postprocess/pp_run.c @@ -192,11 +192,11 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in, /* restore states not restored by cso */ if (ppq->p->st) { - ppq->p->st->invalidate_state(ppq->p->st, - ST_INVALIDATE_FS_SAMPLER_VIEWS | - ST_INVALIDATE_FS_CONSTBUF0 | - ST_INVALIDATE_VS_CONSTBUF0 | - ST_INVALIDATE_VERTEX_BUFFERS); + ppq->p->st_invalidate_state(ppq->p->st, + ST_INVALIDATE_FS_SAMPLER_VIEWS | + ST_INVALIDATE_FS_CONSTBUF0 | + ST_INVALIDATE_VS_CONSTBUF0 | + ST_INVALIDATE_VERTEX_BUFFERS); } pipe_resource_reference(&ppq->depth, NULL); diff --git a/src/gallium/frontends/dri/dri_context.c b/src/gallium/frontends/dri/dri_context.c index a42e8a74d26..fdc66244c05 100644 --- a/src/gallium/frontends/dri/dri_context.c +++ b/src/gallium/frontends/dri/dri_context.c @@ -201,7 +201,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); + ctx->st, (void*)ctx->st->invalidate_state); ctx->hud = hud_create(ctx->st->cso_context, share_ctx ? share_ctx->hud : NULL, ctx->st, (void*)ctx->st->invalidate_state); diff --git a/src/gallium/frontends/osmesa/osmesa.c b/src/gallium/frontends/osmesa/osmesa.c index aa342c27d0a..4f12c944f63 100644 --- a/src/gallium/frontends/osmesa/osmesa.c +++ b/src/gallium/frontends/osmesa/osmesa.c @@ -805,7 +805,8 @@ OSMesaMakeCurrent(OSMesaContext osmesa, void *buffer, GLenum type, osmesa->pp = pp_init(osmesa->stctx->pipe, osmesa->pp_enabled, osmesa->stctx->cso_context, - osmesa->stctx); + osmesa->stctx, + (void*)osmesa->stctx->invalidate_state); pp_init_fbos(osmesa->pp, width, height); } diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp index c156e6eb308..39cee4705f1 100644 --- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp +++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp @@ -221,7 +221,8 @@ GalliumContext::CreateContext(HGLWinsysContext *wsContext) // 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->iface); + stContext->cso_context, &stContext->iface, + (void*)stContext->iface.invalidate_state); context_id contextNext = -1; Lock();