diff options
author | Ray Strode <rstrode@redhat.com> | 2013-03-25 13:29:36 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2013-03-26 16:58:22 -0400 |
commit | 47cf63bebe8c505a6da009a19ab5bf39542d8825 (patch) | |
tree | 30da8987f63b24a9f396050775a3ea3e4e60bc6c | |
parent | 0e58906194c0fab0b8dc8e14fcd7f4c289c28481 (diff) | |
download | mutter-47cf63bebe8c505a6da009a19ab5bf39542d8825.tar.gz |
background: share snippets between pipelines
Cogl automatically caches pipelines with no eviction policy,
so we need to make sure to reuse snippets to prevent
identical pipelines from getting cached separately.
https://bugzilla.gnome.org/show_bug.cgi?id=696157
-rw-r--r-- | src/compositor/meta-background.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c index 4d8f1fb07..3380957ee 100644 --- a/src/compositor/meta-background.c +++ b/src/compositor/meta-background.c @@ -99,7 +99,6 @@ G_DEFINE_TYPE_WITH_CODE (MetaBackground, meta_background, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTENT, clutter_content_iface_init)) - static gboolean meta_background_get_preferred_size (ClutterContent *content, gfloat *width, @@ -535,13 +534,18 @@ static void add_vignette (MetaBackground *self) { MetaBackgroundPrivate *priv = self->priv; - CoglSnippet *snippet; + static CoglSnippet *snippet = NULL; ensure_pipeline (self); - snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, FRAGMENT_SHADER_DECLARATIONS, VIGNETTE_CODE); + /* Cogl automatically caches pipelines with no eviction policy, + * so we need to prevent identical pipelines from getting cached + * separately, by reusing the same fragement shader snippet. + */ + if (snippet == NULL) + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, FRAGMENT_SHADER_DECLARATIONS, VIGNETTE_CODE); + cogl_pipeline_add_snippet (priv->pipeline, snippet); - cogl_object_unref (snippet); cogl_pipeline_set_uniform_1f (priv->pipeline, cogl_pipeline_get_uniform_location (priv->pipeline, |