pipeline: only maintain breadcrumb for debug builds

This ensures we only add a static_breadcrumb pointer to every
CoglPipeline when build with debugging enabled. Since applications may
allocate a lot of pipelines we want to keep the basic size of pipelines
(ignoring optional sparse state) down to a minimum.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 4716312e14bc253cd174a22b3db9d2c9cf031fa1)
This commit is contained in:
Robert Bragg 2013-05-30 15:42:35 +01:00
parent d264b30090
commit 2d24248a3c
3 changed files with 18 additions and 1 deletions

View File

@ -158,7 +158,12 @@ dump_pipeline_cb (CoglNode *node, void *user_data)
pipeline,
COGL_OBJECT (pipeline)->ref_count,
pipeline->has_static_breadcrumb ?
pipeline->static_breadcrumb : "NULL");
#ifdef COGL_DEBUG_ENABLED
pipeline->static_breadcrumb : "NULL"
#else
"NULL"
#endif
);
changes_label = g_string_new ("");
g_string_append_printf (changes_label,

View File

@ -424,10 +424,12 @@ struct _CoglPipeline
* be allocated dynamically when required... */
CoglPipelineBigState *big_state;
#ifdef COGL_DEBUG_ENABLED
/* For debugging purposes it's possible to associate a static const
* string with a pipeline which can be an aid when trying to trace
* where the pipeline originates from */
const char *static_breadcrumb;
#endif
/* Cached state... */
@ -486,10 +488,12 @@ struct _CoglPipeline
unsigned int layers_cache_dirty:1;
unsigned int deprecated_get_layers_list_dirty:1;
#ifdef COGL_DEBUG_ENABLED
/* For debugging purposes it's possible to associate a static const
* string with a pipeline which can be an aid when trying to trace
* where the pipeline originates from */
unsigned int has_static_breadcrumb:1;
#endif
/* There are multiple fragment and vertex processing backends for
* CoglPipeline, glsl, arbfp and fixed that are bundled under a
@ -900,9 +904,11 @@ _cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline,
CoglBool
_cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline);
#ifdef COGL_DEBUG_ENABLED
void
_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
const char *breadcrumb);
#endif
unsigned long
_cogl_pipeline_get_age (CoglPipeline *pipeline);

View File

@ -423,7 +423,9 @@ cogl_pipeline_new (CoglContext *context)
CoglPipeline *new;
new = cogl_pipeline_copy (context->default_pipeline);
#ifdef COGL_DEBUG_ENABLED
_cogl_pipeline_set_static_breadcrumb (new, "new");
#endif
return new;
}
@ -1364,8 +1366,10 @@ _cogl_pipeline_pre_change_notify (CoglPipeline *pipeline,
new_authority =
cogl_pipeline_copy (_cogl_pipeline_get_parent (pipeline));
#ifdef COGL_DEBUG_ENABLED
_cogl_pipeline_set_static_breadcrumb (new_authority,
"pre_change_notify:copy-on-write");
#endif
/* We could explicitly walk the descendants, OR together the set
* of differences that we determine this pipeline is the
@ -2579,6 +2583,7 @@ _cogl_pipeline_journal_unref (CoglPipeline *pipeline)
cogl_object_unref (pipeline);
}
#ifdef COGL_DEBUG_ENABLED
void
_cogl_pipeline_apply_legacy_state (CoglPipeline *pipeline)
{
@ -2620,6 +2625,7 @@ _cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
pipeline->has_static_breadcrumb = TRUE;
pipeline->static_breadcrumb = breadcrumb;
}
#endif
typedef void (*LayerStateHashFunction) (CoglPipelineLayer *authority,
CoglPipelineLayer **authorities,