cogl: Remove various unused Attribute functions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3804>
This commit is contained in:
parent
6c972546f1
commit
adf0acbe0d
2 changed files with 2 additions and 558 deletions
|
@ -254,214 +254,6 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static CoglAttribute *
|
||||
_cogl_attribute_new_const (CoglContext *context,
|
||||
const char *name,
|
||||
int n_components,
|
||||
int n_columns,
|
||||
gboolean transpose,
|
||||
const float *value)
|
||||
{
|
||||
CoglAttribute *attribute = g_object_new (COGL_TYPE_ATTRIBUTE, NULL);
|
||||
|
||||
attribute->name_state =
|
||||
g_hash_table_lookup (context->attribute_name_states_hash, name);
|
||||
if (!attribute->name_state)
|
||||
{
|
||||
CoglAttributeNameState *name_state =
|
||||
_cogl_attribute_register_attribute_name (context, name);
|
||||
if (!name_state)
|
||||
goto error;
|
||||
attribute->name_state = name_state;
|
||||
}
|
||||
|
||||
if (!validate_n_components (attribute->name_state, n_components))
|
||||
goto error;
|
||||
|
||||
attribute->is_buffered = FALSE;
|
||||
attribute->normalized = FALSE;
|
||||
|
||||
attribute->d.constant.context = g_object_ref (context);
|
||||
|
||||
attribute->d.constant.boxed.v.array = NULL;
|
||||
|
||||
if (n_columns == 1)
|
||||
{
|
||||
_cogl_boxed_value_set_float (&attribute->d.constant.boxed,
|
||||
n_components,
|
||||
1,
|
||||
value);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: Up until GL[ES] 3 only square matrices were supported
|
||||
* and we don't currently expose non-square matrices in Cogl.
|
||||
*/
|
||||
g_return_val_if_fail (n_columns == n_components, NULL);
|
||||
_cogl_boxed_value_set_matrix (&attribute->d.constant.boxed,
|
||||
n_columns,
|
||||
1,
|
||||
transpose,
|
||||
value);
|
||||
}
|
||||
|
||||
return attribute;
|
||||
|
||||
error:
|
||||
g_object_unref (attribute);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CoglAttribute *
|
||||
cogl_attribute_new_const_1f (CoglContext *context,
|
||||
const char *name,
|
||||
float value)
|
||||
{
|
||||
return _cogl_attribute_new_const (context,
|
||||
name,
|
||||
1, /* n_components */
|
||||
1, /* 1 column vector */
|
||||
FALSE, /* no transpose */
|
||||
&value);
|
||||
}
|
||||
|
||||
CoglAttribute *
|
||||
cogl_attribute_new_const_2fv (CoglContext *context,
|
||||
const char *name,
|
||||
const float *value)
|
||||
{
|
||||
return _cogl_attribute_new_const (context,
|
||||
name,
|
||||
2, /* n_components */
|
||||
1, /* 1 column vector */
|
||||
FALSE, /* no transpose */
|
||||
value);
|
||||
}
|
||||
|
||||
CoglAttribute *
|
||||
cogl_attribute_new_const_3fv (CoglContext *context,
|
||||
const char *name,
|
||||
const float *value)
|
||||
{
|
||||
return _cogl_attribute_new_const (context,
|
||||
name,
|
||||
3, /* n_components */
|
||||
1, /* 1 column vector */
|
||||
FALSE, /* no transpose */
|
||||
value);
|
||||
}
|
||||
|
||||
CoglAttribute *
|
||||
cogl_attribute_new_const_4fv (CoglContext *context,
|
||||
const char *name,
|
||||
const float *value)
|
||||
{
|
||||
return _cogl_attribute_new_const (context,
|
||||
name,
|
||||
4, /* n_components */
|
||||
1, /* 1 column vector */
|
||||
FALSE, /* no transpose */
|
||||
value);
|
||||
}
|
||||
|
||||
CoglAttribute *
|
||||
cogl_attribute_new_const_2f (CoglContext *context,
|
||||
const char *name,
|
||||
float component0,
|
||||
float component1)
|
||||
{
|
||||
float vec2[2] = { component0, component1 };
|
||||
return _cogl_attribute_new_const (context,
|
||||
name,
|
||||
2, /* n_components */
|
||||
1, /* 1 column vector */
|
||||
FALSE, /* no transpose */
|
||||
vec2);
|
||||
}
|
||||
|
||||
CoglAttribute *
|
||||
cogl_attribute_new_const_3f (CoglContext *context,
|
||||
const char *name,
|
||||
float component0,
|
||||
float component1,
|
||||
float component2)
|
||||
{
|
||||
float vec3[3] = { component0, component1, component2 };
|
||||
return _cogl_attribute_new_const (context,
|
||||
name,
|
||||
3, /* n_components */
|
||||
1, /* 1 column vector */
|
||||
FALSE, /* no transpose */
|
||||
vec3);
|
||||
}
|
||||
|
||||
CoglAttribute *
|
||||
cogl_attribute_new_const_4f (CoglContext *context,
|
||||
const char *name,
|
||||
float component0,
|
||||
float component1,
|
||||
float component2,
|
||||
float component3)
|
||||
{
|
||||
float vec4[4] = { component0, component1, component2, component3 };
|
||||
return _cogl_attribute_new_const (context,
|
||||
name,
|
||||
4, /* n_components */
|
||||
1, /* 1 column vector */
|
||||
FALSE, /* no transpose */
|
||||
vec4);
|
||||
}
|
||||
|
||||
CoglAttribute *
|
||||
cogl_attribute_new_const_2x2fv (CoglContext *context,
|
||||
const char *name,
|
||||
const float *matrix2x2,
|
||||
gboolean transpose)
|
||||
{
|
||||
return _cogl_attribute_new_const (context,
|
||||
name,
|
||||
2, /* n_components */
|
||||
2, /* 2 column vector */
|
||||
FALSE, /* no transpose */
|
||||
matrix2x2);
|
||||
}
|
||||
|
||||
CoglAttribute *
|
||||
cogl_attribute_new_const_3x3fv (CoglContext *context,
|
||||
const char *name,
|
||||
const float *matrix3x3,
|
||||
gboolean transpose)
|
||||
{
|
||||
return _cogl_attribute_new_const (context,
|
||||
name,
|
||||
3, /* n_components */
|
||||
3, /* 3 column vector */
|
||||
FALSE, /* no transpose */
|
||||
matrix3x3);
|
||||
}
|
||||
|
||||
CoglAttribute *
|
||||
cogl_attribute_new_const_4x4fv (CoglContext *context,
|
||||
const char *name,
|
||||
const float *matrix4x4,
|
||||
gboolean transpose)
|
||||
{
|
||||
return _cogl_attribute_new_const (context,
|
||||
name,
|
||||
4, /* n_components */
|
||||
4, /* 4 column vector */
|
||||
FALSE, /* no transpose */
|
||||
matrix4x4);
|
||||
}
|
||||
|
||||
gboolean
|
||||
cogl_attribute_get_normalized (CoglAttribute *attribute)
|
||||
{
|
||||
g_return_val_if_fail (COGL_IS_ATTRIBUTE (attribute), FALSE);
|
||||
|
||||
return attribute->normalized;
|
||||
}
|
||||
|
||||
static void
|
||||
warn_about_midscene_changes (void)
|
||||
{
|
||||
|
@ -495,22 +287,6 @@ cogl_attribute_get_buffer (CoglAttribute *attribute)
|
|||
return attribute->d.buffered.attribute_buffer;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_attribute_set_buffer (CoglAttribute *attribute,
|
||||
CoglAttributeBuffer *attribute_buffer)
|
||||
{
|
||||
g_return_if_fail (COGL_IS_ATTRIBUTE (attribute));
|
||||
g_return_if_fail (attribute->is_buffered);
|
||||
|
||||
if (G_UNLIKELY (attribute->immutable_ref))
|
||||
warn_about_midscene_changes ();
|
||||
|
||||
g_object_ref (attribute_buffer);
|
||||
|
||||
g_object_unref (attribute->d.buffered.attribute_buffer);
|
||||
attribute->d.buffered.attribute_buffer = attribute_buffer;
|
||||
}
|
||||
|
||||
CoglAttribute *
|
||||
_cogl_attribute_immutable_ref (CoglAttribute *attribute)
|
||||
{
|
||||
|
|
|
@ -79,7 +79,7 @@ G_DECLARE_FINAL_TYPE (CoglAttribute,
|
|||
* The @name is used to access the attribute inside a GLSL vertex
|
||||
* shader and there are some special names you should use if they are
|
||||
* applicable:
|
||||
*
|
||||
*
|
||||
* - "cogl_position_in" (used for vertex positions)
|
||||
* - "cogl_color_in" (used for vertex colors)
|
||||
* - "cogl_tex_coord0_in", "cogl_tex_coord1", ...
|
||||
|
@ -151,317 +151,6 @@ cogl_attribute_new (CoglAttributeBuffer *attribute_buffer,
|
|||
int components,
|
||||
CoglAttributeType type);
|
||||
|
||||
/**
|
||||
* cogl_attribute_new_const_1f:
|
||||
* @context: A #CoglContext
|
||||
* @name: The name of the attribute (used to reference it from GLSL)
|
||||
* @value: The constant value for the attribute
|
||||
*
|
||||
* Creates a new, single component, attribute whose value remains
|
||||
* constant across all the vertices of a primitive without needing to
|
||||
* duplicate the value for each vertex.
|
||||
*
|
||||
* The constant @value is a single precision floating point scalar
|
||||
* which should have a corresponding declaration in GLSL code like:
|
||||
*
|
||||
* [|
|
||||
* attribute float name;
|
||||
* |]
|
||||
*
|
||||
* Return value: (transfer full): A newly allocated #CoglAttribute
|
||||
* representing the given constant @value.
|
||||
*/
|
||||
COGL_EXPORT CoglAttribute *
|
||||
cogl_attribute_new_const_1f (CoglContext *context,
|
||||
const char *name,
|
||||
float value);
|
||||
|
||||
/**
|
||||
* cogl_attribute_new_const_2f:
|
||||
* @context: A #CoglContext
|
||||
* @name: The name of the attribute (used to reference it from GLSL)
|
||||
* @component0: The first component of a 2 component vector
|
||||
* @component1: The second component of a 2 component vector
|
||||
*
|
||||
* Creates a new, 2 component, attribute whose value remains
|
||||
* constant across all the vertices of a primitive without needing to
|
||||
* duplicate the value for each vertex.
|
||||
*
|
||||
* The constants (@component0, @component1) represent a 2 component
|
||||
* float vector which should have a corresponding declaration in GLSL
|
||||
* code like:
|
||||
*
|
||||
* [|
|
||||
* attribute vec2 name;
|
||||
* |]
|
||||
*
|
||||
* Return value: (transfer full): A newly allocated #CoglAttribute
|
||||
* representing the given constant vector.
|
||||
*/
|
||||
COGL_EXPORT CoglAttribute *
|
||||
cogl_attribute_new_const_2f (CoglContext *context,
|
||||
const char *name,
|
||||
float component0,
|
||||
float component1);
|
||||
|
||||
/**
|
||||
* cogl_attribute_new_const_3f:
|
||||
* @context: A #CoglContext
|
||||
* @name: The name of the attribute (used to reference it from GLSL)
|
||||
* @component0: The first component of a 3 component vector
|
||||
* @component1: The second component of a 3 component vector
|
||||
* @component2: The third component of a 3 component vector
|
||||
*
|
||||
* Creates a new, 3 component, attribute whose value remains
|
||||
* constant across all the vertices of a primitive without needing to
|
||||
* duplicate the value for each vertex.
|
||||
*
|
||||
* The constants (@component0, @component1, @component2) represent a 3
|
||||
* component float vector which should have a corresponding
|
||||
* declaration in GLSL code like:
|
||||
*
|
||||
* [|
|
||||
* attribute vec3 name;
|
||||
* |]
|
||||
*
|
||||
* unless the built in name "cogl_normal_in" is being used where no
|
||||
* explicit GLSL declaration need be made.
|
||||
*
|
||||
* Return value: (transfer full): A newly allocated #CoglAttribute
|
||||
* representing the given constant vector.
|
||||
*/
|
||||
COGL_EXPORT CoglAttribute *
|
||||
cogl_attribute_new_const_3f (CoglContext *context,
|
||||
const char *name,
|
||||
float component0,
|
||||
float component1,
|
||||
float component2);
|
||||
|
||||
/**
|
||||
* cogl_attribute_new_const_4f:
|
||||
* @context: A #CoglContext
|
||||
* @name: The name of the attribute (used to reference it from GLSL)
|
||||
* @component0: The first component of a 4 component vector
|
||||
* @component1: The second component of a 4 component vector
|
||||
* @component2: The third component of a 4 component vector
|
||||
* @component3: The fourth component of a 4 component vector
|
||||
*
|
||||
* Creates a new, 4 component, attribute whose value remains
|
||||
* constant across all the vertices of a primitive without needing to
|
||||
* duplicate the value for each vertex.
|
||||
*
|
||||
* The constants (@component0, @component1, @component2, @constant3)
|
||||
* represent a 4 component float vector which should have a
|
||||
* corresponding declaration in GLSL code like:
|
||||
*
|
||||
* [|
|
||||
* attribute vec4 name;
|
||||
* |]
|
||||
*
|
||||
* unless one of the built in names "cogl_color_in",
|
||||
* "cogl_tex_coord0_in or "cogl_tex_coord1_in" etc is being used where
|
||||
* no explicit GLSL declaration need be made.
|
||||
*
|
||||
* Return value: (transfer full): A newly allocated #CoglAttribute
|
||||
* representing the given constant vector.
|
||||
*/
|
||||
COGL_EXPORT CoglAttribute *
|
||||
cogl_attribute_new_const_4f (CoglContext *context,
|
||||
const char *name,
|
||||
float component0,
|
||||
float component1,
|
||||
float component2,
|
||||
float component3);
|
||||
|
||||
/**
|
||||
* cogl_attribute_new_const_2fv:
|
||||
* @context: A #CoglContext
|
||||
* @name: The name of the attribute (used to reference it from GLSL)
|
||||
* @value: A pointer to a 2 component float vector
|
||||
*
|
||||
* Creates a new, 2 component, attribute whose value remains
|
||||
* constant across all the vertices of a primitive without needing to
|
||||
* duplicate the value for each vertex.
|
||||
*
|
||||
* The constants (value[0], value[1]) represent a 2 component float
|
||||
* vector which should have a corresponding declaration in GLSL code
|
||||
* like:
|
||||
*
|
||||
* [|
|
||||
* attribute vec2 name;
|
||||
* |]
|
||||
*
|
||||
* Return value: (transfer full): A newly allocated #CoglAttribute
|
||||
* representing the given constant vector.
|
||||
*/
|
||||
COGL_EXPORT CoglAttribute *
|
||||
cogl_attribute_new_const_2fv (CoglContext *context,
|
||||
const char *name,
|
||||
const float *value);
|
||||
|
||||
/**
|
||||
* cogl_attribute_new_const_3fv:
|
||||
* @context: A #CoglContext
|
||||
* @name: The name of the attribute (used to reference it from GLSL)
|
||||
* @value: A pointer to a 3 component float vector
|
||||
*
|
||||
* Creates a new, 3 component, attribute whose value remains
|
||||
* constant across all the vertices of a primitive without needing to
|
||||
* duplicate the value for each vertex.
|
||||
*
|
||||
* The constants (value[0], value[1], value[2]) represent a 3
|
||||
* component float vector which should have a corresponding
|
||||
* declaration in GLSL code like:
|
||||
*
|
||||
* [|
|
||||
* attribute vec3 name;
|
||||
* |]
|
||||
*
|
||||
* unless the built in name "cogl_normal_in" is being used where no
|
||||
* explicit GLSL declaration need be made.
|
||||
*
|
||||
* Return value: (transfer full): A newly allocated #CoglAttribute
|
||||
* representing the given constant vector.
|
||||
*/
|
||||
COGL_EXPORT CoglAttribute *
|
||||
cogl_attribute_new_const_3fv (CoglContext *context,
|
||||
const char *name,
|
||||
const float *value);
|
||||
|
||||
/**
|
||||
* cogl_attribute_new_const_4fv:
|
||||
* @context: A #CoglContext
|
||||
* @name: The name of the attribute (used to reference it from GLSL)
|
||||
* @value: A pointer to a 4 component float vector
|
||||
*
|
||||
* Creates a new, 4 component, attribute whose value remains
|
||||
* constant across all the vertices of a primitive without needing to
|
||||
* duplicate the value for each vertex.
|
||||
*
|
||||
* The constants (value[0], value[1], value[2], value[3]) represent a
|
||||
* 4 component float vector which should have a corresponding
|
||||
* declaration in GLSL code like:
|
||||
*
|
||||
* [|
|
||||
* attribute vec4 name;
|
||||
* |]
|
||||
*
|
||||
* unless one of the built in names "cogl_color_in",
|
||||
* "cogl_tex_coord0_in or "cogl_tex_coord1_in" etc is being used where
|
||||
* no explicit GLSL declaration need be made.
|
||||
*
|
||||
* Return value: (transfer full): A newly allocated #CoglAttribute
|
||||
* representing the given constant vector.
|
||||
*/
|
||||
COGL_EXPORT CoglAttribute *
|
||||
cogl_attribute_new_const_4fv (CoglContext *context,
|
||||
const char *name,
|
||||
const float *value);
|
||||
|
||||
/**
|
||||
* cogl_attribute_new_const_2x2fv:
|
||||
* @context: A #CoglContext
|
||||
* @name: The name of the attribute (used to reference it from GLSL)
|
||||
* @matrix2x2: A pointer to a 2 by 2 matrix
|
||||
* @transpose: Whether the matrix should be transposed on upload or
|
||||
* not
|
||||
*
|
||||
* Creates a new matrix attribute whose value remains constant
|
||||
* across all the vertices of a primitive without needing to duplicate
|
||||
* the value for each vertex.
|
||||
*
|
||||
* @matrix2x2 represent a square 2 by 2 matrix specified in
|
||||
* column-major order (each pair of consecutive numbers represents a
|
||||
* column) which should have a corresponding declaration in GLSL code
|
||||
* like:
|
||||
*
|
||||
* [|
|
||||
* attribute mat2 name;
|
||||
* |]
|
||||
*
|
||||
* If @transpose is %TRUE then all matrix components are rotated
|
||||
* around the diagonal of the matrix such that the first column
|
||||
* becomes the first row and the second column becomes the second row.
|
||||
*
|
||||
* Return value: (transfer full): A newly allocated #CoglAttribute
|
||||
* representing the given constant matrix.
|
||||
*/
|
||||
COGL_EXPORT CoglAttribute *
|
||||
cogl_attribute_new_const_2x2fv (CoglContext *context,
|
||||
const char *name,
|
||||
const float *matrix2x2,
|
||||
gboolean transpose);
|
||||
|
||||
/**
|
||||
* cogl_attribute_new_const_3x3fv:
|
||||
* @context: A #CoglContext
|
||||
* @name: The name of the attribute (used to reference it from GLSL)
|
||||
* @matrix3x3: A pointer to a 3 by 3 matrix
|
||||
* @transpose: Whether the matrix should be transposed on upload or
|
||||
* not
|
||||
*
|
||||
* Creates a new matrix attribute whose value remains constant
|
||||
* across all the vertices of a primitive without needing to duplicate
|
||||
* the value for each vertex.
|
||||
*
|
||||
* @matrix3x3 represent a square 3 by 3 matrix specified in
|
||||
* column-major order (each triple of consecutive numbers represents a
|
||||
* column) which should have a corresponding declaration in GLSL code
|
||||
* like:
|
||||
*
|
||||
* [|
|
||||
* attribute mat3 name;
|
||||
* |]
|
||||
*
|
||||
* If @transpose is %TRUE then all matrix components are rotated
|
||||
* around the diagonal of the matrix such that the first column
|
||||
* becomes the first row and the second column becomes the second row
|
||||
* etc.
|
||||
*
|
||||
* Return value: (transfer full): A newly allocated #CoglAttribute
|
||||
* representing the given constant matrix.
|
||||
*/
|
||||
COGL_EXPORT CoglAttribute *
|
||||
cogl_attribute_new_const_3x3fv (CoglContext *context,
|
||||
const char *name,
|
||||
const float *matrix3x3,
|
||||
gboolean transpose);
|
||||
|
||||
/**
|
||||
* cogl_attribute_new_const_4x4fv:
|
||||
* @context: A #CoglContext
|
||||
* @name: The name of the attribute (used to reference it from GLSL)
|
||||
* @matrix4x4: A pointer to a 4 by 4 matrix
|
||||
* @transpose: Whether the matrix should be transposed on upload or
|
||||
* not
|
||||
*
|
||||
* Creates a new matrix attribute whose value remains constant
|
||||
* across all the vertices of a primitive without needing to duplicate
|
||||
* the value for each vertex.
|
||||
*
|
||||
* @matrix4x4 represent a square 4 by 4 matrix specified in
|
||||
* column-major order (each 4-tuple of consecutive numbers represents a
|
||||
* column) which should have a corresponding declaration in GLSL code
|
||||
* like:
|
||||
*
|
||||
* [|
|
||||
* attribute mat4 name;
|
||||
* |]
|
||||
*
|
||||
* If @transpose is %TRUE then all matrix components are rotated
|
||||
* around the diagonal of the matrix such that the first column
|
||||
* becomes the first row and the second column becomes the second row
|
||||
* etc.
|
||||
*
|
||||
* Return value: (transfer full): A newly allocated #CoglAttribute
|
||||
* representing the given constant matrix.
|
||||
*/
|
||||
COGL_EXPORT CoglAttribute *
|
||||
cogl_attribute_new_const_4x4fv (CoglContext *context,
|
||||
const char *name,
|
||||
const float *matrix4x4,
|
||||
gboolean transpose);
|
||||
|
||||
/**
|
||||
* cogl_attribute_set_normalized:
|
||||
* @attribute: A #CoglAttribute
|
||||
|
@ -481,35 +170,14 @@ COGL_EXPORT void
|
|||
cogl_attribute_set_normalized (CoglAttribute *attribute,
|
||||
gboolean normalized);
|
||||
|
||||
/**
|
||||
* cogl_attribute_get_normalized:
|
||||
* @attribute: A #CoglAttribute
|
||||
*
|
||||
* Return value: the value of the normalized property set with
|
||||
* cogl_attribute_set_normalized().
|
||||
*/
|
||||
COGL_EXPORT gboolean
|
||||
cogl_attribute_get_normalized (CoglAttribute *attribute);
|
||||
|
||||
/**
|
||||
* cogl_attribute_get_buffer:
|
||||
* @attribute: A #CoglAttribute
|
||||
*
|
||||
* Return value: (transfer none): the #CoglAttributeBuffer that was
|
||||
* set with cogl_attribute_set_buffer() or cogl_attribute_new().
|
||||
* set with cogl_attribute_new().
|
||||
*/
|
||||
COGL_EXPORT CoglAttributeBuffer *
|
||||
cogl_attribute_get_buffer (CoglAttribute *attribute);
|
||||
|
||||
/**
|
||||
* cogl_attribute_set_buffer:
|
||||
* @attribute: A #CoglAttribute
|
||||
* @attribute_buffer: A #CoglAttributeBuffer
|
||||
*
|
||||
* Sets a new #CoglAttributeBuffer for the attribute.
|
||||
*/
|
||||
COGL_EXPORT void
|
||||
cogl_attribute_set_buffer (CoglAttribute *attribute,
|
||||
CoglAttributeBuffer *attribute_buffer);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in a new issue