st/mesa: don't update clip state if it has no effect
authorMarek Olšák <marek.olsak@amd.com>
Tue, 2 Aug 2016 13:17:27 +0000 (15:17 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 12 Aug 2016 16:47:24 +0000 (18:47 +0200)
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/mesa/state_tracker/st_atom.c
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_context.h

index 06c523e8b8eb3cca135695d3cd5be56a53c8538f..b73ae32d8d74a38e678752ff51ee2028ebf4ea50 100644 (file)
@@ -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)
index e4dd6fa897ceb332027a8f98ac7a6932fb0a4be1..1ff035586c393d890399d1a06260bd30e1e9e13d 100644 (file)
@@ -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)
index e0f29e3cebfe4bc05ce3945ca3352dab50675875..556b9c99a23a0f6762d4e11eebe5369ae5611611 100644 (file)
@@ -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))