summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2012-09-28 18:37:40 +0100
committerNeil Roberts <neil@linux.intel.com>2012-10-01 14:04:16 +0100
commit2006ddd68ea6a5d53b5a810d8dbf39025d9ec04c (patch)
tree8f4b6eb53dc1c1d7714f4237ea027709e22161a0
parentee0592dbb643a5709f36bd0306204a8c5ad67f64 (diff)
downloadcogl-2006ddd68ea6a5d53b5a810d8dbf39025d9ec04c.tar.gz
pipeline: Don't notify the undefined progend of layer changes
When a layer changes before the pipeline has decided which progend to use it doesn't need to notify the progend of the change. This was causing it to crash. This patch makes that change and also simplifies the notification a bit by just making the calls directly instead of having three separate functions. Reviewed-by: Robert Bragg <robert@linux.intel.com>
-rw-r--r--cogl/cogl-pipeline-layer.c25
-rw-r--r--cogl/cogl-pipeline-private.h15
-rw-r--r--cogl/cogl-pipeline.c53
3 files changed, 22 insertions, 71 deletions
diff --git a/cogl/cogl-pipeline-layer.c b/cogl/cogl-pipeline-layer.c
index 18f46f92..d9590c8b 100644
--- a/cogl/cogl-pipeline-layer.c
+++ b/cogl/cogl-pipeline-layer.c
@@ -282,9 +282,28 @@ _cogl_pipeline_layer_pre_change_notify (CoglPipeline *required_owner,
* this layer (required_owner), and there are no other layers
* dependant on this layer so it's ok to modify it. */
- _cogl_pipeline_fragend_layer_change_notify (required_owner, layer, change);
- _cogl_pipeline_vertend_layer_change_notify (required_owner, layer, change);
- _cogl_pipeline_progend_layer_change_notify (required_owner, layer, change);
+ /* NB: Although layers can have private state associated with them
+ * by multiple backends we know that a layer can't be *changed* if
+ * it has multiple dependants so if we reach here we know we only
+ * have a single owner and can only be associated with a single
+ * backend that needs to be notified of the layer change...
+ */
+ if (required_owner->progend != COGL_PIPELINE_PROGEND_UNDEFINED)
+ {
+ const CoglPipelineProgend *progend =
+ _cogl_pipeline_progends[required_owner->progend];
+ const CoglPipelineFragend *fragend =
+ _cogl_pipeline_fragends[progend->fragend];
+ const CoglPipelineVertend *vertend =
+ _cogl_pipeline_vertends[progend->vertend];
+
+ if (fragend->layer_pre_change_notify)
+ fragend->layer_pre_change_notify (required_owner, layer, change);
+ if (vertend->layer_pre_change_notify)
+ vertend->layer_pre_change_notify (required_owner, layer, change);
+ if (progend->layer_pre_change_notify)
+ progend->layer_pre_change_notify (required_owner, layer, change);
+ }
/* If the layer being changed is the same as the last layer we
* flushed to the corresponding texture unit then we keep a track of
diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h
index 71e43e05..1a3d049f 100644
--- a/cogl/cogl-pipeline-private.h
+++ b/cogl/cogl-pipeline-private.h
@@ -872,26 +872,11 @@ _cogl_pipeline_init_state_hash_functions (void);
void
_cogl_pipeline_init_layer_state_hash_functions (void);
-void
-_cogl_pipeline_fragend_layer_change_notify (CoglPipeline *owner,
- CoglPipelineLayer *layer,
- CoglPipelineLayerState change);
-
CoglPipelineLayerState
_cogl_pipeline_get_layer_state_for_fragment_codegen (CoglContext *context);
CoglPipelineState
_cogl_pipeline_get_state_for_fragment_codegen (CoglContext *context);
-void
-_cogl_pipeline_vertend_layer_change_notify (CoglPipeline *owner,
- CoglPipelineLayer *layer,
- CoglPipelineLayerState change);
-
-void
-_cogl_pipeline_progend_layer_change_notify (CoglPipeline *owner,
- CoglPipelineLayer *layer,
- CoglPipelineLayerState change);
-
#endif /* __COGL_PIPELINE_PRIVATE_H */
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
index ad573eb2..ac7b1cf2 100644
--- a/cogl/cogl-pipeline.c
+++ b/cogl/cogl-pipeline.c
@@ -1449,59 +1449,6 @@ _cogl_pipeline_prune_to_n_layers (CoglPipeline *pipeline, int n)
pipeline->differences |= COGL_PIPELINE_STATE_LAYERS;
}
-void
-_cogl_pipeline_fragend_layer_change_notify (CoglPipeline *owner,
- CoglPipelineLayer *layer,
- CoglPipelineLayerState change)
-{
- /* NB: Although layers can have private state associated with them
- * by multiple backends we know that a layer can't be *changed* if
- * it has multiple dependants so if we reach here we know we only
- * have a single owner and can only be associated with a single
- * backend that needs to be notified of the layer change...
- */
- if (owner->progend != COGL_PIPELINE_PROGEND_UNDEFINED)
- {
- const CoglPipelineProgend *progend =
- _cogl_pipeline_progends[owner->progend];
- const CoglPipelineFragend *fragend =
- _cogl_pipeline_fragends[progend->fragend];
-
- if (fragend->layer_pre_change_notify)
- fragend->layer_pre_change_notify (owner, layer, change);
- }
-}
-
-void
-_cogl_pipeline_vertend_layer_change_notify (CoglPipeline *owner,
- CoglPipelineLayer *layer,
- CoglPipelineLayerState change)
-{
- /* NB: The comment in fragend_layer_change_notify applies here too */
- if (owner->progend != COGL_PIPELINE_PROGEND_UNDEFINED)
- {
- const CoglPipelineProgend *progend =
- _cogl_pipeline_progends[owner->progend];
- const CoglPipelineVertend *vertend =
- _cogl_pipeline_vertends[progend->vertend];
-
- if (vertend->layer_pre_change_notify)
- vertend->layer_pre_change_notify (owner, layer, change);
- }
-}
-
-void
-_cogl_pipeline_progend_layer_change_notify (CoglPipeline *owner,
- CoglPipelineLayer *layer,
- CoglPipelineLayerState change)
-{
- const CoglPipelineProgend *progend =
- _cogl_pipeline_progends[owner->progend];
-
- if (progend->layer_pre_change_notify)
- progend->layer_pre_change_notify (owner, layer, change);
-}
-
typedef struct
{
/* The layer we are trying to find */