clutter-shader-effect: Add a get_static_shader_source virtual

This is used as an alternative to calling
clutter_shader_effect_set_shader_source. A ClutterShaderEffect
subclass is now expected to implement this method to return the source
for the effect that will be used for all instances of this
subclass. It is only called once regardless of the number of instances
created. That way Clutter can avoid recompiling the shader source for
every new instance of the effect.

https://bugzilla.gnome.org/show_bug.cgi?id=660512

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
Neil Roberts
2011-09-29 20:05:39 +01:00
parent e8ec7ebed0
commit 8b995a9457
2 changed files with 164 additions and 98 deletions

View File

@ -62,6 +62,11 @@ struct _ClutterShaderEffect
/**
* ClutterShaderEffectClass:
* @get_static_shader_source: Returns the GLSL source code to use for
* instances of this shader effect. Note that this function is only
* called once per subclass of #ClutterShaderEffect regardless of how
* many instances are used. It is expected that subclasses will return
* a copy of a static string from this function.
*
* The <structname>ClutterShaderEffectClass</structname> structure contains
* only private data
@ -73,13 +78,16 @@ struct _ClutterShaderEffectClass
/*< private >*/
ClutterOffscreenEffectClass parent_class;
/*< public >*/
gchar * (* get_static_shader_source) (ClutterShaderEffect *effect);
/*< private >*/
/* padding */
void (*_clutter_shader1) (void);
void (*_clutter_shader2) (void);
void (*_clutter_shader3) (void);
void (*_clutter_shader4) (void);
void (*_clutter_shader5) (void);
void (*_clutter_shader6) (void);
};
GType clutter_shader_effect_get_type (void) G_GNUC_CONST;