pipeline: remove layer->backend_priv[] array
authorRobert Bragg <robert@linux.intel.com>
Wed, 1 Dec 2010 16:53:08 +0000 (16:53 +0000)
committerRobert Bragg <robert@linux.intel.com>
Tue, 7 Dec 2010 12:16:51 +0000 (12:16 +0000)
This removes the unused array of per-packend priv data pointers
associated with every CoglPipelineLayer. This reduces the size of all
layer allocations and avoids having to zero an array for each
_cogl_pipeline_layer_copy.

clutter/cogl/cogl/cogl-pipeline-arbfp.c
clutter/cogl/cogl/cogl-pipeline-glsl.c
clutter/cogl/cogl/cogl-pipeline-private.h
clutter/cogl/cogl/cogl-pipeline.c

index 6a39ab6..1e558c9 100644 (file)
@@ -999,7 +999,6 @@ const CoglPipelineBackend _cogl_pipeline_arbfp_backend =
   NULL,
   _cogl_pipeline_backend_arbfp_layer_pre_change_notify,
   _cogl_pipeline_backend_arbfp_free_priv,
-  NULL
 };
 
 #endif /* COGL_PIPELINE_BACKEND_ARBFP */
index 6f10ddb..0531e42 100644 (file)
@@ -1256,8 +1256,7 @@ const CoglPipelineBackend _cogl_pipeline_glsl_backend =
   _cogl_pipeline_backend_glsl_pre_change_notify,
   NULL, /* pipeline_set_parent_notify */
   _cogl_pipeline_backend_glsl_layer_pre_change_notify,
-  _cogl_pipeline_backend_glsl_free_priv,
-  NULL /* free_layer_priv */
+  _cogl_pipeline_backend_glsl_free_priv
 };
 
 #endif /* COGL_PIPELINE_BACKEND_GLSL */
index 0e3b6c9..9e047e4 100644 (file)
@@ -221,14 +221,6 @@ struct _CoglPipelineLayer
   /* The lowest index is blended first then others on top */
   int               index;
 
-  /* Different pipeline backends (GLSL/ARBfp/Fixed Function) may
-   * want to associate private data with a layer...
-   *
-   * NB: we have per backend pointers because a layer may be
-   * associated with multiple pipelines with different backends.
-   */
-  void              *backend_priv[COGL_PIPELINE_N_BACKENDS];
-
   /* A mask of which state groups are different in this layer
    * in comparison to its parent. */
   unsigned long             differences;
@@ -585,7 +577,6 @@ typedef struct _CoglPipelineBackend
                                    CoglPipelineLayerState change);
 
   void (*free_priv) (CoglPipeline *pipeline);
-  void (*free_layer_priv) (CoglPipelineLayer *layer);
 } CoglPipelineBackend;
 
 typedef enum
index 0362b59..146bc47 100644 (file)
@@ -4478,7 +4478,6 @@ static CoglPipelineLayer *
 _cogl_pipeline_layer_copy (CoglPipelineLayer *src)
 {
   CoglPipelineLayer *layer = g_slice_new (CoglPipelineLayer);
-  int i;
 
   _cogl_pipeline_node_init (COGL_PIPELINE_NODE (layer));
 
@@ -4487,9 +4486,6 @@ _cogl_pipeline_layer_copy (CoglPipelineLayer *src)
   layer->differences = 0;
   layer->has_big_state = FALSE;
 
-  for (i = 0; i < COGL_PIPELINE_N_BACKENDS; i++)
-    layer->backend_priv[i] = NULL;
-
   _cogl_pipeline_layer_set_parent (layer, src);
 
   return _cogl_pipeline_layer_object_new (layer);
@@ -4498,24 +4494,8 @@ _cogl_pipeline_layer_copy (CoglPipelineLayer *src)
 static void
 _cogl_pipeline_layer_free (CoglPipelineLayer *layer)
 {
-  int i;
-
   _cogl_pipeline_layer_unparent (COGL_PIPELINE_NODE (layer));
 
-  /* NB: layers may be used by multiple pipelines which may be using
-   * different backends, therefore we determine which backends to
-   * notify based on the private state pointers for each backend...
-   */
-  for (i = 0; i < COGL_PIPELINE_N_BACKENDS; i++)
-    {
-      if (layer->backend_priv[i] &&
-          _cogl_pipeline_backends[i]->free_layer_priv)
-        {
-          const CoglPipelineBackend *backend = _cogl_pipeline_backends[i];
-          backend->free_layer_priv (layer);
-        }
-    }
-
   if (layer->differences & COGL_PIPELINE_LAYER_STATE_TEXTURE &&
       layer->texture != COGL_INVALID_HANDLE)
     cogl_handle_unref (layer->texture);
@@ -4561,7 +4541,6 @@ _cogl_pipeline_init_default_layers (void)
   CoglPipelineLayerBigState *big_state =
     g_slice_new0 (CoglPipelineLayerBigState);
   CoglPipelineLayer *new;
-  int i;
 
   _COGL_GET_CONTEXT (ctx, NO_RETVAL);
 
@@ -4569,9 +4548,6 @@ _cogl_pipeline_init_default_layers (void)
 
   layer->index = 0;
 
-  for (i = 0; i < COGL_PIPELINE_N_BACKENDS; i++)
-    layer->backend_priv[i] = NULL;
-
   layer->differences = COGL_PIPELINE_LAYER_STATE_ALL_SPARSE;
 
   layer->unit_index = 0;