mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
snippet: Don't generate code for snippets that are replaced
The loop that generates code for a list of snippets now starts from the first snippet that has a replace string. Any snippets before that would be ignored so there's no point in generating code for them. Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:

committed by
Robert Bragg

parent
cdc4bd6361
commit
a0903e0cfb
@ -232,6 +232,28 @@ paint (TestState *state)
|
||||
|
||||
cogl_object_unref (snippet);
|
||||
|
||||
/* Test replacing a previous snippet */
|
||||
pipeline = create_texture_pipeline ();
|
||||
|
||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
|
||||
NULL,
|
||||
"cogl_color_out = vec4 (0.5, 0.5, 0.5, 1.0);");
|
||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||
cogl_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);
|
||||
|
||||
cogl_push_source (pipeline);
|
||||
cogl_rectangle_with_texture_coords (100, 0, 110, 10,
|
||||
0, 0, 0, 0);
|
||||
cogl_pop_source ();
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
/* Sanity check modifying the snippet */
|
||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, "foo", "bar");
|
||||
g_assert_cmpstr (cogl_snippet_get_declarations (snippet), ==, "foo");
|
||||
@ -280,6 +302,7 @@ validate_result (void)
|
||||
test_utils_check_pixel (65, 5, 0x00ff00ff);
|
||||
test_utils_check_pixel (75, 5, 0x808000ff);
|
||||
test_utils_check_pixel (85, 5, 0x00ffffff);
|
||||
test_utils_check_pixel (105, 5, 0xff0000ff);
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user