[cogl] pipeline: lazily get ctx in _get_layer
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] pipeline: lazily get ctx in _get_layer
- Date: Wed, 21 Sep 2011 21:08:36 +0000 (UTC)
commit f16d3756dfafa63521954842c8365e8862bfd126
Author: Robert Bragg <robert linux intel com>
Date: Tue Sep 20 20:46:38 2011 +0100
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>
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 0466740..140a488 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]