mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
[cogl-material] Always glBindTexture when flushing material state
Bug #1457 - Creating a new texture messes up the cogl material state cache; reported by Neil Roberts We still don't have caching of bound texture state so we always have to re-bind the texture when flushing the GL state of any material layers.
This commit is contained in:
parent
25fc1b85ab
commit
114385b2cf
@ -903,25 +903,6 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
||||
(fallback_mask & (1<<i)) ? TRUE : FALSE;
|
||||
new_gl_layer_info.disabled =
|
||||
(disable_mask & (1<<i)) ? TRUE : FALSE;
|
||||
if (i < ctx->current_layers->len)
|
||||
{
|
||||
gl_layer_info =
|
||||
&g_array_index (ctx->current_layers, CoglLayerInfo, i);
|
||||
|
||||
#ifndef DISABLE_MATERIAL_CACHE
|
||||
if (gl_layer_info->handle == layer_handle &&
|
||||
!(layer->flags & COGL_MATERIAL_LAYER_FLAG_DIRTY) &&
|
||||
!(gl_layer_info->layer0_overridden ||
|
||||
new_gl_layer_info.layer0_overridden) &&
|
||||
(gl_layer_info->fallback
|
||||
== new_gl_layer_info.fallback) &&
|
||||
(gl_layer_info->disabled
|
||||
== new_gl_layer_info.disabled))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
tex_handle = layer->texture;
|
||||
cogl_texture_get_gl_texture (tex_handle, &gl_texture, &gl_target);
|
||||
@ -972,6 +953,29 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
||||
GE (glBindTexture (gl_target, gl_texture));
|
||||
#endif
|
||||
|
||||
/* XXX: Once we add caching for glBindTexture state, these
|
||||
* checks should be moved back up to the top of the loop!
|
||||
*/
|
||||
if (i < ctx->current_layers->len)
|
||||
{
|
||||
gl_layer_info =
|
||||
&g_array_index (ctx->current_layers, CoglLayerInfo, i);
|
||||
|
||||
#ifndef DISABLE_MATERIAL_CACHE
|
||||
if (gl_layer_info->handle == layer_handle &&
|
||||
!(layer->flags & COGL_MATERIAL_LAYER_FLAG_DIRTY) &&
|
||||
!(gl_layer_info->layer0_overridden ||
|
||||
new_gl_layer_info.layer0_overridden) &&
|
||||
(gl_layer_info->fallback
|
||||
== new_gl_layer_info.fallback) &&
|
||||
(gl_layer_info->disabled
|
||||
== new_gl_layer_info.disabled))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Disable the previous target if it was different */
|
||||
#ifndef DISABLE_MATERIAL_CACHE
|
||||
if (gl_layer_info &&
|
||||
|
Loading…
Reference in New Issue
Block a user