diff --git a/cogl/cogl-material-arbfp.c b/cogl/cogl-material-arbfp.c index 7a81a846d..e64234816 100644 --- a/cogl/cogl-material-arbfp.c +++ b/cogl/cogl-material-arbfp.c @@ -1073,10 +1073,19 @@ _cogl_material_backend_arbfp_material_set_parent_notify ( NULL); } +/* NB: layers are considered immutable once they have any dependants + * so although multiple materials can end up depending on a single + * static layer, we can guarantee that if a layer is being *changed* + * then it can only have one material depending on it. + * + * XXX: Don't forget this is *pre* change, we can't read the new value + * yet! + */ static void _cogl_material_backend_arbfp_layer_pre_change_notify ( + CoglMaterial *owner, CoglMaterialLayer *layer, - CoglMaterialLayerState changes) + CoglMaterialLayerState change) { /* TODO: we could be saving snippets of texture combine code along * with each layer and then when a layer changes we would just free diff --git a/cogl/cogl-material-private.h b/cogl/cogl-material-private.h index ca260c2ee..e5e62988e 100644 --- a/cogl/cogl-material-private.h +++ b/cogl/cogl-material-private.h @@ -557,7 +557,8 @@ typedef struct _CoglMaterialBackend CoglMaterialState change, const CoglColor *new_color); void (*material_set_parent_notify) (CoglMaterial *material); - void (*layer_pre_change_notify) (CoglMaterialLayer *layer, + void (*layer_pre_change_notify) (CoglMaterial *owner, + CoglMaterialLayer *layer, CoglMaterialLayerState change); void (*free_priv) (CoglMaterial *material); diff --git a/cogl/cogl-material.c b/cogl/cogl-material.c index a8ecf461a..557bcb217 100644 --- a/cogl/cogl-material.c +++ b/cogl/cogl-material.c @@ -1418,7 +1418,8 @@ _cogl_material_prune_to_n_layers (CoglMaterial *material, int n) } static void -_cogl_material_backend_layer_change_notify (CoglMaterialLayer *layer, +_cogl_material_backend_layer_change_notify (CoglMaterial *owner, + CoglMaterialLayer *layer, CoglMaterialLayerState change) { int i; @@ -1433,7 +1434,7 @@ _cogl_material_backend_layer_change_notify (CoglMaterialLayer *layer, _cogl_material_backends[i]->layer_pre_change_notify) { const CoglMaterialBackend *backend = _cogl_material_backends[i]; - backend->layer_pre_change_notify (layer, change); + backend->layer_pre_change_notify (owner, layer, change); } } } @@ -1594,7 +1595,7 @@ _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. */ - _cogl_material_backend_layer_change_notify (layer, change); + _cogl_material_backend_layer_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