Mesa (master): st/mesa: don' t update clip state on VS changes if it has no effect

Marek Olšák mareko at kemper.freedesktop.org
Fri Aug 12 17:07:44 UTC 2016


Module: Mesa
Branch: master
Commit: 0be30ea1a87532650d930f76493902217f96955c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0be30ea1a87532650d930f76493902217f96955c

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Tue Aug  2 15:26:19 2016 +0200

st/mesa: don't update clip state on VS changes if it has no effect

Tested-by: Edmondo Tommasina <edmondo.tommasina at gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/mesa/state_tracker/st_atom.c        |  4 ++--
 src/mesa/state_tracker/st_atom.h        | 23 ++++++++++++-----------
 src/mesa/state_tracker/st_cb_feedback.c |  2 +-
 src/mesa/state_tracker/st_cb_program.c  |  2 +-
 4 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index b73ae32..7548a29 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -65,7 +65,7 @@ static void check_program_state( struct st_context *st )
    struct gl_context *ctx = st->ctx;
 
    if (ctx->VertexProgram._Current != &st->vp->Base)
-      st->dirty |= ST_NEW_VERTEX_PROGRAM;
+      st->dirty |= ST_NEW_VERTEX_PROGRAM(st);
 
    if (ctx->FragmentProgram._Current != &st->fp->Base)
       st->dirty |= ST_NEW_FRAGMENT_PROGRAM;
@@ -97,7 +97,7 @@ static void check_attrib_edgeflag(struct st_context *st)
                         arrays[VERT_ATTRIB_EDGEFLAG]->StrideB != 0;
    if (vertdata_edgeflags != st->vertdata_edgeflags) {
       st->vertdata_edgeflags = vertdata_edgeflags;
-      st->dirty |= ST_NEW_VERTEX_PROGRAM;
+      st->dirty |= ST_NEW_VERTEX_PROGRAM(st);
    }
 
    edgeflag_culls_prims = edgeflags_enabled && !vertdata_edgeflags &&
diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h
index 971ea35..cce9910 100644
--- a/src/mesa/state_tracker/st_atom.h
+++ b/src/mesa/state_tracker/st_atom.h
@@ -88,17 +88,18 @@ enum {
                                  ST_NEW_SAMPLE_MASK | \
                                  ST_NEW_SAMPLE_SHADING)
 
-#define ST_NEW_VERTEX_PROGRAM   (ST_NEW_VS_STATE | \
-                                 ST_NEW_VS_SAMPLER_VIEWS | \
-                                 ST_NEW_VS_IMAGES | \
-                                 ST_NEW_VS_CONSTANTS | \
-                                 ST_NEW_VS_UBOS | \
-                                 ST_NEW_VS_ATOMICS | \
-                                 ST_NEW_VS_SSBOS | \
-                                 ST_NEW_VERTEX_ARRAYS | \
-                                 ST_NEW_CLIP_STATE | \
-                                 ST_NEW_RASTERIZER | \
-                                 ST_NEW_RENDER_SAMPLERS)
+#define ST_NEW_VERTEX_PROGRAM(st) (ST_NEW_VS_STATE | \
+                                   ST_NEW_VS_SAMPLER_VIEWS | \
+                                   ST_NEW_VS_IMAGES | \
+                                   ST_NEW_VS_CONSTANTS | \
+                                   ST_NEW_VS_UBOS | \
+                                   ST_NEW_VS_ATOMICS | \
+                                   ST_NEW_VS_SSBOS | \
+                                   ST_NEW_VERTEX_ARRAYS | \
+                                   (st_user_clip_planes_enabled(st->ctx) ? \
+                                    ST_NEW_CLIP_STATE : 0) | \
+                                   ST_NEW_RASTERIZER | \
+                                   ST_NEW_RENDER_SAMPLERS)
 
 #define ST_NEW_TCS_RESOURCES    (ST_NEW_TCS_SAMPLER_VIEWS | \
                                  ST_NEW_TCS_IMAGES | \
diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c
index a18f4f7..db682cc 100644
--- a/src/mesa/state_tracker/st_cb_feedback.c
+++ b/src/mesa/state_tracker/st_cb_feedback.c
@@ -297,7 +297,7 @@ st_RenderMode(struct gl_context *ctx, GLenum newMode )
       /* Plug in new vbo draw function */
       vbo_set_draw_func(ctx, st_feedback_draw_vbo);
       /* need to generate/use a vertex program that emits pos/color/tex */
-      st->dirty |= ST_NEW_VERTEX_PROGRAM;
+      st->dirty |= ST_NEW_VERTEX_PROGRAM(st);
    }
 }
 
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 8291edb..1783a1c 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -215,7 +215,7 @@ st_program_string_notify( struct gl_context *ctx,
          return false;
 
       if (st->vp == stvp)
-	 st->dirty |= ST_NEW_VERTEX_PROGRAM;
+	 st->dirty |= ST_NEW_VERTEX_PROGRAM(st);
    }
    else if (target == GL_TESS_CONTROL_PROGRAM_NV) {
       struct st_tessctrl_program *sttcp =




More information about the mesa-commit mailing list