diff options
author | Robert Bragg <robert@linux.intel.com> | 2011-09-20 20:46:38 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2011-09-21 17:28:22 +0100 |
commit | f16d3756dfafa63521954842c8365e8862bfd126 (patch) | |
tree | a0a908c4ae5f4c4dbbf4a72f1458c75124ad4370 /cogl/cogl-pipeline.c | |
parent | d4459e2d421ca348a149117805e793f0b7975c99 (diff) | |
download | cogl-f16d3756dfafa63521954842c8365e8862bfd126.tar.gz |
pipeline: lazily get ctx in _get_layer
We only need a ctx pointer if we need to refer to the default_layer_x
layers to copy as templates so only call _cogl_context_get_default()
once we need to copy a template. _cogl_context_get_default() was
starting to show up in profiles and this was the main cause.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Diffstat (limited to 'cogl/cogl-pipeline.c')
-rw-r--r-- | cogl/cogl-pipeline.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c index 0466740d..140a488b 100644 --- a/cogl/cogl-pipeline.c +++ b/cogl/cogl-pipeline.c @@ -1615,8 +1615,7 @@ _cogl_pipeline_get_layer (CoglPipeline *pipeline, CoglPipelineLayer *layer; int unit_index; int i; - - _COGL_GET_CONTEXT (ctx, NULL); + CoglContext *ctx; /* The layer index of the layer we want info about */ layer_info.layer_index = layer_index; @@ -1645,6 +1644,8 @@ _cogl_pipeline_get_layer (CoglPipeline *pipeline, if (layer_info.layer) return layer_info.layer; + ctx = _cogl_context_get_default (); + unit_index = layer_info.insert_after + 1; if (unit_index == 0) layer = _cogl_pipeline_layer_copy (ctx->default_layer_0); |