1 #include <cogl/cogl2-experimental.h>
4 #include "test-utils.h"
6 typedef struct _TestState
13 test_sparse_layer_combine (TestState *state)
15 CoglPipeline *pipeline;
16 CoglTexture *tex1, *tex2;
18 cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
20 /* This tests that the TEXTURE_* numbers used in the layer combine
21 string refer to the layer number rather than the unit numbers by
22 creating a pipeline with very large layer numbers. This should
23 end up being mapped to much smaller unit numbers */
25 tex1 = test_utils_create_color_texture (ctx, 0xff0000ff);
26 tex2 = test_utils_create_color_texture (ctx, 0x00ff00ff);
28 pipeline = cogl_pipeline_new (ctx);
30 cogl_pipeline_set_layer_texture (pipeline, 50, tex1);
31 cogl_pipeline_set_layer_texture (pipeline, 100, tex2);
32 cogl_pipeline_set_layer_combine (pipeline, 200,
33 "RGBA = ADD(TEXTURE_50, TEXTURE_100)",
36 cogl_framebuffer_draw_rectangle (fb, pipeline, -1, -1, 1, 1);
38 test_utils_check_pixel (fb, 2, 2, 0xffff00ff);
40 cogl_object_unref (pipeline);
41 cogl_object_unref (tex1);
42 cogl_object_unref (tex2);
46 test_sparse_pipeline (void)
50 state.fb_width = cogl_framebuffer_get_width (fb);
51 state.fb_height = cogl_framebuffer_get_height (fb);
53 test_sparse_layer_combine (&state);
55 /* FIXME: This should have a lot more tests, for example testing
56 whether using an attribute with sparse texture coordinates will
59 if (cogl_test_verbose ())