pipeline: inline _get_parent and _get_authority

This moves _cogl_pipeline_get_parent and _cogl_pipeline_get_authority
into cogl-pipeline-private.h so they can be inlined since they have been
seen to get quite high in profiles. Given that they both contain such
small amounts of code the function call overhead is significant.
This commit is contained in:
Robert Bragg 2010-12-03 16:56:54 +00:00
parent e292d28c56
commit 6b08583f2f
2 changed files with 17 additions and 17 deletions

View File

@ -604,6 +604,23 @@ _cogl_pipeline_init_default_pipeline (void);
void void
_cogl_pipeline_init_default_layers (void); _cogl_pipeline_init_default_layers (void);
static inline CoglPipeline *
_cogl_pipeline_get_parent (CoglPipeline *pipeline)
{
CoglPipelineNode *parent_node = COGL_PIPELINE_NODE (pipeline)->parent;
return COGL_PIPELINE (parent_node);
}
static inline CoglPipeline *
_cogl_pipeline_get_authority (CoglPipeline *pipeline,
unsigned long difference)
{
CoglPipeline *authority = pipeline;
while (!(authority->differences & difference))
authority = _cogl_pipeline_get_parent (authority);
return authority;
}
/* /*
* SECTION:cogl-pipeline-internals * SECTION:cogl-pipeline-internals
* @short_description: Functions for creating custom primitives that make use * @short_description: Functions for creating custom primitives that make use

View File

@ -551,23 +551,6 @@ _cogl_pipeline_get_real_blend_enabled (CoglPipeline *pipeline)
return pipeline->real_blend_enable; return pipeline->real_blend_enable;
} }
inline CoglPipeline *
_cogl_pipeline_get_parent (CoglPipeline *pipeline)
{
CoglPipelineNode *parent_node = COGL_PIPELINE_NODE (pipeline)->parent;
return COGL_PIPELINE (parent_node);
}
CoglPipeline *
_cogl_pipeline_get_authority (CoglPipeline *pipeline,
unsigned long difference)
{
CoglPipeline *authority = pipeline;
while (!(authority->differences & difference))
authority = _cogl_pipeline_get_parent (authority);
return authority;
}
/* XXX: Think twice before making this non static since it is used /* XXX: Think twice before making this non static since it is used
* heavily and we expect the compiler to inline it... * heavily and we expect the compiler to inline it...
*/ */