mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
material: fix initialization of sparse properties
In _cogl_material_pre_change_notify we need to identify if it's a sparse property being changed and if so initialize the state group if the given material isn't currently the authority for it. Previously we were unconditionally calling _cogl_material_initialize_state which would e.g. NULL the layer differences list of a material each time a layer change was notified. It would also call _cogl_material_initialize_state for non-sparse properties which should always be valid at this point so the function has been renamed to _cogl_material_initialize_sparse_state to make this clearer with a corresponding g_return_if_fail check.
This commit is contained in:
parent
02ce77dc08
commit
021265e634
@ -916,13 +916,15 @@ check_for_blending_change:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_material_initialize_state (CoglMaterial *dest,
|
_cogl_material_initialize_sparse_state (CoglMaterial *dest,
|
||||||
CoglMaterial *src,
|
CoglMaterial *src,
|
||||||
CoglMaterialState state)
|
CoglMaterialState state)
|
||||||
{
|
{
|
||||||
if (dest == src)
|
if (dest == src)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
g_return_if_fail (state & COGL_MATERIAL_STATE_ALL_SPARSE);
|
||||||
|
|
||||||
if (state != COGL_MATERIAL_STATE_LAYERS)
|
if (state != COGL_MATERIAL_STATE_LAYERS)
|
||||||
_cogl_material_copy_differences (dest, src, state);
|
_cogl_material_copy_differences (dest, src, state);
|
||||||
else
|
else
|
||||||
@ -1087,14 +1089,15 @@ _cogl_material_pre_change_notify (CoglMaterial *material,
|
|||||||
|
|
||||||
material->age++;
|
material->age++;
|
||||||
|
|
||||||
/* If the material isn't already an authority for the state group
|
/* If changing a sparse property and if the material isn't already an
|
||||||
* being modified then we need to initialize the corresponding
|
* authority for the state group being modified then we need to
|
||||||
* state. */
|
* initialize the corresponding state. */
|
||||||
if (change & COGL_MATERIAL_STATE_ALL_SPARSE)
|
if (change & COGL_MATERIAL_STATE_ALL_SPARSE &&
|
||||||
authority = _cogl_material_get_authority (material, change);
|
!(material->differences & change))
|
||||||
else
|
{
|
||||||
authority = material;
|
authority = _cogl_material_get_authority (material, change);
|
||||||
_cogl_material_initialize_state (material, authority, change);
|
_cogl_material_initialize_sparse_state (material, authority, change);
|
||||||
|
}
|
||||||
|
|
||||||
/* Each material has a sorted cache of the layers it depends on
|
/* Each material has a sorted cache of the layers it depends on
|
||||||
* which will need updating via _cogl_material_update_layers_cache
|
* which will need updating via _cogl_material_update_layers_cache
|
||||||
|
Loading…
Reference in New Issue
Block a user