Mesa (master): st/mesa: don't update clip state 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: 412bd7360c46405de3158683ce0f349126c30b77
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=412bd7360c46405de3158683ce0f349126c30b77

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

st/mesa: don't update clip state 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    | 3 ---
 src/mesa/state_tracker/st_context.c | 3 ++-
 src/mesa/state_tracker/st_context.h | 7 +++++++
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 06c523e..b73ae32 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -141,9 +141,6 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
          pipeline_mask &= ~ST_NEW_TES_RESOURCES;
       if (!ctx->GeometryProgram._Current)
          pipeline_mask &= ~ST_NEW_GS_RESOURCES;
-      if (!ctx->Transform.ClipPlanesEnabled)
-         pipeline_mask &= ~ST_NEW_CLIP_STATE;
-
       break;
    case ST_PIPELINE_COMPUTE:
       if (ctx->ComputeProgram._Current != &st->cp->Base)
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index e4dd6fa..1ff0355 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -193,7 +193,8 @@ void st_invalidate_state(struct gl_context * ctx, GLbitfield new_state)
    }
 
    if (new_state & (_NEW_PROJECTION |
-                    _NEW_TRANSFORM))
+                    _NEW_TRANSFORM) &&
+       st_user_clip_planes_enabled(ctx))
       st->dirty |= ST_NEW_CLIP_STATE;
 
    if (new_state & _NEW_COLOR)
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index e0f29e3..556b9c9 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -336,6 +336,13 @@ st_shader_stage_to_ptarget(gl_shader_stage stage)
    return PIPE_SHADER_VERTEX;
 }
 
+static inline bool
+st_user_clip_planes_enabled(struct gl_context *ctx)
+{
+   return (ctx->API == API_OPENGL_COMPAT ||
+           ctx->API == API_OPENGLES) && /* only ES 1.x */
+          ctx->Transform.ClipPlanesEnabled;
+}
 
 /** clear-alloc a struct-sized object, with casting */
 #define ST_CALLOC_STRUCT(T)   (struct T *) calloc(1, sizeof(struct T))




More information about the mesa-commit mailing list