mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 12:52:14 +00:00
shaped-texture: Pass along the snippet to the texture tower
The snippet is used make sure the right source is sampled in the shader. This wasn't done in the texture tower, meaning the textures from the tower were not correct. Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/528 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2278>
This commit is contained in:
parent
c2b8582e0f
commit
d4ffaf291f
@ -1144,6 +1144,8 @@ meta_shaped_texture_set_snippet (MetaShapedTexture *stex,
|
||||
g_clear_pointer (&stex->snippet, cogl_object_unref);
|
||||
if (snippet)
|
||||
stex->snippet = cogl_object_ref (snippet);
|
||||
|
||||
meta_texture_tower_set_snippet (stex->paint_tower, snippet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,6 +62,7 @@ struct _MetaTextureTower
|
||||
CoglOffscreen *fbos[MAX_TEXTURE_LEVELS];
|
||||
Box invalid[MAX_TEXTURE_LEVELS];
|
||||
CoglPipeline *pipeline_template;
|
||||
CoglSnippet *snippet;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -97,6 +98,7 @@ meta_texture_tower_free (MetaTextureTower *tower)
|
||||
cogl_object_unref (tower->pipeline_template);
|
||||
|
||||
meta_texture_tower_set_base_texture (tower, NULL);
|
||||
cogl_clear_object (&tower->snippet);
|
||||
|
||||
g_free (tower);
|
||||
}
|
||||
@ -216,6 +218,28 @@ meta_texture_tower_update_area (MetaTextureTower *tower,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_texture_tower_set_snippet (MetaTextureTower *tower,
|
||||
CoglSnippet *snippet)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (tower->snippet == snippet)
|
||||
return;
|
||||
|
||||
g_clear_pointer (&tower->snippet, cogl_object_unref);
|
||||
|
||||
if (snippet)
|
||||
tower->snippet = cogl_object_ref (snippet);
|
||||
|
||||
for (i = 1; i < tower->n_levels; i++)
|
||||
{
|
||||
cogl_clear_object (&tower->textures[i]);
|
||||
g_clear_object (&tower->fbos[i]);
|
||||
}
|
||||
cogl_clear_object (&tower->pipeline_template);
|
||||
}
|
||||
|
||||
/* It generally looks worse if we scale up a window texture by even a
|
||||
* small amount than if we scale it down using bilinear filtering, so
|
||||
* we always pick the *larger* adjacent level. */
|
||||
@ -410,6 +434,9 @@ texture_tower_revalidate (MetaTextureTower *tower,
|
||||
pipeline = cogl_pipeline_copy (tower->pipeline_template);
|
||||
cogl_pipeline_set_layer_texture (pipeline, 0, tower->textures[level - 1]);
|
||||
|
||||
if (tower->snippet && level == 1)
|
||||
cogl_pipeline_add_layer_snippet (pipeline, 0, tower->snippet);
|
||||
|
||||
cogl_framebuffer_draw_textured_rectangle (fb, pipeline,
|
||||
invalid->x1, invalid->y1,
|
||||
invalid->x2, invalid->y2,
|
||||
|
@ -63,6 +63,9 @@ void meta_texture_tower_update_area (MetaTextureTower *tower,
|
||||
CoglTexture *meta_texture_tower_get_paint_texture (MetaTextureTower *tower,
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
void meta_texture_tower_set_snippet (MetaTextureTower *tower,
|
||||
CoglSnippet *snippet);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __META_TEXTURE_TOWER_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user