From ff646b7fc3e4528836f415e4087ee30c6547ad7d Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Wed, 1 Dec 2010 16:53:08 +0000 Subject: [PATCH] pipeline: remove layer->backend_priv[] array 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 | 1 - clutter/cogl/cogl/cogl-pipeline-glsl.c | 3 +-- clutter/cogl/cogl/cogl-pipeline-private.h | 9 --------- clutter/cogl/cogl/cogl-pipeline.c | 24 ------------------------ 4 files changed, 1 insertion(+), 36 deletions(-) diff --git a/clutter/cogl/cogl/cogl-pipeline-arbfp.c b/clutter/cogl/cogl/cogl-pipeline-arbfp.c index 6a39ab6..1e558c9 100644 --- a/clutter/cogl/cogl/cogl-pipeline-arbfp.c +++ b/clutter/cogl/cogl/cogl-pipeline-arbfp.c @@ -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 */ diff --git a/clutter/cogl/cogl/cogl-pipeline-glsl.c b/clutter/cogl/cogl/cogl-pipeline-glsl.c index 6f10ddb..0531e42 100644 --- a/clutter/cogl/cogl/cogl-pipeline-glsl.c +++ b/clutter/cogl/cogl/cogl-pipeline-glsl.c @@ -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 */ diff --git a/clutter/cogl/cogl/cogl-pipeline-private.h b/clutter/cogl/cogl/cogl-pipeline-private.h index 0e3b6c9..9e047e4 100644 --- a/clutter/cogl/cogl/cogl-pipeline-private.h +++ b/clutter/cogl/cogl/cogl-pipeline-private.h @@ -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 diff --git a/clutter/cogl/cogl/cogl-pipeline.c b/clutter/cogl/cogl/cogl-pipeline.c index 0362b59..146bc47 100644 --- a/clutter/cogl/cogl/cogl-pipeline.c +++ b/clutter/cogl/cogl/cogl-pipeline.c @@ -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; -- 2.7.4