[mutter] tests: Rename 'material' variables to 'pipeline'
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] tests: Rename 'material' variables to 'pipeline'
- Date: Tue, 7 Dec 2021 16:02:29 +0000 (UTC)
commit 0c5cf1ec5824308323bd7be144712aa8fd3eaa47
Author: Fernando Monteiro <fr02monteiro gmail com>
Date: Mon Oct 18 23:11:38 2021 +0100
tests: Rename 'material' variables to 'pipeline'
This should replace all usages of the material variable to
the pipeline variable.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
cogl/tests/conform/test-multitexture.c | 24 ++++++------
cogl/tests/conform/test-texture-mipmaps.c | 14 +++----
cogl/tests/conform/test-texture-pixmap-x11.c | 16 ++++----
.../clutter/interactive/test-cogl-multitexture.c | 44 +++++++++++-----------
.../clutter/interactive/test-cogl-point-sprites.c | 14 ++++---
.../clutter/interactive/test-cogl-shader-glsl.c | 18 ++++++---
.../clutter/interactive/test-cogl-tex-polygon.c | 23 ++++++-----
7 files changed, 83 insertions(+), 70 deletions(-)
---
diff --git a/cogl/tests/conform/test-multitexture.c b/cogl/tests/conform/test-multitexture.c
index 2231664bed..6257206737 100644
--- a/cogl/tests/conform/test-multitexture.c
+++ b/cogl/tests/conform/test-multitexture.c
@@ -104,7 +104,7 @@ on_paint (ClutterActor *actor,
TestState *state)
{
CoglHandle tex0, tex1;
- CoglHandle material;
+ CoglPipeline *pipeline;
gboolean status;
GError *error = NULL;
float tex_coords[] = {
@@ -115,27 +115,27 @@ on_paint (ClutterActor *actor,
tex0 = make_texture (0x00);
tex1 = make_texture (0x11);
- material = cogl_material_new ();
+ pipeline = cogl_pipeline_new ();
/* An arbitrary color which should be replaced by the first texture layer */
- cogl_material_set_color4ub (material, 0x80, 0x80, 0x80, 0x80);
- cogl_material_set_blend (material, "RGBA = ADD (SRC_COLOR, 0)", NULL);
+ cogl_pipeline_set_color4ub (pipeline, 0x80, 0x80, 0x80, 0x80);
+ cogl_pipekine_set_blend (pipeline, "RGBA = ADD (SRC_COLOR, 0)", NULL);
- cogl_material_set_layer (material, 0, tex0);
- cogl_material_set_layer_combine (material, 0,
+ cogl_pipeline_set_layer_texture (pipeline, 0, tex0);
+ cogl_pipeline_set_layer_combine (pipeline, 0,
"RGBA = REPLACE (TEXTURE)", NULL);
/* We'll use nearest filtering mode on the textures, otherwise the
edge of the quad can pull in texels from the neighbouring
quarters of the texture due to imprecision */
- cogl_pipeline_set_layer_filters (material, 0,
+ cogl_pipeline_set_layer_filters (pipeline, 0,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
- cogl_material_set_layer (material, 1, tex1);
- cogl_pipeline_set_layer_filters (material, 1,
+ cogl_pipeline_set_layer (pipeline, 1, tex1);
+ cogl_pipeline_set_layer_filters (pipeline, 1,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
- status = cogl_material_set_layer_combine (material, 1,
+ status = cogl_pipeline_set_layer_combine (pipeline, 1,
"RGBA = ADD (PREVIOUS, TEXTURE)",
&error);
if (!status)
@@ -147,11 +147,11 @@ on_paint (ClutterActor *actor,
error->message);
}
- cogl_set_source (material);
+ cogl_set_source (pipeline);
cogl_rectangle_with_multitexture_coords (0, 0, QUAD_WIDTH, QUAD_WIDTH,
tex_coords, 8);
- cogl_object_unref (material);
+ cogl_object_unref (pipeline);
cogl_object_unref (tex0);
cogl_object_unref (tex1);
diff --git a/cogl/tests/conform/test-texture-mipmaps.c b/cogl/tests/conform/test-texture-mipmaps.c
index d3a91292ca..eb9e0cd314 100644
--- a/cogl/tests/conform/test-texture-mipmaps.c
+++ b/cogl/tests/conform/test-texture-mipmaps.c
@@ -50,27 +50,27 @@ on_paint (ClutterActor *actor,
TestState *state)
{
CoglHandle tex;
- CoglHandle material;
+ CoglPipeline *pipeline;
uint8_t pixels[8];
tex = make_texture ();
- material = cogl_material_new ();
- cogl_material_set_layer (material, 0, tex);
+ pipeline = cogl_pipeline_new ();
+ cogl_pipeline_set_layer (pipeline, 0, tex);
cogl_object_unref (tex);
/* Render a 1x1 pixel quad without mipmaps */
- cogl_set_source (material);
- cogl_pipeline_set_layer_filters (material, 0,
+ cogl_set_source (pipeline);
+ cogl_pipeline_set_layer_filters (pipeline, 0,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
cogl_rectangle (0, 0, 1, 1);
/* Then with mipmaps */
- cogl_pipeline_set_layer_filters (material, 0,
+ cogl_pipeline_set_layer_filters (pipeline, 0,
COGL_PIPELINE_FILTER_NEAREST_MIPMAP_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
cogl_rectangle (1, 0, 2, 1);
- cogl_object_unref (material);
+ cogl_object_unref (pipeline);
/* Read back the two pixels we rendered */
cogl_read_pixels (0, 0, 2, 1,
diff --git a/cogl/tests/conform/test-texture-pixmap-x11.c b/cogl/tests/conform/test-texture-pixmap-x11.c
index 9003148ec4..f8eb813f63 100644
--- a/cogl/tests/conform/test-texture-pixmap-x11.c
+++ b/cogl/tests/conform/test-texture-pixmap-x11.c
@@ -144,23 +144,23 @@ on_after_paint (ClutterActor *actor,
ClutterPaintContext *paint_context,
TestState *state)
{
- CoglHandle material;
+ CoglPipeline *pipeline;
- material = cogl_material_new ();
- cogl_material_set_layer (material, 0, state->tfp);
+ pipeline = cogl_pipeline_new ();
+ cogl_pipeline_set_layer (pipeline, 0, state->tfp);
if (state->frame_count == FRAME_COUNT_MIPMAP)
{
- const CoglMaterialFilter min_filter =
- COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST;
- cogl_pipeline_set_layer_filters (material, 0,
+ const CoglPipelineFilter min_filter =
+ COGL_PIPELINE_FILTER_NEAREST_MIPMAP_NEAREST;;
+ cogl_pipeline_set_layer_filters (pipeline, 0,
min_filter,
COGL_PIPELINE_FILTER_NEAREST);
}
else
- cogl_pipeline_set_layer_filters (material, 0,
+ cogl_pipeline_set_layer_filters (pipeline, 0,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
- cogl_set_source (material);
+ cogl_set_source (pipeline);
cogl_rectangle (0, 0, PIXMAP_WIDTH, PIXMAP_HEIGHT);
diff --git a/src/tests/clutter/interactive/test-cogl-multitexture.c
b/src/tests/clutter/interactive/test-cogl-multitexture.c
index bddc407bef..f2c073dd31 100644
--- a/src/tests/clutter/interactive/test-cogl-multitexture.c
+++ b/src/tests/clutter/interactive/test-cogl-multitexture.c
@@ -11,7 +11,7 @@
#include "tests/clutter-test-utils.h"
-typedef struct _TestMultiLayerMaterialState
+typedef struct _TestMultiLayerPipelineState
{
ClutterActor *group;
CoglHandle alpha_tex;
@@ -20,17 +20,17 @@ typedef struct _TestMultiLayerMaterialState
ClutterTimeline *timeline;
- CoglHandle material0;
+ CoglPipeline *pipeline0;
graphene_matrix_t tex_matrix0;
graphene_matrix_t rot_matrix0;
CoglHandle light_tex0;
- CoglHandle material1;
+ CoglPipeline *pipeline1;
graphene_matrix_t tex_matrix1;
graphene_matrix_t rot_matrix1;
CoglHandle light_tex1;
-} TestMultiLayerMaterialState;
+} TestMultiLayerPipelineState;
int
test_cogl_multitexture_main (int argc, char *argv[]);
@@ -43,17 +43,17 @@ frame_cb (ClutterTimeline *timeline,
gint frame_no,
gpointer data)
{
- TestMultiLayerMaterialState *state = data;
+ TestMultiLayerPipelineState *state = data;
graphene_matrix_multiply (&state->rot_matrix0,
&state->tex_matrix0,
&state->tex_matrix0);
- cogl_pipeline_set_layer_matrix (state->material0, 2, &state->tex_matrix0);
+ cogl_pipeline_set_layer_matrix (state->pipeline0, 2, &state->tex_matrix0);
graphene_matrix_multiply (&state->rot_matrix1,
&state->tex_matrix1,
&state->tex_matrix1);
- cogl_pipeline_set_layer_matrix (state->material1, 2, &state->tex_matrix1);
+ cogl_pipeline_set_layer_matrix (state->pipeline1, 2, &state->tex_matrix1);
}
static void
@@ -61,7 +61,7 @@ material_rectangle_paint (ClutterActor *actor,
ClutterPaintContext *paint_context,
gpointer data)
{
- TestMultiLayerMaterialState *state = data;
+ TestMultiLayerPipelineState *state = data;
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
@@ -70,13 +70,13 @@ material_rectangle_paint (ClutterActor *actor,
cogl_framebuffer_translate (framebuffer, 150, 15, 0);
cogl_framebuffer_draw_multitextured_rectangle (framebuffer,
- COGL_FRAMEBUFFER (state->material0),
+ COGL_FRAMEBUFFER (state->pipeline0),
0, 0, 200, 213,
state->tex_coords,
12);
cogl_framebuffer_translate (framebuffer, -300, -30, 0);
cogl_framebuffer_draw_multitextured_rectangle (framebuffer,
- COGL_FRAMEBUFFER (state->material1),
+ COGL_FRAMEBUFFER (state->pipeline1),
0, 0, 200, 213,
state->tex_coords,
12);
@@ -86,7 +86,7 @@ material_rectangle_paint (ClutterActor *actor,
static void
animation_completed_cb (ClutterAnimation *animation,
- TestMultiLayerMaterialState *state)
+ TestMultiLayerPipelineState *state)
{
static gboolean go_back = FALSE;
gdouble new_rotation_y;
@@ -114,7 +114,7 @@ test_cogl_multitexture_main (int argc, char *argv[])
GError *error = NULL;
ClutterActor *stage;
ClutterColor stage_color = { 0x61, 0x56, 0x56, 0xff };
- g_autofree TestMultiLayerMaterialState *state = g_new0 (TestMultiLayerMaterialState, 1);
+ g_autofree TestMultiLayerPipelineState *state = g_new0 (TestMultiLayerPipelineState, 1);
gfloat stage_w, stage_h;
gchar **files;
gfloat tex_coords[] =
@@ -184,15 +184,15 @@ test_cogl_multitexture_main (int argc, char *argv[])
g_strfreev (files);
- state->material0 = cogl_material_new ();
- cogl_material_set_layer (state->material0, 0, state->alpha_tex);
- cogl_material_set_layer (state->material0, 1, state->redhand_tex);
- cogl_material_set_layer (state->material0, 2, state->light_tex0);
+ state->pipeline0 = cogl_pipeline_new ();
+ cogl_pipeline_set_layer (state->pipeline0, 0, state->alpha_tex);
+ cogl_pipeline_set_layer (state->pipeline0, 1, state->redhand_tex);
+ cogl_pipeline_set_layer (state->pipeline0, 2, state->light_tex0);
- state->material1 = cogl_material_new ();
- cogl_material_set_layer (state->material1, 0, state->alpha_tex);
- cogl_material_set_layer (state->material1, 1, state->redhand_tex);
- cogl_material_set_layer (state->material1, 2, state->light_tex1);
+ state->pipeline1 = cogl_pipeline_new ();
+ cogl_pipeline_set_layer (state->pipeline1, 0, state->alpha_tex);
+ cogl_pipeline_set_layer (state->pipeline1, 1, state->redhand_tex);
+ cogl_pipeline_set_layer (state->pipeline1, 2, state->light_tex1);
state->tex_coords = tex_coords;
@@ -236,8 +236,8 @@ test_cogl_multitexture_main (int argc, char *argv[])
clutter_test_main ();
- cogl_object_unref (state->material1);
- cogl_object_unref (state->material0);
+ cogl_object_unref (state->pipeline1);
+ cogl_object_unref (state->pipeline0);
cogl_object_unref (state->alpha_tex);
cogl_object_unref (state->redhand_tex);
cogl_object_unref (state->light_tex0);
diff --git a/src/tests/clutter/interactive/test-cogl-point-sprites.c
b/src/tests/clutter/interactive/test-cogl-point-sprites.c
index 5994df76ea..0b3feb0c35 100644
--- a/src/tests/clutter/interactive/test-cogl-point-sprites.c
+++ b/src/tests/clutter/interactive/test-cogl-point-sprites.c
@@ -50,7 +50,7 @@ struct _Data
Spark sparks[N_SPARKS];
GTimer *last_spark_time;
- CoglMaterial *material;
+ CoglPipeline *pipeline;
};
int
@@ -217,22 +217,24 @@ test_cogl_point_sprites_main (int argc, char *argv[])
{
ClutterActor *stage;
CoglHandle tex;
+ CoglContext *ctx =
+ clutter_backend_get_cogl_context (clutter_get_default_backend ());
Data data;
GError *error = NULL;
int i;
clutter_test_init (&argc, &argv);
- data.material = cogl_material_new ();
+ data.pipeline = cogl_pipeline_new (ctx);
data.last_spark_time = g_timer_new ();
data.next_spark_num = 0;
- cogl_material_set_point_size (data.material, TEXTURE_SIZE);
+ cogl_pipeline_set_point_size (data.pipeline, TEXTURE_SIZE);
tex = generate_round_texture ();
- cogl_material_set_layer (data.material, 0, tex);
+ cogl_pipeline_set_layer_texture (data.pipeline, 0, tex);
cogl_object_unref (tex);
- if (!cogl_pipeline_set_layer_point_sprite_coords_enabled (data.material,
+ if (!cogl_pipeline_set_layer_point_sprite_coords_enabled (data.pipeline,
0, TRUE,
&error))
{
@@ -266,7 +268,7 @@ test_cogl_point_sprites_main (int argc, char *argv[])
clutter_test_main ();
- cogl_object_unref (data.material);
+ cogl_object_unref (data.pipeline);
g_timer_destroy (data.last_spark_time);
for (i = 0; i < N_FIREWORKS; i++)
diff --git a/src/tests/clutter/interactive/test-cogl-shader-glsl.c
b/src/tests/clutter/interactive/test-cogl-shader-glsl.c
index 62b16e772f..a386f43ceb 100644
--- a/src/tests/clutter/interactive/test-cogl-shader-glsl.c
+++ b/src/tests/clutter/interactive/test-cogl-shader-glsl.c
@@ -161,7 +161,7 @@ static ShaderSource shaders[]=
};
static CoglHandle redhand;
-static CoglMaterial *material;
+static CoglPipeline *pipeline;
static unsigned int timeout_id = 0;
static int shader_no = 0;
@@ -176,7 +176,7 @@ on_after_paint (ClutterActor *actor,
float image_width = cogl_texture_get_width (redhand);
float image_height = cogl_texture_get_height (redhand);
- cogl_framebuffer_draw_rectangle (framebuffer, COGL_PIPELINE (material),
+ cogl_framebuffer_draw_rectangle (framebuffer, pipeline,
stage_width / 2.0f - image_width / 2.0f,
stage_height / 2.0f - image_height / 2.0f,
stage_width / 2.0f + image_width / 2.0f,
@@ -188,6 +188,9 @@ set_shader_num (int new_no)
{
CoglHandle shader;
CoglHandle program;
+ CoglPipeline *pipeline;
+ CoglContext *ctx =
+ clutter_backend_get_cogl_context (clutter_get_default_backend ());
int image_width = cogl_texture_get_width (redhand);
int image_height = cogl_texture_get_height (redhand);
int uniform_no;
@@ -196,6 +199,8 @@ set_shader_num (int new_no)
new_no,
shaders[new_no].name);
+ pipeline = cogl_pipeline_new (ctx);
+
shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
cogl_shader_source (shader, shaders[new_no].source);
@@ -218,7 +223,7 @@ set_shader_num (int new_no)
uniform_no = cogl_program_get_uniform_location (program, "y_step");
cogl_program_set_uniform_1f (program, uniform_no, 1.0f / image_height);
- cogl_material_set_user_program (material, program);
+ cogl_pipeline_set_user_program (pipeline, program);
cogl_object_unref (program);
shader_no = new_no;
@@ -305,6 +310,9 @@ test_cogl_shader_glsl_main (int argc, char *argv[])
char *file;
GError *error;
ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff };
+ CoglPipeline *pipeline;
+ CoglContext *ctx =
+ clutter_backend_get_cogl_context (clutter_get_default_backend ());
clutter_test_init (&argc, &argv);
@@ -322,8 +330,8 @@ test_cogl_shader_glsl_main (int argc, char *argv[])
if (redhand == NULL)
g_error ("image load failed: %s", error->message);
- material = cogl_material_new ();
- cogl_material_set_layer (material, 0, redhand);
+ pipeline = cogl_pipeline_new (ctx);
+ cogl_pipeline_set_layer_texture (pipeline, 0, redhand);
set_shader_num (0);
g_signal_connect (CLUTTER_STAGE (stage), "after-paint", G_CALLBACK (on_after_paint), NULL);
diff --git a/src/tests/clutter/interactive/test-cogl-tex-polygon.c
b/src/tests/clutter/interactive/test-cogl-tex-polygon.c
index e9c194f4a1..4646220744 100644
--- a/src/tests/clutter/interactive/test-cogl-tex-polygon.c
+++ b/src/tests/clutter/interactive/test-cogl-tex-polygon.c
@@ -149,7 +149,7 @@ test_coglbox_fade_texture (CoglFramebuffer *framebuffer,
static void
test_coglbox_triangle_texture (CoglFramebuffer *framebuffer,
- CoglHandle material,
+ CoglPipeline *pipeline,
int tex_width,
int tex_height,
float x,
@@ -186,7 +186,7 @@ test_coglbox_triangle_texture (CoglFramebuffer *framebuffer,
COGL_VERTICES_MODE_TRIANGLE_FAN,
3,
vertices);
- cogl_primitive_draw (primitive, framebuffer, material);
+ cogl_primitive_draw (primitive, framebuffer, pipeline);
cogl_object_unref (primitive);
}
@@ -199,13 +199,16 @@ test_coglbox_paint (ClutterActor *self,
: priv->not_sliced_tex;
int tex_width = cogl_texture_get_width (tex_handle);
int tex_height = cogl_texture_get_height (tex_handle);
+ CoglPipeline *pipeline;
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
- CoglHandle material = cogl_pipeline_new ();
+ CoglContext *ctx =
+ clutter_backend_get_cogl_context (clutter_get_default_backend ());
- cogl_pipeline_set_layer (material, 0, tex_handle);
+ pipeline = cogl_pipeline_new (ctx);
+ cogl_pipeline_set_layer_texture (pipeline, 0, tex_handle);
- cogl_pipeline_set_layer_filters (material, 0,
+ cogl_pipeline_set_layer_filters (pipeline, 0,
priv->use_linear_filtering
? COGL_PIPELINE_FILTER_LINEAR :
COGL_PIPELINE_FILTER_NEAREST,
@@ -219,10 +222,10 @@ test_coglbox_paint (ClutterActor *self,
cogl_framebuffer_translate (framebuffer, -tex_width / 2, 0, 0);
/* Draw a hand and reflect it */
- cogl_framebuffer_draw_textured_rectangle (framebuffer, material,
+ cogl_framebuffer_draw_textured_rectangle (framebuffer, pipeline,
0, 0, tex_width, tex_height,
0, 0, 1, 1);
- test_coglbox_fade_texture (framebuffer, material,
+ test_coglbox_fade_texture (framebuffer, pipeline,
0, tex_height,
tex_width, (tex_height * 3 / 2),
0.0, 1.0,
@@ -236,13 +239,13 @@ test_coglbox_paint (ClutterActor *self,
cogl_framebuffer_translate (framebuffer, -tex_width / 2 - 10, 0, 0);
/* Draw the texture split into two triangles */
- test_coglbox_triangle_texture (framebuffer, material,
+ test_coglbox_triangle_texture (framebuffer, pipeline,
tex_width, tex_height,
0, 0,
0, 0,
0, 1,
1, 1);
- test_coglbox_triangle_texture (framebuffer, material,
+ test_coglbox_triangle_texture (framebuffer, pipeline,
tex_width, tex_height,
20, 0,
0, 0,
@@ -251,7 +254,7 @@ test_coglbox_paint (ClutterActor *self,
cogl_framebuffer_pop_matrix (framebuffer);
- cogl_object_unref (material);
+ cogl_object_unref (pipeline);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]