mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
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>
This commit is contained in:
parent
d4459e2d42
commit
f16d3756df
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user