[clutter/clutter-1.99: 2/11] [2.0] Remove ClutterShader
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/clutter-1.99: 2/11] [2.0] Remove ClutterShader
- Date: Thu, 16 Jun 2011 16:14:38 +0000 (UTC)
commit df70fc68149d32d46b60acf78ae56492224ad391
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Thu Jun 16 15:43:43 2011 +0100
[2.0] Remove ClutterShader
It's been deprecated and now we can finally remove it.
clutter/Makefile.am | 2 -
clutter/clutter-actor.c | 349 +----------
clutter/clutter-actor.h | 23 -
clutter/clutter-shader.c | 950 ----------------------------
clutter/clutter-shader.h | 149 -----
clutter/clutter-texture.c | 17 -
clutter/clutter-types.h | 4 -
clutter/clutter.h | 1 -
doc/reference/clutter/clutter-sections.txt | 82 +--
tests/interactive/Makefile.am | 1 -
tests/interactive/test-shader.c | 416 ------------
11 files changed, 28 insertions(+), 1966 deletions(-)
---
diff --git a/clutter/Makefile.am b/clutter/Makefile.am
index 071b786..9402679 100644
--- a/clutter/Makefile.am
+++ b/clutter/Makefile.am
@@ -113,7 +113,6 @@ source_h = \
$(srcdir)/clutter-script.h \
$(srcdir)/clutter-scriptable.h \
$(srcdir)/clutter-settings.h \
- $(srcdir)/clutter-shader.h \
$(srcdir)/clutter-shader-effect.h \
$(srcdir)/clutter-shader-types.h \
$(srcdir)/clutter-swipe-action.h \
@@ -199,7 +198,6 @@ source_c = \
$(srcdir)/clutter-script-parser.c \
$(srcdir)/clutter-scriptable.c \
$(srcdir)/clutter-settings.c \
- $(srcdir)/clutter-shader.c \
$(srcdir)/clutter-shader-effect.c \
$(srcdir)/clutter-shader-types.c \
$(srcdir)/clutter-swipe-action.c \
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 81ba12b..9c31283 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -305,11 +305,9 @@
#include "clutter-profile.h"
#include "clutter-scriptable.h"
#include "clutter-script-private.h"
-#include "clutter-shader.h"
#include "clutter-stage-private.h"
#include "clutter-units.h"
-typedef struct _ShaderData ShaderData;
typedef struct _AnchorCoord AnchorCoord;
#define CLUTTER_ACTOR_GET_PRIVATE(obj) \
@@ -629,10 +627,6 @@ static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
static void clutter_animatable_iface_init (ClutterAnimatableIface *iface);
static void atk_implementor_iface_init (AtkImplementorIface *iface);
-static void clutter_actor_shader_pre_paint (ClutterActor *actor,
- gboolean repeat);
-static void clutter_actor_shader_post_paint (ClutterActor *actor);
-
/* These setters are all static for now, maybe they should be in the
* public API, but they are perhaps obscure enough to leave only as
* properties
@@ -691,8 +685,6 @@ static ClutterPaintVolume *_clutter_actor_get_paint_volume_mutable (ClutterActor
{ _transform; } \
cogl_matrix_translate ((m), -_tx, -_ty, -_tz); } G_STMT_END
-static GQuark quark_shader_data = 0;
-
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterActor,
clutter_actor,
G_TYPE_INITIALLY_UNOWNED,
@@ -2649,12 +2641,6 @@ _clutter_actor_update_last_paint_volume (ClutterActor *self)
priv->last_paint_volume_valid = TRUE;
}
-static inline gboolean
-actor_has_shader_data (ClutterActor *self)
-{
- return g_object_get_qdata (G_OBJECT (self), quark_shader_data) != NULL;
-}
-
guint32
_clutter_actor_get_pick_id (ClutterActor *self)
{
@@ -2908,21 +2894,15 @@ clutter_actor_paint (ClutterActor *self)
}
if (priv->effects == NULL)
+ priv->next_effect_to_paint = NULL;
+ else
{
- if (actor_has_shader_data (self))
- clutter_actor_shader_pre_paint (self, FALSE);
- priv->next_effect_to_paint = NULL;
+ priv->next_effect_to_paint =
+ _clutter_meta_group_peek_metas (priv->effects);
}
- else
- priv->next_effect_to_paint =
- _clutter_meta_group_peek_metas (priv->effects);
clutter_actor_continue_paint (self);
- if (priv->effects == NULL &&
- actor_has_shader_data (self))
- clutter_actor_shader_post_paint (self);
-
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES))
_clutter_actor_draw_paint_volume (self);
@@ -3789,8 +3769,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
- quark_shader_data = g_quark_from_static_string ("-clutter-actor-shader-data");
-
object_class->set_property = clutter_actor_set_property;
object_class->get_property = clutter_actor_get_property;
object_class->dispose = clutter_actor_dispose;
@@ -7694,26 +7672,6 @@ clutter_actor_get_name (ClutterActor *self)
}
/**
- * clutter_actor_get_gid:
- * @self: A #ClutterActor
- *
- * Retrieves the unique id for @self.
- *
- * Return value: Globally unique value for this object instance.
- *
- * Since: 0.6
- *
- * Deprecated: 1.8: The id is not used any longer.
- */
-guint32
-clutter_actor_get_gid (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
- return self->priv->id;
-}
-
-/**
* clutter_actor_set_depth:
* @self: a #ClutterActor
* @depth: Z co-ord
@@ -9933,305 +9891,6 @@ G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterVertex, clutter_vertex,
clutter_vertex_free,
CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_vertex_progress));
-struct _ShaderData
-{
- ClutterShader *shader;
-
- /* back pointer to the actor */
- ClutterActor *actor;
-
- /* list of values that should be set on the shader
- * before each paint cycle
- */
- GHashTable *value_hash;
-};
-
-static void
-shader_value_free (gpointer data)
-{
- GValue *var = data;
- g_value_unset (var);
- g_slice_free (GValue, var);
-}
-
-static void
-destroy_shader_data (gpointer data)
-{
- ShaderData *shader_data = data;
-
- if (shader_data == NULL)
- return;
-
- if (shader_data->shader != NULL)
- {
- g_object_unref (shader_data->shader);
- shader_data->shader = NULL;
- }
-
- if (shader_data->value_hash != NULL)
- {
- g_hash_table_destroy (shader_data->value_hash);
- shader_data->value_hash = NULL;
- }
-
- g_slice_free (ShaderData, shader_data);
-}
-
-
-/**
- * clutter_actor_get_shader:
- * @self: a #ClutterActor
- *
- * Queries the currently set #ClutterShader on @self.
- *
- * Return value: (transfer none): The currently set #ClutterShader
- * or %NULL if no shader is set.
- *
- * Since: 0.6
- *
- * Deprecated: 1.8: Use clutter_actor_get_effect() instead.
- */
-ClutterShader *
-clutter_actor_get_shader (ClutterActor *self)
-{
- ShaderData *shader_data;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- shader_data = g_object_get_qdata (G_OBJECT (self), quark_shader_data);
- if (shader_data != NULL)
- return shader_data->shader;
-
- return NULL;
-}
-
-/**
- * clutter_actor_set_shader:
- * @self: a #ClutterActor
- * @shader: (allow-none): a #ClutterShader or %NULL to unset the shader.
- *
- * Sets the #ClutterShader to be used when rendering @self.
- *
- * If @shader is %NULL this function will unset any currently set shader
- * for the actor.
- *
- * <note>Any #ClutterEffect applied to @self will take the precedence
- * over the #ClutterShader set using this function.</note>
- *
- * Return value: %TRUE if the shader was successfully applied
- * or removed
- *
- * Since: 0.6
- *
- * Deprecated: 1.8: Use #ClutterShaderEffect and
- * clutter_actor_add_effect() instead.
- */
-gboolean
-clutter_actor_set_shader (ClutterActor *self,
- ClutterShader *shader)
-{
- ShaderData *shader_data;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
- g_return_val_if_fail (shader == NULL || CLUTTER_IS_SHADER (shader), FALSE);
-
- if (shader != NULL)
- g_object_ref (shader);
- else
- {
- /* if shader passed in is NULL we destroy the shader */
- g_object_set_qdata (G_OBJECT (self), quark_shader_data, NULL);
- return TRUE;
- }
-
- shader_data = g_object_get_qdata (G_OBJECT (self), quark_shader_data);
- if (shader_data == NULL)
- {
- shader_data = g_slice_new (ShaderData);
- shader_data->actor = self;
- shader_data->shader = NULL;
- shader_data->value_hash =
- g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free,
- shader_value_free);
-
- g_object_set_qdata_full (G_OBJECT (self), quark_shader_data,
- shader_data,
- destroy_shader_data);
- }
-
- if (shader_data->shader != NULL)
- g_object_unref (shader_data->shader);
-
- shader_data->shader = shader;
-
- clutter_actor_queue_redraw (self);
-
- return TRUE;
-}
-
-
-static void
-set_each_param (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- ClutterShader *shader = user_data;
- const gchar *uniform = key;
- GValue *var = value;
-
- clutter_shader_set_uniform (shader, uniform, var);
-}
-
-static void
-clutter_actor_shader_pre_paint (ClutterActor *actor,
- gboolean repeat)
-{
- ShaderData *shader_data;
- ClutterShader *shader;
-
- shader_data = g_object_get_qdata (G_OBJECT (actor), quark_shader_data);
- if (shader_data == NULL)
- return;
-
- shader = shader_data->shader;
- if (shader != NULL)
- {
- clutter_shader_set_is_enabled (shader, TRUE);
-
- g_hash_table_foreach (shader_data->value_hash, set_each_param, shader);
-
- if (!repeat)
- _clutter_context_push_shader_stack (actor);
- }
-}
-
-static void
-clutter_actor_shader_post_paint (ClutterActor *actor)
-{
- ShaderData *shader_data;
- ClutterShader *shader;
-
- shader_data = g_object_get_qdata (G_OBJECT (actor), quark_shader_data);
- if (shader_data == NULL)
- return;
-
- shader = shader_data->shader;
- if (shader != NULL)
- {
- ClutterActor *head;
-
- clutter_shader_set_is_enabled (shader, FALSE);
-
- /* remove the actor from the shaders stack; if there is another
- * actor inside it, then call pre-paint again to set its shader
- * but this time with the second argument being TRUE, indicating
- * that we are re-applying an existing shader and thus should it
- * not be prepended to the stack
- */
- head = _clutter_context_pop_shader_stack (actor);
- if (head != NULL)
- clutter_actor_shader_pre_paint (head, TRUE);
- }
-}
-
-/**
- * clutter_actor_set_shader_param:
- * @self: a #ClutterActor
- * @param: the name of the parameter
- * @value: the value of the parameter
- *
- * Sets the value for a named parameter of the shader applied
- * to @actor.
- *
- * Since: 1.0
- *
- * Deprecated: 1.8: Use clutter_shader_effect_set_uniform_value() instead
- */
-void
-clutter_actor_set_shader_param (ClutterActor *self,
- const gchar *param,
- const GValue *value)
-{
- ShaderData *shader_data;
- GValue *var;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (param != NULL);
- g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value) ||
- CLUTTER_VALUE_HOLDS_SHADER_INT (value) ||
- CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value) ||
- G_VALUE_HOLDS_FLOAT (value) ||
- G_VALUE_HOLDS_INT (value));
-
- shader_data = g_object_get_qdata (G_OBJECT (self), quark_shader_data);
- if (shader_data == NULL)
- return;
-
- var = g_slice_new0 (GValue);
- g_value_init (var, G_VALUE_TYPE (value));
- g_value_copy (value, var);
- g_hash_table_insert (shader_data->value_hash, g_strdup (param), var);
-
- clutter_actor_queue_redraw (self);
-}
-
-/**
- * clutter_actor_set_shader_param_float:
- * @self: a #ClutterActor
- * @param: the name of the parameter
- * @value: the value of the parameter
- *
- * Sets the value for a named float parameter of the shader applied
- * to @actor.
- *
- * Since: 0.8
- *
- * Deprecated: 1.8: Use clutter_shader_effect_set_uniform() instead
- */
-void
-clutter_actor_set_shader_param_float (ClutterActor *self,
- const gchar *param,
- gfloat value)
-{
- GValue var = { 0, };
-
- g_value_init (&var, G_TYPE_FLOAT);
- g_value_set_float (&var, value);
-
- clutter_actor_set_shader_param (self, param, &var);
-
- g_value_unset (&var);
-}
-
-/**
- * clutter_actor_set_shader_param_int:
- * @self: a #ClutterActor
- * @param: the name of the parameter
- * @value: the value of the parameter
- *
- * Sets the value for a named int parameter of the shader applied to
- * @actor.
- *
- * Since: 0.8
- *
- * Deprecated: 1.8: Use clutter_shader_effect_set_uniform() instead
- */
-void
-clutter_actor_set_shader_param_int (ClutterActor *self,
- const gchar *param,
- gint value)
-{
- GValue var = { 0, };
-
- g_value_init (&var, G_TYPE_INT);
- g_value_set_int (&var, value);
-
- clutter_actor_set_shader_param (self, param, &var);
-
- g_value_unset (&var);
-}
-
/**
* clutter_actor_is_rotated:
* @self: a #ClutterActor
diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h
index 832d901..06cf98b 100644
--- a/clutter/clutter-actor.h
+++ b/clutter/clutter-actor.h
@@ -461,10 +461,6 @@ void clutter_actor_set_name (ClutterActor
const gchar *name);
const gchar * clutter_actor_get_name (ClutterActor *self);
-#ifndef CLUTTER_DISABLE_DEPRECATED
-guint32 clutter_actor_get_gid (ClutterActor *self);
-#endif
-
void clutter_actor_set_clip (ClutterActor *self,
gfloat xoff,
gfloat yoff,
@@ -533,25 +529,6 @@ gboolean clutter_actor_event (ClutterActor
ClutterEvent *event,
gboolean capture);
-#ifndef CLUTTER_DISABLE_DEPRECATED
-ClutterActor * clutter_get_actor_by_gid (guint32 id_);
-#endif
-
-#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
-gboolean clutter_actor_set_shader (ClutterActor *self,
- ClutterShader *shader);
-ClutterShader * clutter_actor_get_shader (ClutterActor *self);
-void clutter_actor_set_shader_param (ClutterActor *self,
- const gchar *param,
- const GValue *value);
-void clutter_actor_set_shader_param_int (ClutterActor *self,
- const gchar *param,
- gint value);
-void clutter_actor_set_shader_param_float (ClutterActor *self,
- const gchar *param,
- gfloat value);
-#endif /* CLUTTER_DISABLE_DEPRECATED */
-
void clutter_actor_set_anchor_point (ClutterActor *self,
gfloat anchor_x,
gfloat anchor_y);
diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c
index b21fa06..4a91706 100644
--- a/clutter/clutter-texture.c
+++ b/clutter/clutter-texture.c
@@ -54,7 +54,6 @@
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "clutter-scriptable.h"
-#include "clutter-shader.h"
#include "clutter-stage-private.h"
#include "clutter-util.h"
@@ -476,22 +475,10 @@ update_fbo (ClutterActor *self)
{
ClutterTexture *texture = CLUTTER_TEXTURE (self);
ClutterTexturePrivate *priv = texture->priv;
- ClutterActor *head;
- ClutterShader *shader = NULL;
ClutterActor *stage = NULL;
CoglMatrix projection;
CoglColor transparent_col;
- head = _clutter_context_peek_shader_stack ();
- if (head != NULL)
- shader = clutter_actor_get_shader (head);
-
- /* Temporarily turn off the shader on the top of the context's
- * shader stack, to restore the GL pipeline to it's natural state.
- */
- if (shader != NULL)
- clutter_shader_set_is_enabled (shader, FALSE);
-
/* Redirect drawing to the fbo */
cogl_push_framebuffer (priv->fbo_handle);
@@ -559,10 +546,6 @@ update_fbo (ClutterActor *self)
/* Restore drawing to the previous framebuffer */
cogl_pop_framebuffer ();
-
- /* If there is a shader on top of the shader stack, turn it back on. */
- if (shader != NULL)
- clutter_shader_set_is_enabled (shader, TRUE);
}
static void
diff --git a/clutter/clutter-types.h b/clutter/clutter-types.h
index 59e689e..a19a77b 100644
--- a/clutter/clutter-types.h
+++ b/clutter/clutter-types.h
@@ -53,10 +53,6 @@ typedef struct _ClutterAction ClutterAction;
typedef struct _ClutterConstraint ClutterConstraint;
typedef struct _ClutterEffect ClutterEffect;
-#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
-typedef struct _ClutterShader ClutterShader;
-#endif
-
typedef struct _ClutterColor ClutterColor;
typedef union _ClutterEvent ClutterEvent;
diff --git a/clutter/clutter.h b/clutter/clutter.h
index d64a9b7..b9d8815 100644
--- a/clutter/clutter.h
+++ b/clutter/clutter.h
@@ -93,7 +93,6 @@
#include "clutter-scriptable.h"
#include "clutter-script.h"
#include "clutter-settings.h"
-#include "clutter-shader.h"
#include "clutter-shader-effect.h"
#include "clutter-shader-types.h"
#include "clutter-swipe-action.h"
diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt
index 44fd85d..0167aba 100644
--- a/doc/reference/clutter/clutter-sections.txt
+++ b/doc/reference/clutter/clutter-sections.txt
@@ -1570,64 +1570,6 @@ clutter_score_get_type
</SECTION>
<SECTION>
-<FILE>clutter-shader</FILE>
-<TITLE>Shaders</TITLE>
-ClutterShaderError
-ClutterShader
-ClutterShaderClass
-clutter_shader_new
-clutter_shader_set_vertex_source
-clutter_shader_get_vertex_source
-clutter_shader_set_fragment_source
-clutter_shader_get_fragment_source
-clutter_shader_compile
-clutter_shader_release
-clutter_shader_is_compiled
-clutter_shader_set_is_enabled
-clutter_shader_get_is_enabled
-
-<SUBSECTION>
-clutter_shader_set_uniform
-clutter_shader_get_cogl_program
-clutter_shader_get_cogl_fragment_shader
-clutter_shader_get_cogl_vertex_shader
-
-<SUBSECTION>
-CLUTTER_VALUE_HOLDS_SHADER_FLOAT
-clutter_value_set_shader_float
-clutter_value_get_shader_float
-CLUTTER_VALUE_HOLDS_SHADER_INT
-clutter_value_set_shader_int
-clutter_value_get_shader_int
-CLUTTER_VALUE_HOLDS_SHADER_MATRIX
-clutter_value_set_shader_matrix
-clutter_value_get_shader_matrix
-
-<SUBSECTION Standard>
-CLUTTER_IS_SHADER
-CLUTTER_IS_SHADER_CLASS
-CLUTTER_SHADER
-CLUTTER_SHADER_CLASS
-CLUTTER_SHADER_ERROR
-CLUTTER_SHADER_GET_CLASS
-CLUTTER_TYPE_SHADER
-CLUTTER_TYPE_SHADER_FLOAT
-CLUTTER_TYPE_SHADER_INT
-CLUTTER_TYPE_SHADER_MATRIX
-
-<SUBSECTION Private>
-ClutterShaderPrivate
-clutter_shader_get_type
-ClutterShaderFloat
-clutter_shader_float_get_type
-ClutterShaderInt
-clutter_shader_int_get_type
-ClutterShaderMatrix
-clutter_shader_matrix_get_type
-clutter_shader_error_quark
-</SECTION>
-
-<SECTION>
<TITLE>Implicit Animations</TITLE>
<FILE>clutter-animation</FILE>
ClutterAnimation
@@ -2525,10 +2467,23 @@ ClutterShaderEffectClass
clutter_shader_effect_new
clutter_shader_effect_set_uniform
clutter_shader_effect_set_uniform_value
+
<SUBSECTION>
clutter_shader_effect_set_shader_source
clutter_shader_effect_get_program
clutter_shader_effect_get_shader
+
+<SUBSECTION>
+CLUTTER_VALUE_HOLDS_SHADER_FLOAT
+clutter_value_set_shader_float
+clutter_value_get_shader_float
+CLUTTER_VALUE_HOLDS_SHADER_INT
+clutter_value_set_shader_int
+clutter_value_get_shader_int
+CLUTTER_VALUE_HOLDS_SHADER_MATRIX
+clutter_value_set_shader_matrix
+clutter_value_get_shader_matrix
+
<SUBSECTION Standard>
CLUTTER_TYPE_SHADER_EFFECT
CLUTTER_SHADER_EFFECT
@@ -2536,9 +2491,20 @@ CLUTTER_SHADER_EFFECT_CLASS
CLUTTER_IS_SHADER_EFFECT
CLUTTER_IS_SHADER_EFFECT_CLASS
CLUTTER_SHADER_EFFECT_GET_CLASS
+CLUTTER_TYPE_SHADER
+CLUTTER_TYPE_SHADER_FLOAT
+CLUTTER_TYPE_SHADER_INT
+CLUTTER_TYPE_SHADER_MATRIX
+
<SUBSECTION Private>
ClutterShaderEffectPrivate
clutter_shader_effect_get_type
+ClutterShaderFloat
+clutter_shader_float_get_type
+ClutterShaderInt
+clutter_shader_int_get_type
+ClutterShaderMatrix
+clutter_shader_matrix_get_type
</SECTION>
<SECTION>
diff --git a/tests/interactive/Makefile.am b/tests/interactive/Makefile.am
index 7ed17e5..61fb6fc 100644
--- a/tests/interactive/Makefile.am
+++ b/tests/interactive/Makefile.am
@@ -16,7 +16,6 @@ UNIT_TESTS = \
test-model.c \
test-grab.c \
test-fullscreen.c \
- test-shader.c \
test-cogl-shader-arbfp.c \
test-cogl-shader-glsl.c \
test-animator.c \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]