mirror of
https://github.com/brl/mutter.git
synced 2025-06-13 16:59:30 +00:00
cogl: Port Snippet away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
This commit is contained in:

committed by
Marge Bot

parent
1da42dc3c0
commit
312d5c367e
@ -294,7 +294,7 @@ test_custom_attributes (void)
|
||||
paint (&state);
|
||||
|
||||
cogl_object_unref (state.pipeline);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
if (cogl_test_verbose ())
|
||||
g_print ("OK\n");
|
||||
|
@ -47,7 +47,7 @@ test_pipeline_shader_state (void)
|
||||
NULL, /* declarations */
|
||||
"cogl_color_out = vec4 (0.0, 1.0, 0.1, 1.1);");
|
||||
cogl_pipeline_add_snippet (draw_pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (test_fb, draw_pipeline,
|
||||
0, 0, width, height);
|
||||
@ -80,7 +80,7 @@ test_pipeline_shader_state (void)
|
||||
NULL, /* declarations */
|
||||
"cogl_color_out = vec4 (0.0, 0.0, 1.1, 1.1);");
|
||||
cogl_pipeline_add_snippet (draw_pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (test_fb, draw_pipeline,
|
||||
0, 0, width, height);
|
||||
|
@ -157,7 +157,7 @@ setup_snippet (CoglPipeline *pipeline)
|
||||
"cogl_point_size_out = "
|
||||
"my_super_duper_point_size_attrib;\n");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -87,7 +87,7 @@ do_test (gboolean check_orientation,
|
||||
|
||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ do_test (gboolean check_orientation,
|
||||
|
||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ simple_fragment_snippet (TestState *state)
|
||||
NULL, /* declarations */
|
||||
"cogl_color_out.g += 1.0;");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10);
|
||||
|
||||
@ -81,7 +81,7 @@ simple_vertex_snippet (TestState *state)
|
||||
NULL,
|
||||
"cogl_color_out.b += 1.0;");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 10, 0, 20, 10);
|
||||
|
||||
@ -110,12 +110,12 @@ shared_uniform (TestState *state)
|
||||
"uniform float a_value;",
|
||||
"cogl_color_out.b += a_value;");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
|
||||
"uniform float a_value;",
|
||||
"cogl_color_out.b += a_value;");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (test_fb,
|
||||
pipeline,
|
||||
@ -156,7 +156,7 @@ lots_snippets (TestState *state)
|
||||
declarations,
|
||||
code);
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
g_free (code);
|
||||
g_free (uniform_name);
|
||||
@ -187,7 +187,7 @@ shared_variable_pre_post (TestState *state)
|
||||
"cogl_color_out = redvec;");
|
||||
cogl_snippet_set_pre (snippet, "vec4 redvec = vec4 (1.0, 0.0, 0.0, 1.0);");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 40, 0, 50, 10);
|
||||
|
||||
@ -224,7 +224,7 @@ test_pipeline_caching (TestState *state)
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 60, 0, 70, 10);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
test_utils_check_pixel (test_fb, 55, 5, 0x00ff00ff);
|
||||
test_utils_check_pixel (test_fb, 65, 5, 0x00ff00ff);
|
||||
@ -252,7 +252,7 @@ test_replace_string (TestState *state)
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 70, 0, 80, 10);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
test_utils_check_pixel (test_fb, 75, 5, 0x808000ff);
|
||||
}
|
||||
@ -279,7 +279,7 @@ test_texture_lookup_hook (TestState *state)
|
||||
0, 0, 0, 0);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
test_utils_check_pixel (test_fb, 85, 5, 0x00ffffff);
|
||||
}
|
||||
@ -305,7 +305,7 @@ test_multiple_samples (TestState *state)
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
test_utils_check_pixel (test_fb, 5, 5, 0xffff00ff);
|
||||
}
|
||||
@ -328,7 +328,7 @@ test_replace_lookup_hook (TestState *state)
|
||||
0, 0, 0, 0);
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
test_utils_check_pixel (test_fb, 95, 5, 0x0000ffff);
|
||||
}
|
||||
@ -346,14 +346,14 @@ test_replace_snippet (TestState *state)
|
||||
NULL,
|
||||
"cogl_color_out = vec4 (0.5, 0.5, 0.5, 1.0);");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, NULL, NULL);
|
||||
cogl_snippet_set_pre (snippet, "cogl_color_out = vec4 (1.0, 1.0, 1.0, 1.0);");
|
||||
cogl_snippet_set_replace (snippet,
|
||||
"cogl_color_out *= vec4 (1.0, 0.0, 0.0, 1.0);");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||
pipeline,
|
||||
@ -376,7 +376,7 @@ test_replace_fragment_layer (TestState *state)
|
||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_LAYER_FRAGMENT, NULL, NULL);
|
||||
cogl_snippet_set_replace (snippet, "cogl_layer = vec4 (0.0, 0.0, 1.0, 1.0);");
|
||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
/* Add a second layer which samples from the texture in the first
|
||||
layer. The snippet override should cause the first layer not to
|
||||
@ -414,7 +414,7 @@ test_modify_fragment_layer (TestState *state)
|
||||
"uniform float a_value;",
|
||||
"cogl_layer.g = a_value;");
|
||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||
pipeline,
|
||||
@ -443,7 +443,7 @@ test_modify_vertex_layer (TestState *state)
|
||||
NULL,
|
||||
"cogl_tex_coord.x = 1.0;");
|
||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||
pipeline,
|
||||
@ -473,7 +473,7 @@ test_replace_vertex_layer (TestState *state)
|
||||
NULL);
|
||||
cogl_snippet_set_replace (snippet, "cogl_tex_coord.x = 1.0;\n");
|
||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||
pipeline,
|
||||
@ -508,7 +508,7 @@ test_vertex_transform_hook (TestState *state)
|
||||
cogl_snippet_set_replace (snippet, "cogl_position_out = "
|
||||
"pmat * cogl_position_in;");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
/* Copy the current projection matrix to a uniform */
|
||||
cogl_framebuffer_get_projection_matrix (test_fb, &matrix);
|
||||
@ -564,7 +564,7 @@ test_global_vertex_hook (TestState *state)
|
||||
"This string shouldn't be used so "
|
||||
"we can safely put garbage in here.");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
|
||||
NULL, /* declarations */
|
||||
@ -574,7 +574,7 @@ test_global_vertex_hook (TestState *state)
|
||||
"cogl_color_out.gba = vec3 (0.0, 0.0, 1.0);\n"
|
||||
"cogl_position_out = cogl_position_in;\n");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (test_fb,
|
||||
pipeline,
|
||||
@ -617,7 +617,7 @@ test_global_fragment_hook (TestState *state)
|
||||
"This string shouldn't be used so "
|
||||
"we can safely put garbage in here.");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
|
||||
NULL, /* declarations */
|
||||
@ -626,7 +626,7 @@ test_global_fragment_hook (TestState *state)
|
||||
"cogl_color_out.r = multiply_by_four (0.25);\n"
|
||||
"cogl_color_out.gba = vec3 (0.0, 0.0, 1.0);\n");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (test_fb,
|
||||
pipeline,
|
||||
@ -660,14 +660,14 @@ test_snippet_order (TestState *state)
|
||||
cogl_snippet_set_pre (snippet, "cogl_color_out.r = 0.5;\n");
|
||||
cogl_snippet_set_replace (snippet, "cogl_color_out.ba = vec2 (0.0, 1.0);");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
|
||||
NULL,
|
||||
"cogl_color_out.g = 1.0;\n");
|
||||
cogl_snippet_set_pre (snippet, "cogl_color_out.r = 1.0;\n");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 160, 0, 170, 10);
|
||||
cogl_object_unref (pipeline);
|
||||
@ -706,7 +706,7 @@ test_naming_texture_units (TestState *state)
|
||||
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10);
|
||||
|
||||
cogl_object_unref (pipeline);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
cogl_object_unref (tex1);
|
||||
cogl_object_unref (tex2);
|
||||
|
||||
|
@ -27,7 +27,7 @@ create_pipelines (CoglPipeline **pipelines,
|
||||
|
||||
pipelines[i] = cogl_pipeline_new (test_ctx);
|
||||
cogl_pipeline_add_snippet (pipelines[i], snippet);
|
||||
cogl_object_unref (snippet);
|
||||
g_object_unref (snippet);
|
||||
}
|
||||
|
||||
/* Test that drawing with them works. This should create the entries
|
||||
|
Reference in New Issue
Block a user