mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
cogl-material: Fix the count of the number of layers
Previously the counter for the number of layers was only updated whenever the texture handle for a layer changes. However there are many other ways for a new layer to be created for example by setting a layer combine constant. Also by default the texture on a layer is COGL_INVALID_HANDLE so if the application tries to create an explicit layer with no texture by calling cogl_material_set_layer with COGL_INVALID_HANDLE then it also wouldn't update the count. This patch fixes that by incrementing the count in cogl_material_get_layer instead. This function is called by all functions that may end up creating a layer so it seems like the most appropriate place. http://bugzilla.openedhand.com/show_bug.cgi?id=2132
This commit is contained in:
parent
ae0354e9ba
commit
889dcee384
@ -799,6 +799,8 @@ _cogl_material_get_layer (CoglMaterial *material,
|
||||
material->layers =
|
||||
g_list_insert_before (material->layers, tmp, layer_handle);
|
||||
|
||||
material->n_layers++;
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
@ -824,7 +826,6 @@ cogl_material_set_layer (CoglHandle material_handle,
|
||||
/* possibly flush primitives referencing the current state... */
|
||||
_cogl_material_pre_change_notify (material, FALSE, NULL);
|
||||
|
||||
material->n_layers = g_list_length (material->layers);
|
||||
if (material->n_layers > _cogl_get_max_texture_image_units ())
|
||||
{
|
||||
if (!(material->flags & COGL_MATERIAL_FLAG_SHOWN_SAMPLER_WARNING))
|
||||
|
Loading…
Reference in New Issue
Block a user