[mutter] cogl: Remove unused COGL_PIPELINE_STATE_LIGHTING



commit 711023ea93e9a71ebecd0b2efd5a143696bdbcd7
Author: Adam Jackson <ajax redhat com>
Date:   Tue Oct 29 14:36:10 2019 -0400

    cogl: Remove unused COGL_PIPELINE_STATE_LIGHTING
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/904

 cogl/cogl/cogl-pipeline-private.h          |  8 +----
 cogl/cogl/cogl-pipeline-state-private.h    |  8 -----
 cogl/cogl/cogl-pipeline-state.c            | 32 -------------------
 cogl/cogl/cogl-pipeline.c                  | 49 +-----------------------------
 cogl/cogl/driver/gl/cogl-pipeline-opengl.c | 22 --------------
 5 files changed, 2 insertions(+), 117 deletions(-)
---
diff --git a/cogl/cogl/cogl-pipeline-private.h b/cogl/cogl/cogl-pipeline-private.h
index 533e003f4..09f1af549 100644
--- a/cogl/cogl/cogl-pipeline-private.h
+++ b/cogl/cogl/cogl-pipeline-private.h
@@ -77,7 +77,6 @@ typedef enum
   COGL_PIPELINE_STATE_COLOR_INDEX,
   COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX,
   COGL_PIPELINE_STATE_LAYERS_INDEX,
-  COGL_PIPELINE_STATE_LIGHTING_INDEX,
   COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX,
   COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX,
   COGL_PIPELINE_STATE_BLEND_INDEX,
@@ -118,8 +117,6 @@ typedef enum _CoglPipelineState
   COGL_PIPELINE_STATE_LAYERS =
     1L<<COGL_PIPELINE_STATE_LAYERS_INDEX,
 
-  COGL_PIPELINE_STATE_LIGHTING =
-    1L<<COGL_PIPELINE_STATE_LIGHTING_INDEX,
   COGL_PIPELINE_STATE_ALPHA_FUNC =
     1L<<COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX,
   COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE =
@@ -165,15 +162,13 @@ typedef enum _CoglPipelineState
   (COGL_PIPELINE_STATE_COLOR | \
    COGL_PIPELINE_STATE_BLEND_ENABLE | \
    COGL_PIPELINE_STATE_LAYERS | \
-   COGL_PIPELINE_STATE_LIGHTING | \
    COGL_PIPELINE_STATE_BLEND | \
    COGL_PIPELINE_STATE_USER_SHADER | \
    COGL_PIPELINE_STATE_VERTEX_SNIPPETS | \
    COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS)
 
 #define COGL_PIPELINE_STATE_NEEDS_BIG_STATE \
-  (COGL_PIPELINE_STATE_LIGHTING | \
-   COGL_PIPELINE_STATE_ALPHA_FUNC | \
+  (COGL_PIPELINE_STATE_ALPHA_FUNC | \
    COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE | \
    COGL_PIPELINE_STATE_BLEND | \
    COGL_PIPELINE_STATE_USER_SHADER | \
@@ -188,7 +183,6 @@ typedef enum _CoglPipelineState
 
 #define COGL_PIPELINE_STATE_MULTI_PROPERTY \
   (COGL_PIPELINE_STATE_LAYERS | \
-   COGL_PIPELINE_STATE_LIGHTING | \
    COGL_PIPELINE_STATE_BLEND | \
    COGL_PIPELINE_STATE_DEPTH | \
    COGL_PIPELINE_STATE_CULL_FACE | \
diff --git a/cogl/cogl/cogl-pipeline-state-private.h b/cogl/cogl/cogl-pipeline-state-private.h
index a1de37d42..21e1b5e55 100644
--- a/cogl/cogl/cogl-pipeline-state-private.h
+++ b/cogl/cogl/cogl-pipeline-state-private.h
@@ -53,10 +53,6 @@ gboolean
 _cogl_pipeline_color_equal (CoglPipeline *authority0,
                             CoglPipeline *authority1);
 
-gboolean
-_cogl_pipeline_lighting_state_equal (CoglPipeline *authority0,
-                                     CoglPipeline *authority1);
-
 gboolean
 _cogl_pipeline_alpha_func_state_equal (CoglPipeline *authority0,
                                        CoglPipeline *authority1);
@@ -120,10 +116,6 @@ void
 _cogl_pipeline_hash_layers_state (CoglPipeline *authority,
                                   CoglPipelineHashState *state);
 
-void
-_cogl_pipeline_hash_lighting_state (CoglPipeline *authority,
-                                    CoglPipelineHashState *state);
-
 void
 _cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority,
                                       CoglPipelineHashState *state);
diff --git a/cogl/cogl/cogl-pipeline-state.c b/cogl/cogl/cogl-pipeline-state.c
index 9841d9c0c..c17440979 100644
--- a/cogl/cogl/cogl-pipeline-state.c
+++ b/cogl/cogl/cogl-pipeline-state.c
@@ -69,27 +69,6 @@ _cogl_pipeline_color_equal (CoglPipeline *authority0,
   return cogl_color_equal (&authority0->color, &authority1->color);
 }
 
-gboolean
-_cogl_pipeline_lighting_state_equal (CoglPipeline *authority0,
-                                     CoglPipeline *authority1)
-{
-  CoglPipelineLightingState *state0 = &authority0->big_state->lighting_state;
-  CoglPipelineLightingState *state1 = &authority1->big_state->lighting_state;
-
-  if (memcmp (state0->ambient, state1->ambient, sizeof (float) * 4) != 0)
-    return FALSE;
-  if (memcmp (state0->diffuse, state1->diffuse, sizeof (float) * 4) != 0)
-    return FALSE;
-  if (memcmp (state0->specular, state1->specular, sizeof (float) * 4) != 0)
-    return FALSE;
-  if (memcmp (state0->emission, state1->emission, sizeof (float) * 4) != 0)
-    return FALSE;
-  if (state0->shininess != state1->shininess)
-    return FALSE;
-
-  return TRUE;
-}
-
 gboolean
 _cogl_pipeline_alpha_func_state_equal (CoglPipeline *authority0,
                                        CoglPipeline *authority1)
@@ -1411,17 +1390,6 @@ _cogl_pipeline_hash_blend_enable_state (CoglPipeline *authority,
   state->hash = _cogl_util_one_at_a_time_hash (state->hash, &blend_enable, 1);
 }
 
-void
-_cogl_pipeline_hash_lighting_state (CoglPipeline *authority,
-                                    CoglPipelineHashState *state)
-{
-  CoglPipelineLightingState *lighting_state =
-    &authority->big_state->lighting_state;
-  state->hash =
-    _cogl_util_one_at_a_time_hash (state->hash, lighting_state,
-                                   sizeof (CoglPipelineLightingState));
-}
-
 void
 _cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority,
                                       CoglPipelineHashState *state)
diff --git a/cogl/cogl/cogl-pipeline.c b/cogl/cogl/cogl-pipeline.c
index a79993d20..4bae0d560 100644
--- a/cogl/cogl/cogl-pipeline.c
+++ b/cogl/cogl/cogl-pipeline.c
@@ -764,32 +764,6 @@ _cogl_pipeline_change_implies_transparency (CoglPipeline *pipeline,
         return TRUE;
     }
 
-  /* XXX: we should only need to look at these if lighting is enabled
-   */
-  if (changes & COGL_PIPELINE_STATE_LIGHTING)
-    {
-      /* XXX: This stuff is showing up in sysprof reports which is
-       * silly because lighting isn't currently actually supported
-       * by Cogl except for these token properties. When we actually
-       * expose lighting support we can avoid these checks when
-       * lighting is disabled. */
-#if 0
-      CoglColor tmp;
-      cogl_pipeline_get_ambient (pipeline, &tmp);
-      if (cogl_color_get_alpha_byte (&tmp) != 0xff)
-        return TRUE;
-      cogl_pipeline_get_diffuse (pipeline, &tmp);
-      if (cogl_color_get_alpha_byte (&tmp) != 0xff)
-        return TRUE;
-      cogl_pipeline_get_specular (pipeline, &tmp);
-      if (cogl_color_get_alpha_byte (&tmp) != 0xff)
-        return TRUE;
-      cogl_pipeline_get_emission (pipeline, &tmp);
-      if (cogl_color_get_alpha_byte (&tmp) != 0xff)
-        return TRUE;
-#endif
-    }
-
   if (changes & COGL_PIPELINE_STATE_LAYERS)
     {
       /* has_alpha tracks the alpha status of the GL_PREVIOUS layer.
@@ -963,13 +937,6 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
   else
     goto check_for_blending_change;
 
-  if (differences & COGL_PIPELINE_STATE_LIGHTING)
-    {
-      memcpy (&big_state->lighting_state,
-              &src->big_state->lighting_state,
-              sizeof (CoglPipelineLightingState));
-    }
-
   if (differences & COGL_PIPELINE_STATE_ALPHA_FUNC)
     big_state->alpha_state.alpha_func =
       src->big_state->alpha_state.alpha_func;
@@ -1095,13 +1062,6 @@ _cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline,
       pipeline->n_layers = authority->n_layers;
       pipeline->layer_differences = NULL;
       break;
-    case COGL_PIPELINE_STATE_LIGHTING:
-      {
-        memcpy (&pipeline->big_state->lighting_state,
-                &authority->big_state->lighting_state,
-                sizeof (CoglPipelineLightingState));
-        break;
-      }
     case COGL_PIPELINE_STATE_BLEND:
       {
         memcpy (&pipeline->big_state->blend_state,
@@ -2212,11 +2172,6 @@ _cogl_pipeline_equal (CoglPipeline *pipeline0,
                                  &authorities1[bit]->color))
             goto done;
           break;
-        case COGL_PIPELINE_STATE_LIGHTING_INDEX:
-          if (!_cogl_pipeline_lighting_state_equal (authorities0[bit],
-                                                    authorities1[bit]))
-            goto done;
-          break;
         case COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX:
           if (!_cogl_pipeline_alpha_func_state_equal (authorities0[bit],
                                                       authorities1[bit]))
@@ -2672,8 +2627,6 @@ _cogl_pipeline_init_state_hash_functions (void)
     _cogl_pipeline_hash_blend_enable_state;
   state_hash_functions[COGL_PIPELINE_STATE_LAYERS_INDEX] =
     _cogl_pipeline_hash_layers_state;
-  state_hash_functions[COGL_PIPELINE_STATE_LIGHTING_INDEX] =
-    _cogl_pipeline_hash_lighting_state;
   state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX] =
     _cogl_pipeline_hash_alpha_func_state;
   state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX] =
@@ -2701,7 +2654,7 @@ _cogl_pipeline_init_state_hash_functions (void)
 
   {
   /* So we get a big error if we forget to update this code! */
-  _COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 16,
+  _COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 15,
                        "Make sure to install a hash function for "
                        "newly added pipeline state and update assert "
                        "in _cogl_pipeline_init_state_hash_functions");
diff --git a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c
index ece8ada0d..6602b3bd5 100644
--- a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c
+++ b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c
@@ -546,28 +546,6 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
           GE (ctx, glAlphaFunc (alpha_state->alpha_func,
                                 alpha_state->alpha_func_reference));
         }
-
-      /* Under GLES2 the lighting parameters are implemented as uniforms
-         in the progend */
-      if (pipelines_difference & COGL_PIPELINE_STATE_LIGHTING)
-        {
-          CoglPipeline *authority =
-            _cogl_pipeline_get_authority (pipeline,
-                                          COGL_PIPELINE_STATE_LIGHTING);
-          CoglPipelineLightingState *lighting_state =
-            &authority->big_state->lighting_state;
-
-          GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT,
-                                 lighting_state->ambient));
-          GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE,
-                                 lighting_state->diffuse));
-          GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR,
-                                 lighting_state->specular));
-          GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_EMISSION,
-                                 lighting_state->emission));
-          GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_SHININESS,
-                                 &lighting_state->shininess));
-        }
     }
 
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]