From: Timothy Arceri Date: Wed, 7 Jun 2017 03:26:16 +0000 (+1000) Subject: mesa: inline vbo_exec_invalidate_state() and call from mesa core X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bc70bad59bde311434349bbe07b7fb1d3b0ec559;p=mesa.git mesa: inline vbo_exec_invalidate_state() and call from mesa core Rather than calling it indirectly in each driver. Reviewed-by: Samuel Pitoiset Reviewed-by: Brian Paul Reviewed-by: Marek Olšák --- diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 1406b65b654..4d89af182d5 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -58,7 +58,6 @@ i915InvalidateState(struct gl_context * ctx) _swrast_InvalidateState(ctx, new_state); _swsetup_InvalidateState(ctx, new_state); - _vbo_InvalidateState(ctx, new_state); _tnl_InvalidateState(ctx, new_state); _tnl_invalidate_vertex_state(ctx, new_state); intel_context(ctx)->NewGLState |= new_state; diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index 6c59b425a91..7f3924573f9 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -321,7 +321,6 @@ intelInvalidateState(struct gl_context * ctx) if (ctx->swrast_context) _swrast_InvalidateState(ctx, new_state); - _vbo_InvalidateState(ctx, new_state); intel->NewGLState |= new_state; diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 81166450b90..6d27866fcea 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -196,7 +196,6 @@ intel_update_state(struct gl_context * ctx) if (ctx->swrast_context) _swrast_InvalidateState(ctx, new_state); - _vbo_InvalidateState(ctx, new_state); brw->NewGLState |= new_state; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c index 567f32fa431..6d998fca832 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_state.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c @@ -494,7 +494,6 @@ nouveau_update_state(struct gl_context *ctx) _swrast_InvalidateState(ctx, new_state); _tnl_InvalidateState(ctx, new_state); - _vbo_InvalidateState(ctx, new_state); nouveau_state_emit(ctx); } diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index d5a6f091749..30437e3201a 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -2284,7 +2284,6 @@ static void r200InvalidateState(struct gl_context *ctx) _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); - _vbo_InvalidateState( ctx, new_state ); _tnl_InvalidateState( ctx, new_state ); R200_CONTEXT(ctx)->radeon.NewGLState |= new_state; diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index ff2a7089dd2..940f8de3b48 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -2050,7 +2050,6 @@ static void radeonInvalidateState(struct gl_context *ctx) _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); - _vbo_InvalidateState( ctx, new_state ); _tnl_InvalidateState( ctx, new_state ); R100_CONTEXT(ctx)->radeon.NewGLState |= new_state; } diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index a68f7a0b96a..3b1de420f6d 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -704,7 +704,6 @@ update_state(struct gl_context *ctx) /* not much to do here - pass it on */ _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); - _vbo_InvalidateState( ctx, new_state ); _tnl_InvalidateState( ctx, new_state ); } diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index ed69353743a..c77dcc4d372 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -123,7 +123,6 @@ osmesa_update_state(struct gl_context *ctx, GLuint new_state) _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); _tnl_InvalidateState( ctx, new_state ); - _vbo_InvalidateState( ctx, new_state ); } static void diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index e06831ca777..61aa6c88aa3 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -689,7 +689,6 @@ xmesa_update_state(struct gl_context *ctx) */ _swrast_InvalidateState( ctx, new_state ); _tnl_InvalidateState( ctx, new_state ); - _vbo_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); if (_mesa_is_user_fbo(ctx->DrawBuffer)) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 04dafa983c5..b7e165fab62 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -51,6 +51,7 @@ #include "texobj.h" #include "texstate.h" #include "varray.h" +#include "vbo/vbo_context.h" #include "viewport.h" #include "blend.h" @@ -410,13 +411,15 @@ _mesa_update_state_locked( struct gl_context *ctx ) out: new_prog_state |= update_program_constants(ctx); + ctx->NewState |= new_prog_state; + vbo_exec_invalidate_state(ctx); + /* * Give the driver a chance to act upon the new_state flags. * The driver might plug in different span functions, for example. * Also, this is where the driver can invalidate the state of any * active modules (such as swrast_setup, swrast, tnl, etc). */ - ctx->NewState |= new_prog_state; ctx->Driver.UpdateState(ctx); ctx->NewState = 0; ctx->Array.VAO->NewArrays = 0x0; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 0e768ea9e44..743c7bde280 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -279,11 +279,6 @@ st_invalidate_state(struct gl_context * ctx) if (new_state & _NEW_PROGRAM_CONSTANTS) st->dirty |= st->active_states & ST_NEW_CONSTANTS; - - /* This is the only core Mesa module we depend upon. - * No longer use swrast, swsetup, tnl. - */ - _vbo_InvalidateState(ctx, new_state); } diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h index 79f75386f72..eec484b3767 100644 --- a/src/mesa/vbo/vbo.h +++ b/src/mesa/vbo/vbo.h @@ -78,7 +78,6 @@ struct _mesa_index_buffer { GLboolean _vbo_CreateContext( struct gl_context *ctx ); void _vbo_DestroyContext( struct gl_context *ctx ); -void _vbo_InvalidateState( struct gl_context *ctx, GLbitfield new_state ); void diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 384e40516c8..a5f915d9bdb 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -227,12 +227,6 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx ) } -void _vbo_InvalidateState( struct gl_context *ctx, GLbitfield new_state ) -{ - vbo_exec_invalidate_state(ctx, new_state); -} - - void _vbo_DestroyContext( struct gl_context *ctx ) { struct vbo_context *vbo = vbo_context(ctx); diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index 5cf399ffcd7..0418643f8f4 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -56,6 +56,7 @@ #include "vbo_exec.h" #include "vbo_save.h" +#include "main/api_arrayelt.h" #include "main/macros.h" #ifdef __cplusplus @@ -91,6 +92,23 @@ static inline struct vbo_context *vbo_context(struct gl_context *ctx) } +static inline void +vbo_exec_invalidate_state(struct gl_context *ctx) +{ + struct vbo_context *vbo = vbo_context(ctx); + struct vbo_exec_context *exec = &vbo->exec; + + if (!exec->validating && ctx->NewState & (_NEW_PROGRAM | _NEW_ARRAY)) { + exec->array.recalculate_inputs = GL_TRUE; + } + + if (ctx->NewState & _NEW_EVAL) + exec->eval.recalculate_maps = GL_TRUE; + + _ae_invalidate_state(ctx, ctx->NewState); +} + + /** * Return VP_x token to indicate whether we're running fixed-function * vertex transformation, an NV vertex program or ARB vertex program/shader. diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c index de8461f1fcc..dc26dfd37b4 100644 --- a/src/mesa/vbo/vbo_exec.c +++ b/src/mesa/vbo/vbo_exec.c @@ -26,7 +26,6 @@ */ -#include "main/api_arrayelt.h" #include "main/glheader.h" #include "main/mtypes.h" #include "main/vtxfmt.h" @@ -70,27 +69,6 @@ void vbo_exec_destroy( struct gl_context *ctx ) } -/** - * Really want to install these callbacks to a central facility to be - * invoked according to the state flags. That will have to wait for a - * mesa rework: - */ -void vbo_exec_invalidate_state( struct gl_context *ctx, GLbitfield new_state ) -{ - struct vbo_context *vbo = vbo_context(ctx); - struct vbo_exec_context *exec = &vbo->exec; - - if (!exec->validating && new_state & (_NEW_PROGRAM|_NEW_ARRAY)) { - exec->array.recalculate_inputs = GL_TRUE; - } - - if (new_state & _NEW_EVAL) - exec->eval.recalculate_maps = GL_TRUE; - - _ae_invalidate_state(ctx, new_state); -} - - /** * Figure out the number of transform feedback primitives that will be output * considering the drawing mode, number of vertices, and instance count, diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h index 9358ca2acf1..f1e3881b1f9 100644 --- a/src/mesa/vbo/vbo_exec.h +++ b/src/mesa/vbo/vbo_exec.h @@ -147,7 +147,6 @@ struct vbo_exec_context */ void vbo_exec_init( struct gl_context *ctx ); void vbo_exec_destroy( struct gl_context *ctx ); -void vbo_exec_invalidate_state( struct gl_context *ctx, GLbitfield new_state ); /* Internal functions: