mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
[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
7c57d71e4e
commit
a54d13368f
@ -949,10 +949,13 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
||||
|
||||
GE (glActiveTexture (GL_TEXTURE0 + i));
|
||||
|
||||
if (!gl_layer_info
|
||||
|| gl_layer_info->gl_target != gl_target
|
||||
|| gl_layer_info->gl_texture != gl_texture)
|
||||
{
|
||||
/* FIXME: We could be more clever here and only bind the texture
|
||||
if it is different from gl_layer_info->gl_texture to avoid
|
||||
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
|
||||
cogl_gles2_wrapper_bind_texture (gl_target,
|
||||
gl_texture,
|
||||
@ -960,7 +963,6 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
||||
#else
|
||||
GE (glBindTexture (gl_target, gl_texture));
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Disable the previous target if it was different */
|
||||
if (gl_layer_info &&
|
||||
|
Loading…
Reference in New Issue
Block a user