[Mesa-dev] [PATCH 6/9] st/mesa: remove excessive shader state dirtying

Marek Olšák maraeo at gmail.com
Mon Jul 18 13:11:52 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

This just needs to be done by st_validate_state.
---
 src/mesa/state_tracker/st_atom.c       |  9 ++++++
 src/mesa/state_tracker/st_cb_program.c | 53 ----------------------------------
 2 files changed, 9 insertions(+), 53 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 77f1ec3..84c232e 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -72,6 +72,12 @@ static void check_program_state( struct st_context *st )
 
    if (ctx->GeometryProgram._Current != &st->gp->Base)
       st->dirty |= ST_NEW_GEOMETRY_PROGRAM;
+
+   if (ctx->TessCtrlProgram._Current != &st->tcp->Base)
+      st->dirty |= ST_NEW_TESSCTRL_PROGRAM;
+
+   if (ctx->TessEvalProgram._Current != &st->tep->Base)
+      st->dirty |= ST_NEW_TESSEVAL_PROGRAM;
 }
 
 static void check_attrib_edgeflag(struct st_context *st)
@@ -137,6 +143,9 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
          pipeline_mask &= ~ST_NEW_CLIP_STATE;
       break;
    case ST_PIPELINE_COMPUTE:
+      if (ctx->ComputeProgram._Current != &st->cp->Base)
+         st->dirty |= ST_NEW_COMPUTE_PROGRAM;
+
       pipeline_mask = ST_PIPELINE_COMPUTE_STATE_MASK;
       break;
    default:
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 6264896..8291edb 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -49,57 +49,6 @@
 #include "st_atifs_to_tgsi.h"
 
 
-
-/**
- * Called via ctx->Driver.BindProgram() to bind an ARB vertex or
- * fragment program.
- */
-static void
-st_bind_program(struct gl_context *ctx, GLenum target, struct gl_program *prog)
-{
-   struct st_context *st = st_context(ctx);
-
-   switch (target) {
-   case GL_VERTEX_PROGRAM_ARB: 
-      st->dirty |= ST_NEW_VERTEX_PROGRAM;
-      break;
-   case GL_FRAGMENT_PROGRAM_ARB:
-      st->dirty |= ST_NEW_FRAGMENT_PROGRAM;
-      break;
-   case GL_GEOMETRY_PROGRAM_NV:
-      st->dirty |= ST_NEW_GEOMETRY_PROGRAM;
-      break;
-   case GL_TESS_CONTROL_PROGRAM_NV:
-      st->dirty |= ST_NEW_TESSCTRL_PROGRAM;
-      break;
-   case GL_TESS_EVALUATION_PROGRAM_NV:
-      st->dirty |= ST_NEW_TESSEVAL_PROGRAM;
-      break;
-   case GL_COMPUTE_PROGRAM_NV:
-      st->dirty |= ST_NEW_COMPUTE_PROGRAM;
-      break;
-   }
-}
-
-
-/**
- * Called via ctx->Driver.UseProgram() to bind a linked GLSL program
- * (vertex shader + fragment shader).
- */
-static void
-st_use_program(struct gl_context *ctx, struct gl_shader_program *shProg)
-{
-   struct st_context *st = st_context(ctx);
-
-   st->dirty |= ST_NEW_FRAGMENT_PROGRAM;
-   st->dirty |= ST_NEW_VERTEX_PROGRAM;
-   st->dirty |= ST_NEW_GEOMETRY_PROGRAM;
-   st->dirty |= ST_NEW_TESSCTRL_PROGRAM;
-   st->dirty |= ST_NEW_TESSEVAL_PROGRAM;
-   st->dirty |= ST_NEW_COMPUTE_PROGRAM;
-}
-
-
 /**
  * Called via ctx->Driver.NewProgram() to allocate a new vertex or
  * fragment program.
@@ -347,8 +296,6 @@ st_new_ati_fs(struct gl_context *ctx, struct ati_fragment_shader *curProg)
 void
 st_init_program_functions(struct dd_function_table *functions)
 {
-   functions->BindProgram = st_bind_program;
-   functions->UseProgram = st_use_program;
    functions->NewProgram = st_new_program;
    functions->DeleteProgram = st_delete_program;
    functions->ProgramStringNotify = st_program_string_notify;
-- 
2.7.4



More information about the mesa-dev mailing list