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>

(cherry picked from commit 2006ddd68ea6a5d53b5a810d8dbf39025d9ec04c)
This commit is contained in:
Neil Roberts 2012-09-28 18:37:40 +01:00 committed by Robert Bragg
parent de7416fd1d
commit 1abf0ed55e
3 changed files with 22 additions and 71 deletions

View File

@ -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

View File

@ -938,26 +938,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 */

View File

@ -1529,59 +1529,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 */