material: chain up in layer_pre_change_notify

A change to a layer is also going to be a change to its owning material
so we have to chain up in _cogl_material_layer_pre_change_notify and
call _cogl_material_pre_change_notify. Previously we were only
considering if the owning material was referenced in the journal but
that ignores that it might also have dependants. We no longer need to
flush the journal directly in layer_pre_change_notify.
This commit is contained in:
Robert Bragg 2010-08-08 13:54:07 +01:00
parent b493b30257
commit 937fc0dbec

View File

@ -1444,8 +1444,19 @@ _cogl_material_layer_pre_change_notify (CoglMaterial *required_owner,
/* We only allow a NULL required_owner for new layers */
g_return_val_if_fail (required_owner != NULL, layer);
/* Chain up:
* A modification of a layer is indirectly also a modification of
* its owner so first make sure to flush the journal of any
* references to the current owner state and if necessary perform
* a copy-on-write for the required_owner if it has dependants.
*/
_cogl_material_pre_change_notify (required_owner,
COGL_MATERIAL_STATE_LAYERS,
NULL);
/* Unlike materials; layers are simply considered immutable once
* they have dependants - either children or another material owner.
* they have dependants - either direct children, or another
* material as an owner.
*/
if (COGL_MATERIAL_NODE (layer)->has_children ||
layer->owner != required_owner)
@ -1463,9 +1474,6 @@ _cogl_material_layer_pre_change_notify (CoglMaterial *required_owner,
* this layer (required_owner), and there are no other layers
* dependant on this layer so it's ok to modify it. */
if (required_owner->journal_ref_count)
_cogl_journal_flush ();
_cogl_material_backend_layer_change_notify (layer, change);
/* If the layer being changed is the same as the last layer we