MetaSurfaceActorX11: invalidate the stex on video memory purged errors

MetaShapedTexture uses FBOs when mipmapping so we need to cause them
to be recreated.

https://bugzilla.gnome.org/show_bug.cgi?id=739178
This commit is contained in:
Rui Matos 2016-05-29 20:00:45 +02:00
parent 53993ba4d2
commit cc6efeb14f

View File

@ -420,6 +420,22 @@ window_decorated_notify (MetaWindow *window,
create_damage (self);
}
static void
reset_texture (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
if (!priv->texture)
return;
/* Setting the texture to NULL will cause all the FBO's cached by the
* shaped texture's MetaTextureTower to be discarded and recreated.
*/
meta_shaped_texture_set_texture (stex, NULL);
meta_shaped_texture_set_texture (stex, priv->texture);
}
MetaSurfaceActor *
meta_surface_actor_x11_new (MetaWindow *window)
{
@ -432,6 +448,9 @@ meta_surface_actor_x11_new (MetaWindow *window)
priv->window = window;
priv->display = display;
g_signal_connect_object (priv->display, "gl-video-memory-purged",
G_CALLBACK (reset_texture), self, G_CONNECT_SWAPPED);
create_damage (self);
g_signal_connect_object (priv->window, "notify::decorated",
G_CALLBACK (window_decorated_notify), self, 0);