mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 08:30:42 -05:00
[cogl-material] Be more carefull about flushing in cogl_material_remove_layer
Previously we would call _cogl_material_pre_change_notify unconditionally, but now we wait until we really know we are removing a layer before notifying the change, which will require a journal flush. Since the convenience functions cogl_set_source_color4ub and cogl_set_source_texture share a single material, cogl_set_source_color4ub always calls cogl_material_remove_layer. Often this is a NOP though and shouldn't require a journal flush. This gets performance back to where it was before reverting the per-actor material commits.
This commit is contained in:
parent
6ee8e15654
commit
87f99e214a
@ -1026,20 +1026,26 @@ cogl_material_remove_layer (CoglHandle material_handle,
|
||||
CoglMaterial *material;
|
||||
CoglMaterialLayer *layer;
|
||||
GList *tmp;
|
||||
gboolean notified_change = FALSE;
|
||||
|
||||
g_return_if_fail (cogl_is_material (material_handle));
|
||||
|
||||
material = _cogl_material_pointer_from_handle (material_handle);
|
||||
|
||||
/* possibly flush primitives referencing the current state... */
|
||||
_cogl_material_pre_change_notify (material, FALSE, NULL);
|
||||
|
||||
for (tmp = material->layers; tmp != NULL; tmp = tmp->next)
|
||||
{
|
||||
layer = tmp->data;
|
||||
if (layer->index == layer_index)
|
||||
{
|
||||
CoglHandle handle = (CoglHandle) layer;
|
||||
|
||||
/* possibly flush primitives referencing the current state... */
|
||||
if (!notified_change)
|
||||
{
|
||||
_cogl_material_pre_change_notify (material, FALSE, NULL);
|
||||
notified_change = TRUE;
|
||||
}
|
||||
|
||||
cogl_handle_unref (handle);
|
||||
material->layers = g_list_remove (material->layers, layer);
|
||||
material->n_layers--;
|
||||
|
Loading…
Reference in New Issue
Block a user