[Mesa-dev] [PATCH] st/mesa: call check_program_state only when needed
Nicolai Hähnle
nhaehnle at gmail.com
Mon Jun 12 09:02:30 UTC 2017
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
On 09.06.2017 15:48, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
> src/mesa/state_tracker/st_atom.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
> index cbac762..bcfbcf8 100644
> --- a/src/mesa/state_tracker/st_atom.c
> +++ b/src/mesa/state_tracker/st_atom.c
> @@ -109,21 +109,20 @@ static void check_program_state( struct st_context *st )
> }
>
> if (unlikely(new_fp != &old_fp->Base)) {
> if (old_fp)
> dirty |= old_fp->affected_states;
> if (new_fp)
> dirty |= st_fragment_program(new_fp)->affected_states;
> }
>
> st->dirty |= dirty;
> - st->gfx_shaders_may_be_dirty = false;
> }
>
> static void check_attrib_edgeflag(struct st_context *st)
> {
> const struct gl_vertex_array **arrays = st->ctx->Array._DrawArrays;
> GLboolean vertdata_edgeflags, edgeflag_culls_prims, edgeflags_enabled;
> struct gl_program *vp = st->ctx->VertexProgram._Current;
>
> if (!arrays)
> return;
> @@ -164,21 +163,25 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
> */
> st->dirty |= ctx->NewDriverState & st->active_states & ST_ALL_STATES_MASK;
> ctx->NewDriverState = 0;
>
> /* Get pipeline state. */
> switch (pipeline) {
> case ST_PIPELINE_RENDER:
> if (st->ctx->API == API_OPENGL_COMPAT)
> check_attrib_edgeflag(st);
>
> - check_program_state(st);
> + if (st->gfx_shaders_may_be_dirty) {
> + check_program_state(st);
> + st->gfx_shaders_may_be_dirty = false;
> + }
> +
> st_manager_validate_framebuffers(st);
>
> pipeline_mask = ST_PIPELINE_RENDER_STATE_MASK;
> break;
>
> case ST_PIPELINE_CLEAR:
> st_manager_validate_framebuffers(st);
> pipeline_mask = ST_PIPELINE_CLEAR_STATE_MASK;
> break;
>
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list