cogl: Remove material_set_layer_filters

This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
This commit is contained in:
Fernando Monteiro 2021-09-17 07:36:46 +01:00 committed by Marge Bot
parent 913458381f
commit 8285091585
7 changed files with 26 additions and 94 deletions

View File

@ -136,18 +136,6 @@ cogl_material_set_layer_matrix (CoglMaterial *material,
layer_index, matrix); layer_index, matrix);
} }
void
cogl_material_set_layer_filters (CoglMaterial *material,
int layer_index,
CoglMaterialFilter min_filter,
CoglMaterialFilter mag_filter)
{
cogl_pipeline_set_layer_filters (COGL_PIPELINE (material),
layer_index,
min_filter,
mag_filter);
}
gboolean gboolean
cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material, cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material,
int layer_index, int layer_index,

View File

@ -61,44 +61,6 @@ GType cogl_material_get_type (void);
#define COGL_MATERIAL(OBJECT) ((CoglMaterial *)OBJECT) #define COGL_MATERIAL(OBJECT) ((CoglMaterial *)OBJECT)
/**
* CoglMaterialFilter:
* @COGL_MATERIAL_FILTER_NEAREST: Measuring in manhatten distance from the,
* current pixel center, use the nearest texture texel
* @COGL_MATERIAL_FILTER_LINEAR: Use the weighted average of the 4 texels
* nearest the current pixel center
* @COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST: Select the mimap level whose
* texel size most closely matches the current pixel, and use the
* %COGL_MATERIAL_FILTER_NEAREST criterion
* @COGL_MATERIAL_FILTER_LINEAR_MIPMAP_NEAREST: Select the mimap level whose
* texel size most closely matches the current pixel, and use the
* %COGL_MATERIAL_FILTER_LINEAR criterion
* @COGL_MATERIAL_FILTER_NEAREST_MIPMAP_LINEAR: Select the two mimap levels
* whose texel size most closely matches the current pixel, use
* the %COGL_MATERIAL_FILTER_NEAREST criterion on each one and take
* their weighted average
* @COGL_MATERIAL_FILTER_LINEAR_MIPMAP_LINEAR: Select the two mimap levels
* whose texel size most closely matches the current pixel, use
* the %COGL_MATERIAL_FILTER_LINEAR criterion on each one and take
* their weighted average
*
* Texture filtering is used whenever the current pixel maps either to more
* than one texture element (texel) or less than one. These filter enums
* correspond to different strategies used to come up with a pixel color, by
* possibly referring to multiple neighbouring texels and taking a weighted
* average or simply using the nearest texel.
*/
typedef enum
{
COGL_MATERIAL_FILTER_NEAREST = 0x2600,
COGL_MATERIAL_FILTER_LINEAR = 0x2601,
COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST = 0x2700,
COGL_MATERIAL_FILTER_LINEAR_MIPMAP_NEAREST = 0x2701,
COGL_MATERIAL_FILTER_NEAREST_MIPMAP_LINEAR = 0x2702,
COGL_MATERIAL_FILTER_LINEAR_MIPMAP_LINEAR = 0x2703
} CoglMaterialFilter;
/* NB: these values come from the equivalents in gl.h */
/** /**
* CoglMaterialWrapMode: * CoglMaterialWrapMode:
* @COGL_MATERIAL_WRAP_MODE_REPEAT: The texture will be repeated. This * @COGL_MATERIAL_WRAP_MODE_REPEAT: The texture will be repeated. This
@ -593,24 +555,6 @@ cogl_material_set_layer_matrix (CoglMaterial *material,
int layer_index, int layer_index,
const graphene_matrix_t *matrix); const graphene_matrix_t *matrix);
/**
* cogl_material_set_layer_filters:
* @material: A #CoglMaterial object
* @layer_index: the layer number to change.
* @min_filter: the filter used when scaling a texture down.
* @mag_filter: the filter used when magnifying a texture.
*
* Changes the decimation and interpolation filters used when a texture is
* drawn at other scales than 100%.
* Deprecated: 1.16: Use cogl_pipeline_set_layer_filters() instead
*/
COGL_DEPRECATED_FOR (cogl_pipeline_set_layer_filters)
COGL_EXPORT void
cogl_material_set_layer_filters (CoglMaterial *material,
int layer_index,
CoglMaterialFilter min_filter,
CoglMaterialFilter mag_filter);
/** /**
* cogl_material_set_layer_point_sprite_coords_enabled: * cogl_material_set_layer_point_sprite_coords_enabled:
* @material: a #CoglHandle to a material. * @material: a #CoglHandle to a material.

View File

@ -127,14 +127,14 @@ on_paint (ClutterActor *actor,
/* We'll use nearest filtering mode on the textures, otherwise the /* We'll use nearest filtering mode on the textures, otherwise the
edge of the quad can pull in texels from the neighbouring edge of the quad can pull in texels from the neighbouring
quarters of the texture due to imprecision */ quarters of the texture due to imprecision */
cogl_material_set_layer_filters (material, 0, cogl_pipeline_set_layer_filters (material, 0,
COGL_MATERIAL_FILTER_NEAREST, COGL_PIPELINE_FILTER_NEAREST,
COGL_MATERIAL_FILTER_NEAREST); COGL_PIPELINE_FILTER_NEAREST);
cogl_material_set_layer (material, 1, tex1); cogl_material_set_layer (material, 1, tex1);
cogl_material_set_layer_filters (material, 1, cogl_pipeline_set_layer_filters (material, 1,
COGL_MATERIAL_FILTER_NEAREST, COGL_PIPELINE_FILTER_NEAREST,
COGL_MATERIAL_FILTER_NEAREST); COGL_PIPELINE_FILTER_NEAREST);
status = cogl_material_set_layer_combine (material, 1, status = cogl_material_set_layer_combine (material, 1,
"RGBA = ADD (PREVIOUS, TEXTURE)", "RGBA = ADD (PREVIOUS, TEXTURE)",
&error); &error);

View File

@ -60,14 +60,14 @@ on_paint (ClutterActor *actor,
/* Render a 1x1 pixel quad without mipmaps */ /* Render a 1x1 pixel quad without mipmaps */
cogl_set_source (material); cogl_set_source (material);
cogl_material_set_layer_filters (material, 0, cogl_pipeline_set_layer_filters (material, 0,
COGL_MATERIAL_FILTER_NEAREST, COGL_PIPELINE_FILTER_NEAREST,
COGL_MATERIAL_FILTER_NEAREST); COGL_PIPELINE_FILTER_NEAREST);
cogl_rectangle (0, 0, 1, 1); cogl_rectangle (0, 0, 1, 1);
/* Then with mipmaps */ /* Then with mipmaps */
cogl_material_set_layer_filters (material, 0, cogl_pipeline_set_layer_filters (material, 0,
COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST, COGL_PIPELINE_FILTER_NEAREST_MIPMAP_NEAREST,
COGL_MATERIAL_FILTER_NEAREST); COGL_PIPELINE_FILTER_NEAREST);
cogl_rectangle (1, 0, 2, 1); cogl_rectangle (1, 0, 2, 1);
cogl_object_unref (material); cogl_object_unref (material);

View File

@ -152,14 +152,14 @@ on_after_paint (ClutterActor *actor,
{ {
const CoglMaterialFilter min_filter = const CoglMaterialFilter min_filter =
COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST; COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST;
cogl_material_set_layer_filters (material, 0, cogl_pipeline_set_layer_filters (material, 0,
min_filter, min_filter,
COGL_MATERIAL_FILTER_NEAREST); COGL_PIPELINE_FILTER_NEAREST);
} }
else else
cogl_material_set_layer_filters (material, 0, cogl_pipeline_set_layer_filters (material, 0,
COGL_MATERIAL_FILTER_NEAREST, COGL_PIPELINE_FILTER_NEAREST,
COGL_MATERIAL_FILTER_NEAREST); COGL_PIPELINE_FILTER_NEAREST);
cogl_set_source (material); cogl_set_source (material);
cogl_rectangle (0, 0, PIXMAP_WIDTH, PIXMAP_HEIGHT); cogl_rectangle (0, 0, PIXMAP_WIDTH, PIXMAP_HEIGHT);

View File

@ -48,12 +48,12 @@ frame_cb (ClutterTimeline *timeline,
graphene_matrix_multiply (&state->rot_matrix0, graphene_matrix_multiply (&state->rot_matrix0,
&state->tex_matrix0, &state->tex_matrix0,
&state->tex_matrix0); &state->tex_matrix0);
cogl_material_set_layer_matrix (state->material0, 2, &state->tex_matrix0); cogl_pipeline_set_layer_matrix (state->material0, 2, &state->tex_matrix0);
graphene_matrix_multiply (&state->rot_matrix1, graphene_matrix_multiply (&state->rot_matrix1,
&state->tex_matrix1, &state->tex_matrix1,
&state->tex_matrix1); &state->tex_matrix1);
cogl_material_set_layer_matrix (state->material1, 2, &state->tex_matrix1); cogl_pipeline_set_layer_matrix (state->material1, 2, &state->tex_matrix1);
} }
static void static void

View File

@ -201,17 +201,17 @@ test_coglbox_paint (ClutterActor *self,
int tex_height = cogl_texture_get_height (tex_handle); int tex_height = cogl_texture_get_height (tex_handle);
CoglFramebuffer *framebuffer = CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context); clutter_paint_context_get_framebuffer (paint_context);
CoglHandle material = cogl_material_new (); CoglHandle material = cogl_pipeline_new ();
cogl_material_set_layer (material, 0, tex_handle); cogl_pipeline_set_layer (material, 0, tex_handle);
cogl_material_set_layer_filters (material, 0, cogl_pipeline_set_layer_filters (material, 0,
priv->use_linear_filtering priv->use_linear_filtering
? COGL_MATERIAL_FILTER_LINEAR : ? COGL_PIPELINE_FILTER_LINEAR :
COGL_MATERIAL_FILTER_NEAREST, COGL_PIPELINE_FILTER_NEAREST,
priv->use_linear_filtering priv->use_linear_filtering
? COGL_MATERIAL_FILTER_LINEAR : ? COGL_PIPELINE_FILTER_LINEAR :
COGL_MATERIAL_FILTER_NEAREST); COGL_PIPELINE_FILTER_NEAREST);
cogl_framebuffer_push_matrix (framebuffer); cogl_framebuffer_push_matrix (framebuffer);
cogl_framebuffer_translate (framebuffer, tex_width / 2, 0, 0); cogl_framebuffer_translate (framebuffer, tex_width / 2, 0, 0);