diff options
author | Adel Gadllah <adel.gadllah@gmail.com> | 2014-07-24 15:39:26 +0200 |
---|---|---|
committer | Adel Gadllah <adel.gadllah@gmail.com> | 2014-07-24 16:58:06 +0200 |
commit | 72ec20e48f085af729c5b0afdd78d259694a052a (patch) | |
tree | 23a067cca72c12199b0ef4c35c72d228fdfdc07b | |
parent | 3d1d1555617a12b93817ff71c08d98a5b6e7c3f4 (diff) |
background: Do not assume GLSL is available
Some hardware does not support it causing crashes in cogl during paint.
https://bugzilla.gnome.org/show_bug.cgi?id=733623
-rw-r--r-- | src/compositor/meta-background.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c index 6eee1599..ae6f4592 100644 --- a/src/compositor/meta-background.c +++ b/src/compositor/meta-background.c @@ -501,7 +501,8 @@ set_brightness (MetaBackground *self, priv->brightness = brightness; - if (priv->effects & META_BACKGROUND_EFFECTS_VIGNETTE) + if (clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL) && + priv->effects & META_BACKGROUND_EFFECTS_VIGNETTE) { ensure_pipeline (self); cogl_pipeline_set_uniform_1f (priv->pipeline, @@ -509,6 +510,14 @@ set_brightness (MetaBackground *self, "brightness"), priv->brightness); } + else + { + ensure_pipeline (self); + CoglColor blend_color; + cogl_color_init_from_4f (&blend_color, brightness, brightness, brightness, 1.0); + cogl_pipeline_set_layer_combine (priv->pipeline, 1, "RGB=MODULATE(PREVIOUS, CONSTANT) A=REPLACE(PREVIOUS)", NULL); + cogl_pipeline_set_layer_combine_constant (priv->pipeline, 1, &blend_color); + } clutter_content_invalidate (CLUTTER_CONTENT (self)); @@ -526,6 +535,9 @@ set_vignette_sharpness (MetaBackground *self, priv->vignette_sharpness = sharpness; + if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL)) + return; + if (priv->effects & META_BACKGROUND_EFFECTS_VIGNETTE) { ensure_pipeline (self); @@ -546,6 +558,9 @@ add_vignette (MetaBackground *self) MetaBackgroundPrivate *priv = self->priv; static CoglSnippet *snippet = NULL; + if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL)) + return; + ensure_pipeline (self); /* Cogl automatically caches pipelines with no eviction policy, |