mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
effects: Check before using the cogl_shader_* API
Since BlurEffect and DesaturateEffect are using the shader API implicitly and not using ClutterShaderEffect, we need to check if the underlying GL implementation supports the GLSL shading language and warn if not.
This commit is contained in:
parent
9ab83cebfd
commit
d10ebe9fca
@ -137,6 +137,18 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect)
|
||||
if (self->actor == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
|
||||
{
|
||||
/* if we don't have support for GLSL shaders then we
|
||||
* forcibly disable the ActorMeta
|
||||
*/
|
||||
g_warning ("Unable to use the ShaderEffect: the graphics hardware "
|
||||
"or the current GL driver does not implement support "
|
||||
"for the GLSL shading language.");
|
||||
clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
clutter_actor_get_allocation_box (self->actor, &allocation);
|
||||
clutter_actor_box_get_size (&allocation, &width, &height);
|
||||
|
||||
|
@ -132,6 +132,18 @@ clutter_desaturate_effect_pre_paint (ClutterEffect *effect)
|
||||
if (self->actor == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
|
||||
{
|
||||
/* if we don't have support for GLSL shaders then we
|
||||
* forcibly disable the ActorMeta
|
||||
*/
|
||||
g_warning ("Unable to use the ShaderEffect: the graphics hardware "
|
||||
"or the current GL driver does not implement support "
|
||||
"for the GLSL shading language.");
|
||||
clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
factor = (float) self->factor;
|
||||
|
||||
if (self->shader == COGL_INVALID_HANDLE)
|
||||
|
Loading…
Reference in New Issue
Block a user