Add a version of _cogl_pipeline_get_layer which does not create it
This adds _cogl_pipeline_get_layer_with_flags which takes a set of flags to modify the behaviour. The only flag currently available is one to disable creating the layer if the layer index does not already exist. Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
parent
bf7f1e358d
commit
740bd12f2d
@ -665,9 +665,18 @@ _cogl_pipeline_prune_redundant_ancestry (CoglPipeline *pipeline);
|
|||||||
void _cogl_pipeline_update_blend_enable (CoglPipeline *pipeline,
|
void _cogl_pipeline_update_blend_enable (CoglPipeline *pipeline,
|
||||||
CoglPipelineState changes);
|
CoglPipelineState changes);
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
COGL_PIPELINE_GET_LAYER_NO_CREATE
|
||||||
|
} CoglPipelineGetLayerFlags;
|
||||||
|
|
||||||
CoglPipelineLayer *
|
CoglPipelineLayer *
|
||||||
_cogl_pipeline_get_layer (CoglPipeline *pipeline,
|
_cogl_pipeline_get_layer_with_flags (CoglPipeline *pipeline,
|
||||||
int layer_index);
|
int layer_index,
|
||||||
|
CoglPipelineGetLayerFlags flags);
|
||||||
|
|
||||||
|
#define _cogl_pipeline_get_layer(p, l) \
|
||||||
|
_cogl_pipeline_get_layer_with_flags (p, l, 0)
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_is_pipeline_layer (void *object);
|
_cogl_is_pipeline_layer (void *object);
|
||||||
|
@ -1707,8 +1707,9 @@ _cogl_pipeline_get_layer_info (CoglPipeline *pipeline,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglPipelineLayer *
|
CoglPipelineLayer *
|
||||||
_cogl_pipeline_get_layer (CoglPipeline *pipeline,
|
_cogl_pipeline_get_layer_with_flags (CoglPipeline *pipeline,
|
||||||
int layer_index)
|
int layer_index,
|
||||||
|
CoglPipelineGetLayerFlags flags)
|
||||||
{
|
{
|
||||||
CoglPipeline *authority =
|
CoglPipeline *authority =
|
||||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS);
|
_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);
|
_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;
|
return layer_info.layer;
|
||||||
|
|
||||||
ctx = _cogl_context_get_default ();
|
ctx = _cogl_context_get_default ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user