[cogl-material] Always bind the new texture handle
Cogl previously tried to cache the currently bound texture when drawing through the material API to avoid excessive GL calls. However, a few other places in Cogl and Clutter rebind the texture as well so this can cause problems. This was causing shaped windows to fail in Mutter because ClutterGLXTexturePixmap was binding a different texture to update it while the second texture unit was still active which meant the mask texture would not be selected when the shaped window was drawn subsequent times. Ideally we would fix this by providing a wrapper around glBindTexture which would affect the cached value. The cache would also have to be cleared if a selected texture was deleted.
This commit is contained in:
parent
2747aa7be2
commit
edbe9a0377
@ -949,10 +949,13 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
|||||||
|
|
||||||
GE (glActiveTexture (GL_TEXTURE0 + i));
|
GE (glActiveTexture (GL_TEXTURE0 + i));
|
||||||
|
|
||||||
if (!gl_layer_info
|
/* FIXME: We could be more clever here and only bind the texture
|
||||||
|| gl_layer_info->gl_target != gl_target
|
if it is different from gl_layer_info->gl_texture to avoid
|
||||||
|| gl_layer_info->gl_texture != gl_texture)
|
redundant GL calls. However a few other places in Cogl and
|
||||||
{
|
Clutter call glBindTexture such as ClutterGLXTexturePixmap so
|
||||||
|
we'd need to ensure they affect the cache. Also deleting a
|
||||||
|
texture should clear it from the cache in case a new texture
|
||||||
|
is generated with the same number */
|
||||||
#ifdef HAVE_COGL_GLES2
|
#ifdef HAVE_COGL_GLES2
|
||||||
cogl_gles2_wrapper_bind_texture (gl_target,
|
cogl_gles2_wrapper_bind_texture (gl_target,
|
||||||
gl_texture,
|
gl_texture,
|
||||||
@ -960,7 +963,6 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
|||||||
#else
|
#else
|
||||||
GE (glBindTexture (gl_target, gl_texture));
|
GE (glBindTexture (gl_target, gl_texture));
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
/* Disable the previous target if it was different */
|
/* Disable the previous target if it was different */
|
||||||
if (gl_layer_info &&
|
if (gl_layer_info &&
|
||||||
|
Loading…
Reference in New Issue
Block a user