diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h index 5e4f0ff4e..072ab7414 100644 --- a/cogl/cogl-pipeline-private.h +++ b/cogl/cogl-pipeline-private.h @@ -665,9 +665,18 @@ _cogl_pipeline_prune_redundant_ancestry (CoglPipeline *pipeline); void _cogl_pipeline_update_blend_enable (CoglPipeline *pipeline, CoglPipelineState changes); +typedef enum +{ + COGL_PIPELINE_GET_LAYER_NO_CREATE +} CoglPipelineGetLayerFlags; + CoglPipelineLayer * -_cogl_pipeline_get_layer (CoglPipeline *pipeline, - int layer_index); +_cogl_pipeline_get_layer_with_flags (CoglPipeline *pipeline, + int layer_index, + CoglPipelineGetLayerFlags flags); + +#define _cogl_pipeline_get_layer(p, l) \ + _cogl_pipeline_get_layer_with_flags (p, l, 0) gboolean _cogl_is_pipeline_layer (void *object); diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c index fa3b1e237..b94b16e05 100644 --- a/cogl/cogl-pipeline.c +++ b/cogl/cogl-pipeline.c @@ -1707,8 +1707,9 @@ _cogl_pipeline_get_layer_info (CoglPipeline *pipeline, } CoglPipelineLayer * -_cogl_pipeline_get_layer (CoglPipeline *pipeline, - int layer_index) +_cogl_pipeline_get_layer_with_flags (CoglPipeline *pipeline, + int layer_index, + CoglPipelineGetLayerFlags flags) { CoglPipeline *authority = _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS); @@ -1742,7 +1743,7 @@ _cogl_pipeline_get_layer (CoglPipeline *pipeline, _cogl_pipeline_get_layer_info (authority, &layer_info); - if (layer_info.layer) + if (layer_info.layer || (flags & COGL_PIPELINE_GET_LAYER_NO_CREATE)) return layer_info.layer; ctx = _cogl_context_get_default ();