diff --git a/src/gallium/include/frontend/api.h b/src/gallium/include/frontend/api.h index b0cafc7073c..70afed3499a 100644 --- a/src/gallium/include/frontend/api.h +++ b/src/gallium/include/frontend/api.h @@ -146,6 +146,15 @@ enum st_attachment_type { #define ST_FLUSH_WAIT (1 << 2) #define ST_FLUSH_FENCE_FD (1 << 3) +/** + * State invalidation flags to notify frontends that states have been changed + * behind their back. + */ +#define ST_INVALIDATE_FS_SAMPLER_VIEWS (1 << 0) +#define ST_INVALIDATE_FS_CONSTBUF0 (1 << 1) +#define ST_INVALIDATE_VS_CONSTBUF0 (1 << 2) +#define ST_INVALIDATE_VERTEX_BUFFERS (1 << 3) + /** * Value to st_manager->get_param function. */ @@ -430,6 +439,12 @@ struct st_context_iface * Called from the main thread. */ void (*thread_finish)(struct st_context_iface *stctxi); + + /** + * Invalidate states to notify the frontend that states have been changed + * behind its back. + */ + void (*invalidate_state)(struct st_context_iface *stctxi, unsigned flags); }; diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index ea3d5207ffd..42c3947b7af 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -833,6 +833,23 @@ st_thread_finish(struct st_context_iface *stctxi) } +static void +st_context_invalidate_state(struct st_context_iface *stctxi, + unsigned flags) +{ + struct st_context *st = (struct st_context *) stctxi; + + if (flags & ST_INVALIDATE_FS_SAMPLER_VIEWS) + st->dirty |= ST_NEW_FS_SAMPLER_VIEWS; + if (flags & ST_INVALIDATE_FS_CONSTBUF0) + st->dirty |= ST_NEW_FS_CONSTANTS; + if (flags & ST_INVALIDATE_VS_CONSTBUF0) + st->dirty |= ST_NEW_VS_CONSTANTS; + if (flags & ST_INVALIDATE_VERTEX_BUFFERS) + st->dirty |= ST_NEW_VERTEX_ARRAYS; +} + + static void st_manager_destroy(struct st_manager *smapi) { @@ -985,6 +1002,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, st->iface.share = st_context_share; st->iface.start_thread = st_start_thread; st->iface.thread_finish = st_thread_finish; + st->iface.invalidate_state = st_context_invalidate_state; st->iface.st_context_private = (void *) smapi; st->iface.cso_context = st->cso_context; st->iface.pipe = st->pipe;