clutter: Remove duplicated ShaderType

As we have the exact same one in Cogl.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4127>
This commit is contained in:
Bilal Elmoussaoui 2024-11-10 18:27:32 +01:00 committed by Marge Bot
parent 1ba28bc6b4
commit d92bb351da
7 changed files with 23 additions and 50 deletions

View File

@ -235,19 +235,6 @@ typedef enum
CLUTTER_TEXT_DIRECTION_RTL
} ClutterTextDirection;
/**
* ClutterShaderType:
* @CLUTTER_VERTEX_SHADER: a vertex shader
* @CLUTTER_FRAGMENT_SHADER: a fragment shader
*
* The type of GLSL shader program
*/
typedef enum
{
CLUTTER_VERTEX_SHADER,
CLUTTER_FRAGMENT_SHADER
} ClutterShaderType;
/**
* ClutterModifierType:
* @CLUTTER_SHIFT_MASK: Mask applied by the Shift key

View File

@ -135,7 +135,7 @@ typedef struct _ClutterShaderEffectPrivate
{
ClutterActor *actor;
ClutterShaderType shader_type;
CoglShaderType shader_type;
CoglProgram *program;
CoglShader *shader;
@ -302,20 +302,7 @@ clutter_shader_effect_create_shader (ClutterShaderEffect *self)
ClutterShaderEffectPrivate *priv =
clutter_shader_effect_get_instance_private (self);
switch (priv->shader_type)
{
case CLUTTER_FRAGMENT_SHADER:
return cogl_shader_new (COGL_SHADER_TYPE_FRAGMENT);
break;
case CLUTTER_VERTEX_SHADER:
return cogl_shader_new (COGL_SHADER_TYPE_VERTEX);
break;
default:
g_assert_not_reached ();
return NULL;
}
return cogl_shader_new (priv->shader_type);
}
static void
@ -451,8 +438,8 @@ clutter_shader_effect_class_init (ClutterShaderEffectClass *klass)
*/
obj_props[PROP_SHADER_TYPE] =
g_param_spec_enum ("shader-type", NULL, NULL,
CLUTTER_TYPE_SHADER_TYPE,
CLUTTER_FRAGMENT_SHADER,
COGL_TYPE_SHADER_TYPE,
COGL_SHADER_TYPE_FRAGMENT,
G_PARAM_WRITABLE |
G_PARAM_STATIC_STRINGS |
G_PARAM_CONSTRUCT_ONLY);
@ -474,13 +461,12 @@ clutter_shader_effect_init (ClutterShaderEffect *effect)
ClutterShaderEffectPrivate *priv =
clutter_shader_effect_get_instance_private (effect);
priv->shader_type = CLUTTER_FRAGMENT_SHADER;
priv->shader_type = COGL_SHADER_TYPE_FRAGMENT;
}
/**
* clutter_shader_effect_new:
* @shader_type: the type of the shader, either %CLUTTER_FRAGMENT_SHADER,
* or %CLUTTER_VERTEX_SHADER
* @shader_type: the type of the shader
*
* Creates a new #ClutterShaderEffect, to be applied to an actor using
* [method@Actor.add_effect].
@ -492,7 +478,7 @@ clutter_shader_effect_init (ClutterShaderEffect *effect)
* Use g_object_unref() when done.
*/
ClutterEffect *
clutter_shader_effect_new (ClutterShaderType shader_type)
clutter_shader_effect_new (CoglShaderType shader_type)
{
return g_object_new (CLUTTER_TYPE_SHADER_EFFECT,
"shader-type", shader_type,

View File

@ -62,7 +62,7 @@ struct _ClutterShaderEffectClass
};
CLUTTER_EXPORT
ClutterEffect * clutter_shader_effect_new (ClutterShaderType shader_type);
ClutterEffect * clutter_shader_effect_new (CoglShaderType shader_type);
CLUTTER_EXPORT
gboolean clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect,

View File

@ -311,6 +311,19 @@ typedef enum /*< prefix=COGL_READ_PIXELS >*/
COGL_READ_PIXELS_COLOR_BUFFER = 1L << 0
} CoglReadPixelsFlags;
/**
* CoglShaderType:
* @COGL_SHADER_TYPE_VERTEX: A program for processing vertices
* @COGL_SHADER_TYPE_FRAGMENT: A program for processing fragments
*
* Types of shaders
*/
typedef enum
{
COGL_SHADER_TYPE_VERTEX,
COGL_SHADER_TYPE_FRAGMENT
} CoglShaderType;
typedef struct _CoglAttribute CoglAttribute;
typedef struct _CoglAttributeBuffer CoglAttributeBuffer;
typedef struct _CoglAtlas CoglAtlas;

View File

@ -131,19 +131,6 @@ G_DECLARE_FINAL_TYPE (CoglShader,
SHADER,
GObject)
/**
* CoglShaderType:
* @COGL_SHADER_TYPE_VERTEX: A program for processing vertices
* @COGL_SHADER_TYPE_FRAGMENT: A program for processing fragments
*
* Types of shaders
*/
typedef enum
{
COGL_SHADER_TYPE_VERTEX,
COGL_SHADER_TYPE_FRAGMENT
} CoglShaderType;
/**
* cogl_shader_new:
* @shader_type: COGL_SHADER_TYPE_VERTEX or COGL_SHADER_TYPE_FRAGMENT.

View File

@ -54,7 +54,6 @@ cogl_headers = [
'cogl-texture-2d-sliced.h',
'cogl-texture.h',
'cogl-trace.h',
'cogl-types.h',
]
cogl_nonintrospected_headers = [
@ -331,6 +330,7 @@ endif
cogl_enum_headers = [
'cogl-buffer.h',
'cogl-pixel-format.h',
'cogl-types.h',
]
cogl_headers += [

View File

@ -204,7 +204,7 @@ test_bind_constraint_main (int argc, char *argv[])
* properties; so we use the ActorMeta:enabled property to toggle
* the shader
*/
effect = clutter_shader_effect_new (CLUTTER_FRAGMENT_SHADER);
effect = clutter_shader_effect_new (COGL_SHADER_TYPE_FRAGMENT);
clutter_shader_effect_set_shader_source (CLUTTER_SHADER_EFFECT (effect),
desaturare_glsl_shader);
clutter_shader_effect_set_uniform (CLUTTER_SHADER_EFFECT (effect),