mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
cogl-material: Fix the check to prevent using too many layers
There was a check at the bottom of the loop which sets up the state for each of the layers so that it would break from the loop when the maximum number of layers is reached. However after doing this it would not increment 'i'. 'i' is later used to disable the remaining layers so it would end up disabling the last layer it just set up. This patch moves the check to be part of the loop condition so that the check is performed after incrementing 'i'. http://bugzilla.openedhand.com/show_bug.cgi?id=2064
This commit is contained in:
parent
d5d98500be
commit
3e88dee1a3
@ -1469,8 +1469,10 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
for (tmp = material->layers, i = 0; tmp != NULL; tmp = tmp->next, i++)
|
||||
{
|
||||
for (tmp = material->layers, i = 0;
|
||||
tmp != NULL && i < _cogl_get_max_texture_image_units ();
|
||||
tmp = tmp->next, i++)
|
||||
{
|
||||
CoglHandle layer_handle = (CoglHandle)tmp->data;
|
||||
CoglMaterialLayer *layer =
|
||||
_cogl_material_layer_pointer_from_handle (layer_handle);
|
||||
@ -1621,9 +1623,6 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
||||
g_array_append_val (ctx->current_layers, new_gl_layer_info);
|
||||
|
||||
layer->flags &= ~COGL_MATERIAL_LAYER_FLAG_DIRTY;
|
||||
|
||||
if ((i+1) >= _cogl_get_max_texture_image_units ())
|
||||
break;
|
||||
}
|
||||
|
||||
/* Disable additional texture units that may have previously been in use.. */
|
||||
|
Loading…
Reference in New Issue
Block a user