summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2013-05-30 15:42:35 +0100
committerRobert Bragg <robert@linux.intel.com>2013-06-06 21:49:14 +0100
commit2d24248a3c3365987a08d3b15a2fbacbf1b8bc70 (patch)
tree1fd4acdce3f5e8192ca2d6d948a3669d0b56f510
parentd264b3009015d052619cf3ac561d4222d996c5c7 (diff)
downloadcogl-2d24248a3c3365987a08d3b15a2fbacbf1b8bc70.tar.gz
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)
-rw-r--r--cogl/cogl-pipeline-debug.c7
-rw-r--r--cogl/cogl-pipeline-private.h6
-rw-r--r--cogl/cogl-pipeline.c6
3 files changed, 18 insertions, 1 deletions
diff --git a/cogl/cogl-pipeline-debug.c b/cogl/cogl-pipeline-debug.c
index cd311119..afac9904 100644
--- a/cogl/cogl-pipeline-debug.c
+++ b/cogl/cogl-pipeline-debug.c
@@ -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,
diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h
index 2679fbb4..3e385f53 100644
--- a/cogl/cogl-pipeline-private.h
+++ b/cogl/cogl-pipeline-private.h
@@ -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);
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
index 6be22fba..10599668 100644
--- a/cogl/cogl-pipeline.c
+++ b/cogl/cogl-pipeline.c
@@ -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,