tests: update inline with master
This renames the global ctx and fb variables to test_ctx and test_fb respectively in line with the names use on the master branch. This is to make it easier to cherry pick patches from master.
This commit is contained in:
parent
31d105abd8
commit
fa62fe2a4f
@ -24,10 +24,10 @@ create_texture (CoglContext *context)
|
|||||||
void
|
void
|
||||||
test_alpha_test (void)
|
test_alpha_test (void)
|
||||||
{
|
{
|
||||||
CoglTexture *tex = COGL_TEXTURE (create_texture (ctx));
|
CoglTexture *tex = COGL_TEXTURE (create_texture (test_ctx));
|
||||||
CoglPipeline *pipeline = cogl_pipeline_new (ctx);
|
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
|
||||||
int fb_width = cogl_framebuffer_get_width (fb);
|
int fb_width = cogl_framebuffer_get_width (test_fb);
|
||||||
int fb_height = cogl_framebuffer_get_height (fb);
|
int fb_height = cogl_framebuffer_get_height (test_fb);
|
||||||
CoglColor clear_color;
|
CoglColor clear_color;
|
||||||
|
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, tex);
|
cogl_pipeline_set_layer_texture (pipeline, 0, tex);
|
||||||
@ -39,11 +39,11 @@ test_alpha_test (void)
|
|||||||
254 / 255.0f /* alpha reference */);
|
254 / 255.0f /* alpha reference */);
|
||||||
|
|
||||||
cogl_color_init_from_4ub (&clear_color, 0x00, 0x00, 0xff, 0xff);
|
cogl_color_init_from_4ub (&clear_color, 0x00, 0x00, 0xff, 0xff);
|
||||||
cogl_framebuffer_clear (fb,
|
cogl_framebuffer_clear (test_fb,
|
||||||
COGL_BUFFER_BIT_COLOR,
|
COGL_BUFFER_BIT_COLOR,
|
||||||
&clear_color);
|
&clear_color);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb,
|
cogl_framebuffer_draw_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
-1, -1,
|
-1, -1,
|
||||||
1, 1);
|
1, 1);
|
||||||
@ -53,7 +53,7 @@ test_alpha_test (void)
|
|||||||
|
|
||||||
/* The left side of the framebuffer should use the first pixel from
|
/* The left side of the framebuffer should use the first pixel from
|
||||||
* the texture which is red */
|
* the texture which is red */
|
||||||
test_utils_check_region (fb,
|
test_utils_check_region (test_fb,
|
||||||
2, 2,
|
2, 2,
|
||||||
fb_width / 2 - 4,
|
fb_width / 2 - 4,
|
||||||
fb_height - 4,
|
fb_height - 4,
|
||||||
@ -61,7 +61,7 @@ test_alpha_test (void)
|
|||||||
/* The right side of the framebuffer should use the clear color
|
/* The right side of the framebuffer should use the clear color
|
||||||
* because the second pixel from the texture is clipped from the
|
* because the second pixel from the texture is clipped from the
|
||||||
* alpha test */
|
* alpha test */
|
||||||
test_utils_check_region (fb,
|
test_utils_check_region (test_fb,
|
||||||
fb_width / 2 + 2,
|
fb_width / 2 + 2,
|
||||||
2,
|
2,
|
||||||
fb_width / 2 - 4,
|
fb_width / 2 - 4,
|
||||||
|
@ -48,7 +48,7 @@ paint_test_backface_culling (TestState *state,
|
|||||||
CoglFramebuffer *framebuffer)
|
CoglFramebuffer *framebuffer)
|
||||||
{
|
{
|
||||||
int draw_num;
|
int draw_num;
|
||||||
CoglPipeline *base_pipeline = cogl_pipeline_new (ctx);
|
CoglPipeline *base_pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (framebuffer,
|
cogl_framebuffer_orthographic (framebuffer,
|
||||||
0, 0,
|
0, 0,
|
||||||
@ -223,7 +223,7 @@ paint (TestState *state)
|
|||||||
{
|
{
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
|
|
||||||
paint_test_backface_culling (state, fb);
|
paint_test_backface_culling (state, test_fb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now repeat the test but rendered to an offscreen
|
* Now repeat the test but rendered to an offscreen
|
||||||
@ -235,17 +235,17 @@ paint (TestState *state)
|
|||||||
|
|
||||||
/* Copy the result of the offscreen rendering for validation and
|
/* Copy the result of the offscreen rendering for validation and
|
||||||
* also so we can have visual feedback. */
|
* also so we can have visual feedback. */
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, state->offscreen_tex);
|
cogl_pipeline_set_layer_texture (pipeline, 0, state->offscreen_tex);
|
||||||
cogl_framebuffer_draw_rectangle (fb,
|
cogl_framebuffer_draw_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
0, TEXTURE_RENDER_SIZE * 16,
|
0, TEXTURE_RENDER_SIZE * 16,
|
||||||
state->width,
|
state->width,
|
||||||
state->height + TEXTURE_RENDER_SIZE * 16);
|
state->height + TEXTURE_RENDER_SIZE * 16);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
validate_result (fb, 0);
|
validate_result (test_fb, 0);
|
||||||
validate_result (fb, 16);
|
validate_result (test_fb, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglTexture *
|
static CoglTexture *
|
||||||
@ -283,8 +283,8 @@ test_backface_culling (void)
|
|||||||
TestState state;
|
TestState state;
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
|
|
||||||
state.width = cogl_framebuffer_get_width (fb);
|
state.width = cogl_framebuffer_get_width (test_fb);
|
||||||
state.height = cogl_framebuffer_get_height (fb);
|
state.height = cogl_framebuffer_get_height (test_fb);
|
||||||
|
|
||||||
state.offscreen = NULL;
|
state.offscreen = NULL;
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ test_blend (TestState *state,
|
|||||||
int x_off;
|
int x_off;
|
||||||
|
|
||||||
/* First write out the destination color without any blending... */
|
/* First write out the destination color without any blending... */
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_set_color4ub (pipeline, Dr, Dg, Db, Da);
|
cogl_pipeline_set_color4ub (pipeline, Dr, Dg, Db, Da);
|
||||||
cogl_pipeline_set_blend (pipeline, "RGBA = ADD (SRC_COLOR, 0)", NULL);
|
cogl_pipeline_set_blend (pipeline, "RGBA = ADD (SRC_COLOR, 0)", NULL);
|
||||||
cogl_set_source (pipeline);
|
cogl_set_source (pipeline);
|
||||||
@ -74,7 +74,7 @@ test_blend (TestState *state,
|
|||||||
* Now blend a rectangle over our well defined destination:
|
* Now blend a rectangle over our well defined destination:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_set_color4ub (pipeline, Sr, Sg, Sb, Sa);
|
cogl_pipeline_set_color4ub (pipeline, Sr, Sg, Sb, Sa);
|
||||||
|
|
||||||
status = cogl_pipeline_set_blend (pipeline, blend_string, &error);
|
status = cogl_pipeline_set_blend (pipeline, blend_string, &error);
|
||||||
@ -118,7 +118,7 @@ test_blend (TestState *state,
|
|||||||
g_print (" blend constant = UNUSED\n");
|
g_print (" blend constant = UNUSED\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
test_utils_check_pixel (fb, x_off, y_off, expected_result);
|
test_utils_check_pixel (test_fb, x_off, y_off, expected_result);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -171,7 +171,7 @@ test_blend (TestState *state,
|
|||||||
|
|
||||||
/* See what we got... */
|
/* See what we got... */
|
||||||
|
|
||||||
test_utils_check_pixel (fb, x_off, y_off, expected_result);
|
test_utils_check_pixel (test_fb, x_off, y_off, expected_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglTexture *
|
static CoglTexture *
|
||||||
@ -288,7 +288,7 @@ test_tex_combine (TestState *state,
|
|||||||
g_print (" combine constant = UNUSED\n");
|
g_print (" combine constant = UNUSED\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
test_utils_check_pixel (fb, x_off, y_off, expected_result);
|
test_utils_check_pixel (test_fb, x_off, y_off, expected_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -412,15 +412,15 @@ test_blend_strings (void)
|
|||||||
{
|
{
|
||||||
TestState state;
|
TestState state;
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb, 0, 0,
|
cogl_framebuffer_orthographic (test_fb, 0, 0,
|
||||||
cogl_framebuffer_get_width (fb),
|
cogl_framebuffer_get_width (test_fb),
|
||||||
cogl_framebuffer_get_height (fb),
|
cogl_framebuffer_get_height (test_fb),
|
||||||
-1,
|
-1,
|
||||||
100);
|
100);
|
||||||
|
|
||||||
/* XXX: we have to push/pop a framebuffer since this test currently
|
/* XXX: we have to push/pop a framebuffer since this test currently
|
||||||
* uses the legacy cogl_rectangle() api. */
|
* uses the legacy cogl_rectangle() api. */
|
||||||
cogl_push_framebuffer (fb);
|
cogl_push_framebuffer (test_fb);
|
||||||
paint (&state);
|
paint (&state);
|
||||||
cogl_pop_framebuffer ();
|
cogl_pop_framebuffer ();
|
||||||
|
|
||||||
|
@ -45,9 +45,9 @@ paint (TestState *state)
|
|||||||
/* Render all of the textures to the screen */
|
/* Render all of the textures to the screen */
|
||||||
for (i = 0; i < NUM_FBOS; i++)
|
for (i = 0; i < NUM_FBOS; i++)
|
||||||
{
|
{
|
||||||
CoglPipeline *pipeline = cogl_pipeline_new (ctx);
|
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, state->tex[i]);
|
cogl_pipeline_set_layer_texture (pipeline, 0, state->tex[i]);
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline,
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
|
||||||
2.0f / NUM_FBOS * i - 1.0f, -1.0f,
|
2.0f / NUM_FBOS * i - 1.0f, -1.0f,
|
||||||
2.0f / NUM_FBOS * (i + 1) - 1.0f, 1.0f);
|
2.0f / NUM_FBOS * (i + 1) - 1.0f, 1.0f);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
@ -61,7 +61,7 @@ paint (TestState *state)
|
|||||||
{ 0x00, 0xff, 0x00, 0xff },
|
{ 0x00, 0xff, 0x00, 0xff },
|
||||||
{ 0x00, 0x00, 0xff, 0xff } };
|
{ 0x00, 0x00, 0xff, 0xff } };
|
||||||
|
|
||||||
test_utils_check_pixel_rgb (fb,
|
test_utils_check_pixel_rgb (test_fb,
|
||||||
state->width * (i + 0.5f) / NUM_FBOS,
|
state->width * (i + 0.5f) / NUM_FBOS,
|
||||||
state->height / 2,
|
state->height / 2,
|
||||||
expected_colors[i][0],
|
expected_colors[i][0],
|
||||||
@ -76,8 +76,8 @@ test_color_mask (void)
|
|||||||
TestState state;
|
TestState state;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
state.width = cogl_framebuffer_get_width (fb);
|
state.width = cogl_framebuffer_get_width (test_fb);
|
||||||
state.height = cogl_framebuffer_get_height (fb);
|
state.height = cogl_framebuffer_get_height (test_fb);
|
||||||
|
|
||||||
for (i = 0; i < NUM_FBOS; i++)
|
for (i = 0; i < NUM_FBOS; i++)
|
||||||
{
|
{
|
||||||
@ -101,7 +101,7 @@ test_color_mask (void)
|
|||||||
|
|
||||||
/* XXX: we have to push/pop a framebuffer since this test currently
|
/* XXX: we have to push/pop a framebuffer since this test currently
|
||||||
* uses the legacy cogl_rectangle() api. */
|
* uses the legacy cogl_rectangle() api. */
|
||||||
cogl_push_framebuffer (fb);
|
cogl_push_framebuffer (test_fb);
|
||||||
paint (&state);
|
paint (&state);
|
||||||
cogl_pop_framebuffer ();
|
cogl_pop_framebuffer ();
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ test_float_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
{ 15, 0, /**/ 0, 1, 0, 1 }
|
{ 15, 0, /**/ 0, 1, 0, 1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
buffer = cogl_attribute_buffer_new (ctx,
|
buffer = cogl_attribute_buffer_new (test_ctx,
|
||||||
sizeof (float_verts), float_verts);
|
sizeof (float_verts), float_verts);
|
||||||
attributes[0] = cogl_attribute_new (buffer,
|
attributes[0] = cogl_attribute_new (buffer,
|
||||||
"cogl_position_in",
|
"cogl_position_in",
|
||||||
@ -58,10 +58,10 @@ test_float_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
4, /* n_components */
|
4, /* n_components */
|
||||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||||
|
|
||||||
cogl_framebuffer_push_matrix (fb);
|
cogl_framebuffer_push_matrix (test_fb);
|
||||||
cogl_framebuffer_translate (fb, offset_x, offset_y, 0.0f);
|
cogl_framebuffer_translate (test_fb, offset_x, offset_y, 0.0f);
|
||||||
|
|
||||||
cogl_framebuffer_draw_attributes (fb,
|
cogl_framebuffer_draw_attributes (test_fb,
|
||||||
state->pipeline,
|
state->pipeline,
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
COGL_VERTICES_MODE_TRIANGLES,
|
||||||
0, /* first_vertex */
|
0, /* first_vertex */
|
||||||
@ -69,14 +69,14 @@ test_float_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
attributes,
|
attributes,
|
||||||
2 /* n_attributes */);
|
2 /* n_attributes */);
|
||||||
|
|
||||||
cogl_framebuffer_pop_matrix (fb);
|
cogl_framebuffer_pop_matrix (test_fb);
|
||||||
|
|
||||||
cogl_object_unref (attributes[1]);
|
cogl_object_unref (attributes[1]);
|
||||||
cogl_object_unref (attributes[0]);
|
cogl_object_unref (attributes[0]);
|
||||||
cogl_object_unref (buffer);
|
cogl_object_unref (buffer);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, offset_x + 5, offset_y + 5, 0xff0000ff);
|
test_utils_check_pixel (test_fb, offset_x + 5, offset_y + 5, 0xff0000ff);
|
||||||
test_utils_check_pixel (fb, offset_x + 15, offset_y + 5, 0x00ff00ff);
|
test_utils_check_pixel (test_fb, offset_x + 15, offset_y + 5, 0x00ff00ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -103,7 +103,7 @@ test_byte_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
{ 0, 0, /**/ 0, 0, 1, 1 },
|
{ 0, 0, /**/ 0, 0, 1, 1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
buffer = cogl_attribute_buffer_new (ctx,
|
buffer = cogl_attribute_buffer_new (test_ctx,
|
||||||
sizeof (norm_verts), norm_verts);
|
sizeof (norm_verts), norm_verts);
|
||||||
attributes[0] = cogl_attribute_new (buffer,
|
attributes[0] = cogl_attribute_new (buffer,
|
||||||
"cogl_position_in",
|
"cogl_position_in",
|
||||||
@ -119,10 +119,10 @@ test_byte_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
|
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
|
||||||
cogl_attribute_set_normalized (attributes[1], TRUE);
|
cogl_attribute_set_normalized (attributes[1], TRUE);
|
||||||
|
|
||||||
cogl_framebuffer_push_matrix (fb);
|
cogl_framebuffer_push_matrix (test_fb);
|
||||||
cogl_framebuffer_translate (fb, offset_x, offset_y, 0.0f);
|
cogl_framebuffer_translate (test_fb, offset_x, offset_y, 0.0f);
|
||||||
|
|
||||||
cogl_framebuffer_draw_attributes (fb,
|
cogl_framebuffer_draw_attributes (test_fb,
|
||||||
state->pipeline,
|
state->pipeline,
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
COGL_VERTICES_MODE_TRIANGLES,
|
||||||
0, /* first_vertex */
|
0, /* first_vertex */
|
||||||
@ -133,7 +133,7 @@ test_byte_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
cogl_object_unref (attributes[1]);
|
cogl_object_unref (attributes[1]);
|
||||||
|
|
||||||
/* Test again with unnormalized attributes */
|
/* Test again with unnormalized attributes */
|
||||||
unnorm_buffer = cogl_attribute_buffer_new (ctx,
|
unnorm_buffer = cogl_attribute_buffer_new (test_ctx,
|
||||||
sizeof (unnorm_verts),
|
sizeof (unnorm_verts),
|
||||||
unnorm_verts);
|
unnorm_verts);
|
||||||
attributes[1] = cogl_attribute_new (unnorm_buffer,
|
attributes[1] = cogl_attribute_new (unnorm_buffer,
|
||||||
@ -143,9 +143,9 @@ test_byte_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
4, /* n_components */
|
4, /* n_components */
|
||||||
COGL_ATTRIBUTE_TYPE_BYTE);
|
COGL_ATTRIBUTE_TYPE_BYTE);
|
||||||
|
|
||||||
cogl_framebuffer_translate (fb, 20, 0, 0);
|
cogl_framebuffer_translate (test_fb, 20, 0, 0);
|
||||||
|
|
||||||
cogl_framebuffer_draw_attributes (fb,
|
cogl_framebuffer_draw_attributes (test_fb,
|
||||||
state->pipeline,
|
state->pipeline,
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
COGL_VERTICES_MODE_TRIANGLES,
|
||||||
0, /* first_vertex */
|
0, /* first_vertex */
|
||||||
@ -153,16 +153,16 @@ test_byte_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
attributes,
|
attributes,
|
||||||
2 /* n_attributes */);
|
2 /* n_attributes */);
|
||||||
|
|
||||||
cogl_framebuffer_pop_matrix (fb);
|
cogl_framebuffer_pop_matrix (test_fb);
|
||||||
|
|
||||||
cogl_object_unref (attributes[0]);
|
cogl_object_unref (attributes[0]);
|
||||||
cogl_object_unref (attributes[1]);
|
cogl_object_unref (attributes[1]);
|
||||||
cogl_object_unref (buffer);
|
cogl_object_unref (buffer);
|
||||||
cogl_object_unref (unnorm_buffer);
|
cogl_object_unref (unnorm_buffer);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, offset_x + 5, offset_y + 5, 0xff0000ff);
|
test_utils_check_pixel (test_fb, offset_x + 5, offset_y + 5, 0xff0000ff);
|
||||||
test_utils_check_pixel (fb, offset_x + 15, offset_y + 5, 0x00ff00ff);
|
test_utils_check_pixel (test_fb, offset_x + 15, offset_y + 5, 0x00ff00ff);
|
||||||
test_utils_check_pixel (fb, offset_x + 25, offset_y + 5, 0x0000ffff);
|
test_utils_check_pixel (test_fb, offset_x + 25, offset_y + 5, 0x0000ffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -180,7 +180,7 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
{ -5, -1 }
|
{ -5, -1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX_TRANSFORM,
|
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX_TRANSFORM,
|
||||||
"attribute vec2 pos;",
|
"attribute vec2 pos;",
|
||||||
NULL);
|
NULL);
|
||||||
@ -193,7 +193,7 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
|
|
||||||
cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255);
|
cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255);
|
||||||
|
|
||||||
buffer = cogl_attribute_buffer_new (ctx,
|
buffer = cogl_attribute_buffer_new (test_ctx,
|
||||||
sizeof (short_verts), short_verts);
|
sizeof (short_verts), short_verts);
|
||||||
attributes[0] = cogl_attribute_new (buffer,
|
attributes[0] = cogl_attribute_new (buffer,
|
||||||
"pos",
|
"pos",
|
||||||
@ -202,13 +202,13 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
2, /* n_components */
|
2, /* n_components */
|
||||||
COGL_ATTRIBUTE_TYPE_SHORT);
|
COGL_ATTRIBUTE_TYPE_SHORT);
|
||||||
|
|
||||||
cogl_framebuffer_push_matrix (fb);
|
cogl_framebuffer_push_matrix (test_fb);
|
||||||
cogl_framebuffer_translate (fb,
|
cogl_framebuffer_translate (test_fb,
|
||||||
offset_x + 10.0f,
|
offset_x + 10.0f,
|
||||||
offset_y + 10.0f,
|
offset_y + 10.0f,
|
||||||
0.0f);
|
0.0f);
|
||||||
|
|
||||||
cogl_framebuffer_draw_attributes (fb,
|
cogl_framebuffer_draw_attributes (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
COGL_VERTICES_MODE_TRIANGLES,
|
||||||
0, /* first_vertex */
|
0, /* first_vertex */
|
||||||
@ -216,7 +216,7 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
attributes,
|
attributes,
|
||||||
1 /* n_attributes */);
|
1 /* n_attributes */);
|
||||||
|
|
||||||
cogl_framebuffer_pop_matrix (fb);
|
cogl_framebuffer_pop_matrix (test_fb);
|
||||||
|
|
||||||
cogl_object_unref (attributes[0]);
|
cogl_object_unref (attributes[0]);
|
||||||
|
|
||||||
@ -231,13 +231,13 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
pipeline2 = cogl_pipeline_copy (pipeline);
|
pipeline2 = cogl_pipeline_copy (pipeline);
|
||||||
cogl_pipeline_set_color4ub (pipeline2, 0, 255, 0, 255);
|
cogl_pipeline_set_color4ub (pipeline2, 0, 255, 0, 255);
|
||||||
|
|
||||||
cogl_framebuffer_push_matrix (fb);
|
cogl_framebuffer_push_matrix (test_fb);
|
||||||
cogl_framebuffer_translate (fb,
|
cogl_framebuffer_translate (test_fb,
|
||||||
offset_x + 10.0f - 65525.0f,
|
offset_x + 10.0f - 65525.0f,
|
||||||
offset_y - 65525,
|
offset_y - 65525,
|
||||||
0.0f);
|
0.0f);
|
||||||
|
|
||||||
cogl_framebuffer_draw_attributes (fb,
|
cogl_framebuffer_draw_attributes (test_fb,
|
||||||
pipeline2,
|
pipeline2,
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
COGL_VERTICES_MODE_TRIANGLES,
|
||||||
0, /* first_vertex */
|
0, /* first_vertex */
|
||||||
@ -245,7 +245,7 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
attributes,
|
attributes,
|
||||||
1 /* n_attributes */);
|
1 /* n_attributes */);
|
||||||
|
|
||||||
cogl_framebuffer_pop_matrix (fb);
|
cogl_framebuffer_pop_matrix (test_fb);
|
||||||
|
|
||||||
cogl_object_unref (attributes[0]);
|
cogl_object_unref (attributes[0]);
|
||||||
|
|
||||||
@ -253,14 +253,14 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
cogl_object_unref (buffer);
|
cogl_object_unref (buffer);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, offset_x + 5, offset_y + 5, 0xff0000ff);
|
test_utils_check_pixel (test_fb, offset_x + 5, offset_y + 5, 0xff0000ff);
|
||||||
test_utils_check_pixel (fb, offset_x + 15, offset_y + 5, 0x00ff00ff);
|
test_utils_check_pixel (test_fb, offset_x + 15, offset_y + 5, 0x00ff00ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
paint (TestState *state)
|
paint (TestState *state)
|
||||||
{
|
{
|
||||||
cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
|
cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
|
||||||
|
|
||||||
test_float_verts (state, 0, 0);
|
test_float_verts (state, 0, 0);
|
||||||
test_byte_verts (state, 0, 10);
|
test_byte_verts (state, 0, 10);
|
||||||
@ -276,14 +276,14 @@ test_custom_attributes (void)
|
|||||||
CoglSnippet *snippet;
|
CoglSnippet *snippet;
|
||||||
TestState state;
|
TestState state;
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0,
|
0, 0,
|
||||||
cogl_framebuffer_get_width (fb),
|
cogl_framebuffer_get_width (test_fb),
|
||||||
cogl_framebuffer_get_height (fb),
|
cogl_framebuffer_get_height (test_fb),
|
||||||
-1,
|
-1,
|
||||||
100);
|
100);
|
||||||
|
|
||||||
state.pipeline = cogl_pipeline_new (ctx);
|
state.pipeline = cogl_pipeline_new (test_ctx);
|
||||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
|
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
|
||||||
"attribute vec4 color;",
|
"attribute vec4 color;",
|
||||||
"cogl_color_out = color;");
|
"cogl_color_out = color;");
|
||||||
|
@ -54,7 +54,7 @@ draw_rectangle (TestState *state,
|
|||||||
rect_state->range_near,
|
rect_state->range_near,
|
||||||
rect_state->range_far);
|
rect_state->range_far);
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
if (!cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL))
|
if (!cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL))
|
||||||
{
|
{
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
@ -65,19 +65,19 @@ draw_rectangle (TestState *state,
|
|||||||
{
|
{
|
||||||
cogl_pipeline_set_color4ub (pipeline, Cr, Cg, Cb, Ca);
|
cogl_pipeline_set_color4ub (pipeline, Cr, Cg, Cb, Ca);
|
||||||
|
|
||||||
cogl_framebuffer_push_matrix (fb);
|
cogl_framebuffer_push_matrix (test_fb);
|
||||||
cogl_framebuffer_translate (fb, 0, 0, rect_state->depth);
|
cogl_framebuffer_translate (test_fb, 0, 0, rect_state->depth);
|
||||||
cogl_framebuffer_draw_rectangle (fb,
|
cogl_framebuffer_draw_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
x * QUAD_WIDTH,
|
x * QUAD_WIDTH,
|
||||||
y * QUAD_WIDTH,
|
y * QUAD_WIDTH,
|
||||||
x * QUAD_WIDTH + QUAD_WIDTH,
|
x * QUAD_WIDTH + QUAD_WIDTH,
|
||||||
y * QUAD_WIDTH + QUAD_WIDTH);
|
y * QUAD_WIDTH + QUAD_WIDTH);
|
||||||
cogl_framebuffer_pop_matrix (fb);
|
cogl_framebuffer_pop_matrix (test_fb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cogl_push_framebuffer (fb);
|
cogl_push_framebuffer (test_fb);
|
||||||
cogl_push_matrix ();
|
cogl_push_matrix ();
|
||||||
cogl_set_source_color4ub (Cr, Cg, Cb, Ca);
|
cogl_set_source_color4ub (Cr, Cg, Cb, Ca);
|
||||||
cogl_translate (0, 0, rect_state->depth);
|
cogl_translate (0, 0, rect_state->depth);
|
||||||
@ -118,7 +118,7 @@ test_depth (TestState *state,
|
|||||||
if (missing_feature)
|
if (missing_feature)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
test_utils_check_pixel (fb,
|
test_utils_check_pixel (test_fb,
|
||||||
x * QUAD_WIDTH + (QUAD_WIDTH / 2),
|
x * QUAD_WIDTH + (QUAD_WIDTH / 2),
|
||||||
y * QUAD_WIDTH + (QUAD_WIDTH / 2),
|
y * QUAD_WIDTH + (QUAD_WIDTH / 2),
|
||||||
expected_result);
|
expected_result);
|
||||||
@ -260,9 +260,9 @@ test_depth_test (void)
|
|||||||
{
|
{
|
||||||
TestState state;
|
TestState state;
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb, 0, 0,
|
cogl_framebuffer_orthographic (test_fb, 0, 0,
|
||||||
cogl_framebuffer_get_width (fb),
|
cogl_framebuffer_get_width (test_fb),
|
||||||
cogl_framebuffer_get_height (fb),
|
cogl_framebuffer_get_height (test_fb),
|
||||||
-1,
|
-1,
|
||||||
100);
|
100);
|
||||||
|
|
||||||
|
@ -61,17 +61,17 @@ test_euler_quaternion (void)
|
|||||||
COMPARE_MATRICES (&matrix_a, &matrix_b);
|
COMPARE_MATRICES (&matrix_a, &matrix_b);
|
||||||
|
|
||||||
/* Try applying the rotation from a euler to a framebuffer */
|
/* Try applying the rotation from a euler to a framebuffer */
|
||||||
cogl_framebuffer_identity_matrix (fb);
|
cogl_framebuffer_identity_matrix (test_fb);
|
||||||
cogl_framebuffer_rotate_euler (fb, &euler);
|
cogl_framebuffer_rotate_euler (test_fb, &euler);
|
||||||
memset (&matrix_b, 0, sizeof (matrix_b));
|
memset (&matrix_b, 0, sizeof (matrix_b));
|
||||||
cogl_framebuffer_get_modelview_matrix (fb, &matrix_b);
|
cogl_framebuffer_get_modelview_matrix (test_fb, &matrix_b);
|
||||||
COMPARE_MATRICES (&matrix_a, &matrix_b);
|
COMPARE_MATRICES (&matrix_a, &matrix_b);
|
||||||
|
|
||||||
/* And again with a quaternion */
|
/* And again with a quaternion */
|
||||||
cogl_framebuffer_identity_matrix (fb);
|
cogl_framebuffer_identity_matrix (test_fb);
|
||||||
cogl_framebuffer_rotate_quaternion (fb, &quaternion);
|
cogl_framebuffer_rotate_quaternion (test_fb, &quaternion);
|
||||||
memset (&matrix_b, 0, sizeof (matrix_b));
|
memset (&matrix_b, 0, sizeof (matrix_b));
|
||||||
cogl_framebuffer_get_modelview_matrix (fb, &matrix_b);
|
cogl_framebuffer_get_modelview_matrix (test_fb, &matrix_b);
|
||||||
COMPARE_MATRICES (&matrix_a, &matrix_b);
|
COMPARE_MATRICES (&matrix_a, &matrix_b);
|
||||||
|
|
||||||
/* FIXME: This needs a lot more tests! */
|
/* FIXME: This needs a lot more tests! */
|
||||||
|
@ -24,17 +24,17 @@ test_push_pop_single_context (void)
|
|||||||
CoglError *error = NULL;
|
CoglError *error = NULL;
|
||||||
|
|
||||||
offscreen_texture = COGL_TEXTURE (
|
offscreen_texture = COGL_TEXTURE (
|
||||||
cogl_texture_2d_new_with_size (ctx,
|
cogl_texture_2d_new_with_size (test_ctx,
|
||||||
cogl_framebuffer_get_width (fb),
|
cogl_framebuffer_get_width (test_fb),
|
||||||
cogl_framebuffer_get_height (fb),
|
cogl_framebuffer_get_height (test_fb),
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
NULL));
|
NULL));
|
||||||
offscreen = cogl_offscreen_new_to_texture (offscreen_texture);
|
offscreen = cogl_offscreen_new_to_texture (offscreen_texture);
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, offscreen_texture);
|
cogl_pipeline_set_layer_texture (pipeline, 0, offscreen_texture);
|
||||||
|
|
||||||
gles2_ctx = cogl_gles2_context_new (ctx, &error);
|
gles2_ctx = cogl_gles2_context_new (test_ctx, &error);
|
||||||
if (!gles2_ctx)
|
if (!gles2_ctx)
|
||||||
g_error ("Failed to create GLES2 context: %s\n", error->message);
|
g_error ("Failed to create GLES2 context: %s\n", error->message);
|
||||||
|
|
||||||
@ -42,10 +42,10 @@ test_push_pop_single_context (void)
|
|||||||
|
|
||||||
/* Clear onscreen to 0xffff00 using GLES2 */
|
/* Clear onscreen to 0xffff00 using GLES2 */
|
||||||
|
|
||||||
if (!cogl_push_gles2_context (ctx,
|
if (!cogl_push_gles2_context (test_ctx,
|
||||||
gles2_ctx,
|
gles2_ctx,
|
||||||
fb,
|
test_fb,
|
||||||
fb,
|
test_fb,
|
||||||
&error))
|
&error))
|
||||||
{
|
{
|
||||||
g_error ("Failed to push gles2 context: %s\n", error->message);
|
g_error ("Failed to push gles2 context: %s\n", error->message);
|
||||||
@ -54,9 +54,9 @@ test_push_pop_single_context (void)
|
|||||||
gles2->glClearColor (1, 1, 0, 1);
|
gles2->glClearColor (1, 1, 0, 1);
|
||||||
gles2->glClear (GL_COLOR_BUFFER_BIT);
|
gles2->glClear (GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
cogl_pop_gles2_context (ctx);
|
cogl_pop_gles2_context (test_ctx);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 0, 0, 0xffff00ff);
|
test_utils_check_pixel (test_fb, 0, 0, 0xffff00ff);
|
||||||
|
|
||||||
/* Clear offscreen to 0xff0000 using GLES2 and then copy the result
|
/* Clear offscreen to 0xff0000 using GLES2 and then copy the result
|
||||||
* onscreen.
|
* onscreen.
|
||||||
@ -66,7 +66,7 @@ test_push_pop_single_context (void)
|
|||||||
* instead.
|
* instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!cogl_push_gles2_context (ctx,
|
if (!cogl_push_gles2_context (test_ctx,
|
||||||
gles2_ctx,
|
gles2_ctx,
|
||||||
COGL_FRAMEBUFFER (offscreen),
|
COGL_FRAMEBUFFER (offscreen),
|
||||||
COGL_FRAMEBUFFER (offscreen),
|
COGL_FRAMEBUFFER (offscreen),
|
||||||
@ -78,9 +78,9 @@ test_push_pop_single_context (void)
|
|||||||
gles2->glClearColor (1, 0, 0, 1);
|
gles2->glClearColor (1, 0, 0, 1);
|
||||||
gles2->glClear (GL_COLOR_BUFFER_BIT);
|
gles2->glClear (GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
cogl_pop_gles2_context (ctx);
|
cogl_pop_gles2_context (test_ctx);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb,
|
cogl_framebuffer_draw_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
-1, 1, 1, -1);
|
-1, 1, 1, -1);
|
||||||
/* NB: Cogl doesn't automatically support mid-scene modifications
|
/* NB: Cogl doesn't automatically support mid-scene modifications
|
||||||
@ -93,7 +93,7 @@ test_push_pop_single_context (void)
|
|||||||
* reading back from the onscreen framebuffer in case we mistakenly
|
* reading back from the onscreen framebuffer in case we mistakenly
|
||||||
* read from the offscreen framebuffer and get a false positive
|
* read from the offscreen framebuffer and get a false positive
|
||||||
*/
|
*/
|
||||||
if (!cogl_push_gles2_context (ctx,
|
if (!cogl_push_gles2_context (test_ctx,
|
||||||
gles2_ctx,
|
gles2_ctx,
|
||||||
COGL_FRAMEBUFFER (offscreen),
|
COGL_FRAMEBUFFER (offscreen),
|
||||||
COGL_FRAMEBUFFER (offscreen),
|
COGL_FRAMEBUFFER (offscreen),
|
||||||
@ -105,22 +105,22 @@ test_push_pop_single_context (void)
|
|||||||
gles2->glClearColor (0, 0, 1, 1);
|
gles2->glClearColor (0, 0, 1, 1);
|
||||||
gles2->glClear (GL_COLOR_BUFFER_BIT);
|
gles2->glClear (GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
cogl_pop_gles2_context (ctx);
|
cogl_pop_gles2_context (test_ctx);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 0, 0, 0xff0000ff);
|
test_utils_check_pixel (test_fb, 0, 0, 0xff0000ff);
|
||||||
|
|
||||||
/* Now copy the offscreen blue clear to the onscreen framebufer and
|
/* Now copy the offscreen blue clear to the onscreen framebufer and
|
||||||
* check that too */
|
* check that too */
|
||||||
cogl_framebuffer_draw_rectangle (fb,
|
cogl_framebuffer_draw_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
-1, 1, 1, -1);
|
-1, 1, 1, -1);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 0, 0, 0x0000ffff);
|
test_utils_check_pixel (test_fb, 0, 0, 0x0000ffff);
|
||||||
|
|
||||||
if (!cogl_push_gles2_context (ctx,
|
if (!cogl_push_gles2_context (test_ctx,
|
||||||
gles2_ctx,
|
gles2_ctx,
|
||||||
fb,
|
test_fb,
|
||||||
fb,
|
test_fb,
|
||||||
&error))
|
&error))
|
||||||
{
|
{
|
||||||
g_error ("Failed to push gles2 context: %s\n", error->message);
|
g_error ("Failed to push gles2 context: %s\n", error->message);
|
||||||
@ -129,9 +129,9 @@ test_push_pop_single_context (void)
|
|||||||
gles2->glClearColor (1, 0, 1, 1);
|
gles2->glClearColor (1, 0, 1, 1);
|
||||||
gles2->glClear (GL_COLOR_BUFFER_BIT);
|
gles2->glClear (GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
cogl_pop_gles2_context (ctx);
|
cogl_pop_gles2_context (test_ctx);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 0, 0, 0xff00ffff);
|
test_utils_check_pixel (test_fb, 0, 0, 0xff00ffff);
|
||||||
|
|
||||||
|
|
||||||
cogl_object_unref (gles2_ctx);
|
cogl_object_unref (gles2_ctx);
|
||||||
@ -149,17 +149,17 @@ create_gles2_context (CoglTexture **offscreen_texture,
|
|||||||
CoglError *error = NULL;
|
CoglError *error = NULL;
|
||||||
|
|
||||||
*offscreen_texture = COGL_TEXTURE (
|
*offscreen_texture = COGL_TEXTURE (
|
||||||
cogl_texture_2d_new_with_size (ctx,
|
cogl_texture_2d_new_with_size (test_ctx,
|
||||||
cogl_framebuffer_get_width (fb),
|
cogl_framebuffer_get_width (test_fb),
|
||||||
cogl_framebuffer_get_height (fb),
|
cogl_framebuffer_get_height (test_fb),
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
NULL));
|
NULL));
|
||||||
*offscreen = cogl_offscreen_new_to_texture (*offscreen_texture);
|
*offscreen = cogl_offscreen_new_to_texture (*offscreen_texture);
|
||||||
|
|
||||||
*pipeline = cogl_pipeline_new (ctx);
|
*pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_set_layer_texture (*pipeline, 0, *offscreen_texture);
|
cogl_pipeline_set_layer_texture (*pipeline, 0, *offscreen_texture);
|
||||||
|
|
||||||
*gles2_ctx = cogl_gles2_context_new (ctx, &error);
|
*gles2_ctx = cogl_gles2_context_new (test_ctx, &error);
|
||||||
if (!*gles2_ctx)
|
if (!*gles2_ctx)
|
||||||
g_error ("Failed to create GLES2 context: %s\n", error->message);
|
g_error ("Failed to create GLES2 context: %s\n", error->message);
|
||||||
|
|
||||||
@ -193,9 +193,9 @@ test_push_pop_multi_context (void)
|
|||||||
&gles2_ctx1,
|
&gles2_ctx1,
|
||||||
&gles21);
|
&gles21);
|
||||||
|
|
||||||
cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 1, 1, 1, 1);
|
cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 1, 1, 1, 1);
|
||||||
|
|
||||||
if (!cogl_push_gles2_context (ctx,
|
if (!cogl_push_gles2_context (test_ctx,
|
||||||
gles2_ctx0,
|
gles2_ctx0,
|
||||||
COGL_FRAMEBUFFER (offscreen0),
|
COGL_FRAMEBUFFER (offscreen0),
|
||||||
COGL_FRAMEBUFFER (offscreen0),
|
COGL_FRAMEBUFFER (offscreen0),
|
||||||
@ -207,7 +207,7 @@ test_push_pop_multi_context (void)
|
|||||||
gles20->glClearColor (1, 0, 0, 1);
|
gles20->glClearColor (1, 0, 0, 1);
|
||||||
gles20->glClear (GL_COLOR_BUFFER_BIT);
|
gles20->glClear (GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
if (!cogl_push_gles2_context (ctx,
|
if (!cogl_push_gles2_context (test_ctx,
|
||||||
gles2_ctx1,
|
gles2_ctx1,
|
||||||
COGL_FRAMEBUFFER (offscreen1),
|
COGL_FRAMEBUFFER (offscreen1),
|
||||||
COGL_FRAMEBUFFER (offscreen1),
|
COGL_FRAMEBUFFER (offscreen1),
|
||||||
@ -219,22 +219,22 @@ test_push_pop_multi_context (void)
|
|||||||
gles21->glClearColor (0, 1, 0, 1);
|
gles21->glClearColor (0, 1, 0, 1);
|
||||||
gles21->glClear (GL_COLOR_BUFFER_BIT);
|
gles21->glClear (GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
cogl_pop_gles2_context (ctx);
|
cogl_pop_gles2_context (test_ctx);
|
||||||
cogl_pop_gles2_context (ctx);
|
cogl_pop_gles2_context (test_ctx);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 0, 0, 0xffffffff);
|
test_utils_check_pixel (test_fb, 0, 0, 0xffffffff);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb,
|
cogl_framebuffer_draw_rectangle (test_fb,
|
||||||
pipeline0,
|
pipeline0,
|
||||||
-1, 1, 1, -1);
|
-1, 1, 1, -1);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 0, 0, 0xff0000ff);
|
test_utils_check_pixel (test_fb, 0, 0, 0xff0000ff);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb,
|
cogl_framebuffer_draw_rectangle (test_fb,
|
||||||
pipeline1,
|
pipeline1,
|
||||||
-1, 1, 1, -1);
|
-1, 1, 1, -1);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 0, 0, 0x00ff00ff);
|
test_utils_check_pixel (test_fb, 0, 0, 0x00ff00ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLuint
|
static GLuint
|
||||||
@ -288,9 +288,9 @@ test_gles2_read_pixels (void)
|
|||||||
&gles2_ctx,
|
&gles2_ctx,
|
||||||
&gles2);
|
&gles2);
|
||||||
|
|
||||||
cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 1, 1, 1, 1);
|
cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 1, 1, 1, 1);
|
||||||
|
|
||||||
if (!cogl_push_gles2_context (ctx,
|
if (!cogl_push_gles2_context (test_ctx,
|
||||||
gles2_ctx,
|
gles2_ctx,
|
||||||
COGL_FRAMEBUFFER (offscreen),
|
COGL_FRAMEBUFFER (offscreen),
|
||||||
COGL_FRAMEBUFFER (offscreen),
|
COGL_FRAMEBUFFER (offscreen),
|
||||||
@ -329,15 +329,15 @@ test_gles2_read_pixels (void)
|
|||||||
g_assert (pixel[1] == 0xff);
|
g_assert (pixel[1] == 0xff);
|
||||||
g_assert (pixel[2] == 0xff);
|
g_assert (pixel[2] == 0xff);
|
||||||
|
|
||||||
cogl_pop_gles2_context (ctx);
|
cogl_pop_gles2_context (test_ctx);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 0, 0, 0xffffffff);
|
test_utils_check_pixel (test_fb, 0, 0, 0xffffffff);
|
||||||
|
|
||||||
/* Bind different read and write buffers */
|
/* Bind different read and write buffers */
|
||||||
if (!cogl_push_gles2_context (ctx,
|
if (!cogl_push_gles2_context (test_ctx,
|
||||||
gles2_ctx,
|
gles2_ctx,
|
||||||
COGL_FRAMEBUFFER (offscreen),
|
COGL_FRAMEBUFFER (offscreen),
|
||||||
fb,
|
test_fb,
|
||||||
&error))
|
&error))
|
||||||
{
|
{
|
||||||
g_error ("Failed to push gles2 context: %s\n", error->message);
|
g_error ("Failed to push gles2 context: %s\n", error->message);
|
||||||
@ -349,16 +349,16 @@ test_gles2_read_pixels (void)
|
|||||||
g_assert (pixel[1] == 0xff);
|
g_assert (pixel[1] == 0xff);
|
||||||
g_assert (pixel[2] == 0xff);
|
g_assert (pixel[2] == 0xff);
|
||||||
|
|
||||||
cogl_pop_gles2_context (ctx);
|
cogl_pop_gles2_context (test_ctx);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 0, 0, 0xffffffff);
|
test_utils_check_pixel (test_fb, 0, 0, 0xffffffff);
|
||||||
|
|
||||||
/* Bind different read and write buffers (the other way around from
|
/* Bind different read and write buffers (the other way around from
|
||||||
* before so when we test with COGL_TEST_ONSCREEN=1 we will read
|
* before so when we test with COGL_TEST_ONSCREEN=1 we will read
|
||||||
* from an onscreen framebuffer) */
|
* from an onscreen framebuffer) */
|
||||||
if (!cogl_push_gles2_context (ctx,
|
if (!cogl_push_gles2_context (test_ctx,
|
||||||
gles2_ctx,
|
gles2_ctx,
|
||||||
fb,
|
test_fb,
|
||||||
COGL_FRAMEBUFFER (offscreen),
|
COGL_FRAMEBUFFER (offscreen),
|
||||||
&error))
|
&error))
|
||||||
{
|
{
|
||||||
@ -371,7 +371,7 @@ test_gles2_read_pixels (void)
|
|||||||
g_assert (pixel[1] == 0xff);
|
g_assert (pixel[1] == 0xff);
|
||||||
g_assert (pixel[2] == 0xff);
|
g_assert (pixel[2] == 0xff);
|
||||||
|
|
||||||
cogl_pop_gles2_context (ctx);
|
cogl_pop_gles2_context (test_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -674,8 +674,8 @@ test_gles2_context_fbo (void)
|
|||||||
int i;
|
int i;
|
||||||
PaintData data;
|
PaintData data;
|
||||||
|
|
||||||
data.fb_width = cogl_framebuffer_get_width (fb);
|
data.fb_width = cogl_framebuffer_get_width (test_fb);
|
||||||
data.fb_height = cogl_framebuffer_get_height (fb);
|
data.fb_height = cogl_framebuffer_get_height (test_fb);
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (paint_methods); i++)
|
for (i = 0; i < G_N_ELEMENTS (paint_methods); i++)
|
||||||
{
|
{
|
||||||
@ -692,7 +692,7 @@ test_gles2_context_fbo (void)
|
|||||||
&gles2_ctx,
|
&gles2_ctx,
|
||||||
&data.gles2);
|
&data.gles2);
|
||||||
|
|
||||||
if (!cogl_push_gles2_context (ctx,
|
if (!cogl_push_gles2_context (test_ctx,
|
||||||
gles2_ctx,
|
gles2_ctx,
|
||||||
COGL_FRAMEBUFFER (offscreen),
|
COGL_FRAMEBUFFER (offscreen),
|
||||||
COGL_FRAMEBUFFER (offscreen),
|
COGL_FRAMEBUFFER (offscreen),
|
||||||
@ -720,12 +720,12 @@ test_gles2_context_fbo (void)
|
|||||||
|
|
||||||
verify_read_pixels (&data);
|
verify_read_pixels (&data);
|
||||||
|
|
||||||
cogl_pop_gles2_context (ctx);
|
cogl_pop_gles2_context (test_ctx);
|
||||||
|
|
||||||
cogl_object_unref (offscreen);
|
cogl_object_unref (offscreen);
|
||||||
cogl_object_unref (gles2_ctx);
|
cogl_object_unref (gles2_ctx);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb,
|
cogl_framebuffer_draw_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
-1.0f, 1.0f,
|
-1.0f, 1.0f,
|
||||||
1.0f, -1.0f);
|
1.0f, -1.0f);
|
||||||
@ -734,11 +734,11 @@ test_gles2_context_fbo (void)
|
|||||||
cogl_object_unref (offscreen_texture);
|
cogl_object_unref (offscreen_texture);
|
||||||
|
|
||||||
/* Top half of the framebuffer should be red */
|
/* Top half of the framebuffer should be red */
|
||||||
test_utils_check_pixel (fb,
|
test_utils_check_pixel (test_fb,
|
||||||
data.fb_width / 2, data.fb_height / 4,
|
data.fb_width / 2, data.fb_height / 4,
|
||||||
0xff0000ff);
|
0xff0000ff);
|
||||||
/* Bottom half should be blue */
|
/* Bottom half should be blue */
|
||||||
test_utils_check_pixel (fb,
|
test_utils_check_pixel (test_fb,
|
||||||
data.fb_width / 2, data.fb_height * 3 / 4,
|
data.fb_width / 2, data.fb_height * 3 / 4,
|
||||||
0x0000ffff);
|
0x0000ffff);
|
||||||
}
|
}
|
||||||
@ -807,8 +807,8 @@ test_gles2_context_copy_tex_image (void)
|
|||||||
-1.0f, 1.0f, 0.0f, 1.0f,
|
-1.0f, 1.0f, 0.0f, 1.0f,
|
||||||
1.0f, 1.0f, 1.0f, 1.0f
|
1.0f, 1.0f, 1.0f, 1.0f
|
||||||
};
|
};
|
||||||
int fb_width = cogl_framebuffer_get_width (fb);
|
int fb_width = cogl_framebuffer_get_width (test_fb);
|
||||||
int fb_height = cogl_framebuffer_get_height (fb);
|
int fb_height = cogl_framebuffer_get_height (test_fb);
|
||||||
CoglTexture *offscreen_texture;
|
CoglTexture *offscreen_texture;
|
||||||
CoglOffscreen *offscreen;
|
CoglOffscreen *offscreen;
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
@ -827,7 +827,7 @@ test_gles2_context_copy_tex_image (void)
|
|||||||
&gles2_ctx,
|
&gles2_ctx,
|
||||||
&gles2);
|
&gles2);
|
||||||
|
|
||||||
if (!cogl_push_gles2_context (ctx,
|
if (!cogl_push_gles2_context (test_ctx,
|
||||||
gles2_ctx,
|
gles2_ctx,
|
||||||
COGL_FRAMEBUFFER (offscreen),
|
COGL_FRAMEBUFFER (offscreen),
|
||||||
COGL_FRAMEBUFFER (offscreen),
|
COGL_FRAMEBUFFER (offscreen),
|
||||||
@ -967,7 +967,7 @@ test_gles2_context_copy_tex_image (void)
|
|||||||
RECTANGLE_HEIGHT / 2,
|
RECTANGLE_HEIGHT / 2,
|
||||||
0x0000ffff);
|
0x0000ffff);
|
||||||
|
|
||||||
cogl_pop_gles2_context (ctx);
|
cogl_pop_gles2_context (test_ctx);
|
||||||
|
|
||||||
cogl_object_unref (offscreen);
|
cogl_object_unref (offscreen);
|
||||||
cogl_object_unref (gles2_ctx);
|
cogl_object_unref (gles2_ctx);
|
||||||
|
@ -97,7 +97,7 @@ paint_legacy (TestState *state)
|
|||||||
static void
|
static void
|
||||||
paint (TestState *state)
|
paint (TestState *state)
|
||||||
{
|
{
|
||||||
CoglPipeline *pipeline = cogl_pipeline_new (ctx);
|
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
CoglColor color;
|
CoglColor color;
|
||||||
CoglError *error = NULL;
|
CoglError *error = NULL;
|
||||||
@ -179,10 +179,10 @@ test_just_vertex_shader (void)
|
|||||||
{
|
{
|
||||||
TestState state;
|
TestState state;
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0,
|
0, 0,
|
||||||
cogl_framebuffer_get_width (fb),
|
cogl_framebuffer_get_width (test_fb),
|
||||||
cogl_framebuffer_get_height (fb),
|
cogl_framebuffer_get_height (test_fb),
|
||||||
-1,
|
-1,
|
||||||
100);
|
100);
|
||||||
|
|
||||||
@ -191,13 +191,13 @@ test_just_vertex_shader (void)
|
|||||||
{
|
{
|
||||||
/* XXX: we have to push/pop a framebuffer since this test currently
|
/* XXX: we have to push/pop a framebuffer since this test currently
|
||||||
* uses the legacy cogl_rectangle() api. */
|
* uses the legacy cogl_rectangle() api. */
|
||||||
cogl_push_framebuffer (fb);
|
cogl_push_framebuffer (test_fb);
|
||||||
|
|
||||||
paint_legacy (&state);
|
paint_legacy (&state);
|
||||||
validate_result (fb);
|
validate_result (test_fb);
|
||||||
|
|
||||||
paint (&state);
|
paint (&state);
|
||||||
validate_result (fb);
|
validate_result (test_fb);
|
||||||
|
|
||||||
cogl_pop_framebuffer ();
|
cogl_pop_framebuffer ();
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
static CoglPipeline *
|
static CoglPipeline *
|
||||||
create_two_layer_pipeline (void)
|
create_two_layer_pipeline (void)
|
||||||
{
|
{
|
||||||
CoglPipeline *pipeline = cogl_pipeline_new (ctx);
|
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
|
||||||
CoglColor color;
|
CoglColor color;
|
||||||
|
|
||||||
/* The pipeline is initially black */
|
/* The pipeline is initially black */
|
||||||
@ -37,13 +37,13 @@ test_color (CoglPipeline *pipeline,
|
|||||||
uint32_t color,
|
uint32_t color,
|
||||||
int pos)
|
int pos)
|
||||||
{
|
{
|
||||||
cogl_framebuffer_draw_rectangle (fb,
|
cogl_framebuffer_draw_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
pos * TEST_SQUARE_SIZE,
|
pos * TEST_SQUARE_SIZE,
|
||||||
0,
|
0,
|
||||||
pos * TEST_SQUARE_SIZE + TEST_SQUARE_SIZE,
|
pos * TEST_SQUARE_SIZE + TEST_SQUARE_SIZE,
|
||||||
TEST_SQUARE_SIZE);
|
TEST_SQUARE_SIZE);
|
||||||
test_utils_check_pixel (fb,
|
test_utils_check_pixel (test_fb,
|
||||||
pos * TEST_SQUARE_SIZE + TEST_SQUARE_SIZE / 2,
|
pos * TEST_SQUARE_SIZE + TEST_SQUARE_SIZE / 2,
|
||||||
TEST_SQUARE_SIZE / 2,
|
TEST_SQUARE_SIZE / 2,
|
||||||
color);
|
color);
|
||||||
@ -56,10 +56,10 @@ test_layer_remove (void)
|
|||||||
CoglColor color;
|
CoglColor color;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0,
|
0, 0,
|
||||||
cogl_framebuffer_get_width (fb),
|
cogl_framebuffer_get_width (test_fb),
|
||||||
cogl_framebuffer_get_height (fb),
|
cogl_framebuffer_get_height (test_fb),
|
||||||
-1,
|
-1,
|
||||||
100);
|
100);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ test_map_buffer_range (void)
|
|||||||
CoglAttribute *pos_attribute;
|
CoglAttribute *pos_attribute;
|
||||||
CoglAttribute *tex_coord_attribute;
|
CoglAttribute *tex_coord_attribute;
|
||||||
|
|
||||||
tex = cogl_texture_2d_new_from_data (ctx,
|
tex = cogl_texture_2d_new_from_data (test_ctx,
|
||||||
2, 2, /* width/height */
|
2, 2, /* width/height */
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
@ -41,7 +41,7 @@ test_map_buffer_range (void)
|
|||||||
tex_data,
|
tex_data,
|
||||||
NULL /* error */);
|
NULL /* error */);
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (tex));
|
cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (tex));
|
||||||
cogl_pipeline_set_layer_filters (pipeline,
|
cogl_pipeline_set_layer_filters (pipeline,
|
||||||
@ -52,10 +52,10 @@ test_map_buffer_range (void)
|
|||||||
0, /* layer */
|
0, /* layer */
|
||||||
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
|
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
|
||||||
|
|
||||||
fb_width = cogl_framebuffer_get_width (fb);
|
fb_width = cogl_framebuffer_get_width (test_fb);
|
||||||
fb_height = cogl_framebuffer_get_height (fb);
|
fb_height = cogl_framebuffer_get_height (test_fb);
|
||||||
|
|
||||||
buffer = cogl_attribute_buffer_new (ctx,
|
buffer = cogl_attribute_buffer_new (test_ctx,
|
||||||
sizeof (vertex_data),
|
sizeof (vertex_data),
|
||||||
vertex_data);
|
vertex_data);
|
||||||
|
|
||||||
@ -90,11 +90,11 @@ test_map_buffer_range (void)
|
|||||||
2, /* n_components */
|
2, /* n_components */
|
||||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||||
|
|
||||||
cogl_framebuffer_clear4f (fb,
|
cogl_framebuffer_clear4f (test_fb,
|
||||||
COGL_BUFFER_BIT_COLOR,
|
COGL_BUFFER_BIT_COLOR,
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
|
|
||||||
cogl_framebuffer_vdraw_attributes (fb,
|
cogl_framebuffer_vdraw_attributes (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
COGL_VERTICES_MODE_TRIANGLE_STRIP,
|
COGL_VERTICES_MODE_TRIANGLE_STRIP,
|
||||||
0, /* first_vertex */
|
0, /* first_vertex */
|
||||||
@ -104,11 +104,11 @@ test_map_buffer_range (void)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* Top left pixel should be the one that is replaced to be green */
|
/* Top left pixel should be the one that is replaced to be green */
|
||||||
test_utils_check_pixel (fb, 1, 1, 0x00ff00ff);
|
test_utils_check_pixel (test_fb, 1, 1, 0x00ff00ff);
|
||||||
/* The other three corners should be left as red */
|
/* The other three corners should be left as red */
|
||||||
test_utils_check_pixel (fb, fb_width - 2, 1, 0xff0000ff);
|
test_utils_check_pixel (test_fb, fb_width - 2, 1, 0xff0000ff);
|
||||||
test_utils_check_pixel (fb, 1, fb_height - 2, 0xff0000ff);
|
test_utils_check_pixel (test_fb, 1, fb_height - 2, 0xff0000ff);
|
||||||
test_utils_check_pixel (fb, fb_width - 2, fb_height - 2, 0xff0000ff);
|
test_utils_check_pixel (test_fb, fb_width - 2, fb_height - 2, 0xff0000ff);
|
||||||
|
|
||||||
cogl_object_unref (buffer);
|
cogl_object_unref (buffer);
|
||||||
cogl_object_unref (pos_attribute);
|
cogl_object_unref (pos_attribute);
|
||||||
|
@ -33,7 +33,7 @@ validate_part (int xnum,
|
|||||||
int ynum,
|
int ynum,
|
||||||
uint32_t color)
|
uint32_t color)
|
||||||
{
|
{
|
||||||
test_utils_check_region (fb,
|
test_utils_check_region (test_fb,
|
||||||
xnum * PART_RENDER_SIZE + TEST_INSET,
|
xnum * PART_RENDER_SIZE + TEST_INSET,
|
||||||
ynum * PART_RENDER_SIZE + TEST_INSET,
|
ynum * PART_RENDER_SIZE + TEST_INSET,
|
||||||
PART_RENDER_SIZE - TEST_INSET * 2,
|
PART_RENDER_SIZE - TEST_INSET * 2,
|
||||||
@ -106,7 +106,7 @@ make_texture (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The texture should be sliced unless NPOTs are supported */
|
/* The texture should be sliced unless NPOTs are supported */
|
||||||
g_assert (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT)
|
g_assert (cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT)
|
||||||
? !cogl_texture_is_sliced (tex)
|
? !cogl_texture_is_sliced (tex)
|
||||||
: cogl_texture_is_sliced (tex));
|
: cogl_texture_is_sliced (tex));
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ make_texture (void)
|
|||||||
static void
|
static void
|
||||||
paint (void)
|
paint (void)
|
||||||
{
|
{
|
||||||
CoglPipeline *pipeline = cogl_pipeline_new (ctx);
|
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
|
||||||
CoglTexture *texture = make_texture ();
|
CoglTexture *texture = make_texture ();
|
||||||
int y, x;
|
int y, x;
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ paint (void)
|
|||||||
/* Render the texture using four separate rectangles */
|
/* Render the texture using four separate rectangles */
|
||||||
for (y = 0; y < 2; y++)
|
for (y = 0; y < 2; y++)
|
||||||
for (x = 0; x < 2; x++)
|
for (x = 0; x < 2; x++)
|
||||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
x * TEXTURE_RENDER_SIZE / 2,
|
x * TEXTURE_RENDER_SIZE / 2,
|
||||||
y * TEXTURE_RENDER_SIZE / 2,
|
y * TEXTURE_RENDER_SIZE / 2,
|
||||||
@ -148,16 +148,16 @@ test_npot_texture (void)
|
|||||||
{
|
{
|
||||||
if (cogl_test_verbose ())
|
if (cogl_test_verbose ())
|
||||||
{
|
{
|
||||||
if (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT))
|
if (cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT))
|
||||||
g_print ("NPOT textures are supported\n");
|
g_print ("NPOT textures are supported\n");
|
||||||
else
|
else
|
||||||
g_print ("NPOT textures are not supported\n");
|
g_print ("NPOT textures are not supported\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0,
|
0, 0,
|
||||||
cogl_framebuffer_get_width (fb),
|
cogl_framebuffer_get_width (test_fb),
|
||||||
cogl_framebuffer_get_height (fb),
|
cogl_framebuffer_get_height (test_fb),
|
||||||
-1,
|
-1,
|
||||||
100);
|
100);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ check_quadrant (TestState *state,
|
|||||||
width -= 4;
|
width -= 4;
|
||||||
height -= 4;
|
height -= 4;
|
||||||
|
|
||||||
test_utils_check_region (fb, x, y, width, height, expected_rgba);
|
test_utils_check_region (test_fb, x, y, width, height, expected_rgba);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -42,7 +42,7 @@ test_paint (TestState *state)
|
|||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
CoglOffscreen *offscreen;
|
CoglOffscreen *offscreen;
|
||||||
|
|
||||||
tex_2d = cogl_texture_2d_new_with_size (ctx,
|
tex_2d = cogl_texture_2d_new_with_size (test_ctx,
|
||||||
state->fb_width,
|
state->fb_width,
|
||||||
state->fb_height,
|
state->fb_height,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
@ -125,7 +125,7 @@ test_flush (TestState *state)
|
|||||||
the contents of the texture will automatically flush the
|
the contents of the texture will automatically flush the
|
||||||
journal */
|
journal */
|
||||||
|
|
||||||
tex_2d = cogl_texture_2d_new_with_size (ctx,
|
tex_2d = cogl_texture_2d_new_with_size (test_ctx,
|
||||||
16, 16, /* width/height */
|
16, 16, /* width/height */
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
NULL);
|
NULL);
|
||||||
@ -169,7 +169,7 @@ test_flush (TestState *state)
|
|||||||
/* Third time try drawing the texture to the screen */
|
/* Third time try drawing the texture to the screen */
|
||||||
cogl_set_source_texture (tex);
|
cogl_set_source_texture (tex);
|
||||||
cogl_rectangle (-1, -1, 1, 1);
|
cogl_rectangle (-1, -1, 1, 1);
|
||||||
test_utils_check_region (fb,
|
test_utils_check_region (test_fb,
|
||||||
2, 2, /* x/y */
|
2, 2, /* x/y */
|
||||||
state->fb_width - 4,
|
state->fb_width - 4,
|
||||||
state->fb_height - 4,
|
state->fb_height - 4,
|
||||||
@ -186,12 +186,12 @@ test_offscreen (void)
|
|||||||
{
|
{
|
||||||
TestState state;
|
TestState state;
|
||||||
|
|
||||||
state.fb_width = cogl_framebuffer_get_width (fb);
|
state.fb_width = cogl_framebuffer_get_width (test_fb);
|
||||||
state.fb_height = cogl_framebuffer_get_height (fb);
|
state.fb_height = cogl_framebuffer_get_height (test_fb);
|
||||||
|
|
||||||
/* XXX: we have to push/pop a framebuffer since this test currently
|
/* XXX: we have to push/pop a framebuffer since this test currently
|
||||||
* uses the legacy cogl_rectangle() api. */
|
* uses the legacy cogl_rectangle() api. */
|
||||||
cogl_push_framebuffer (fb);
|
cogl_push_framebuffer (test_fb);
|
||||||
test_paint (&state);
|
test_paint (&state);
|
||||||
test_flush (&state);
|
test_flush (&state);
|
||||||
cogl_pop_framebuffer ();
|
cogl_pop_framebuffer ();
|
||||||
|
@ -17,12 +17,12 @@ typedef struct _TestState
|
|||||||
static void
|
static void
|
||||||
draw_path_at (CoglPath *path, CoglPipeline *pipeline, int x, int y)
|
draw_path_at (CoglPath *path, CoglPipeline *pipeline, int x, int y)
|
||||||
{
|
{
|
||||||
cogl_framebuffer_push_matrix (fb);
|
cogl_framebuffer_push_matrix (test_fb);
|
||||||
cogl_framebuffer_translate (fb, x * BLOCK_SIZE, y * BLOCK_SIZE, 0.0f);
|
cogl_framebuffer_translate (test_fb, x * BLOCK_SIZE, y * BLOCK_SIZE, 0.0f);
|
||||||
|
|
||||||
cogl_framebuffer_fill_path (fb, pipeline, path);
|
cogl_framebuffer_fill_path (test_fb, pipeline, path);
|
||||||
|
|
||||||
cogl_framebuffer_pop_matrix (fb);
|
cogl_framebuffer_pop_matrix (test_fb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -35,7 +35,7 @@ check_block (int block_x, int block_y, int block_mask)
|
|||||||
filled. The bits from 0->3 represent the top left, top right,
|
filled. The bits from 0->3 represent the top left, top right,
|
||||||
bottom left and bottom right respectively */
|
bottom left and bottom right respectively */
|
||||||
|
|
||||||
cogl_framebuffer_read_pixels (fb,
|
cogl_framebuffer_read_pixels (test_fb,
|
||||||
block_x * BLOCK_SIZE,
|
block_x * BLOCK_SIZE,
|
||||||
block_y * BLOCK_SIZE,
|
block_y * BLOCK_SIZE,
|
||||||
BLOCK_SIZE, BLOCK_SIZE,
|
BLOCK_SIZE, BLOCK_SIZE,
|
||||||
@ -67,7 +67,7 @@ static void
|
|||||||
paint (TestState *state)
|
paint (TestState *state)
|
||||||
{
|
{
|
||||||
CoglPath *path_a, *path_b, *path_c;
|
CoglPath *path_a, *path_b, *path_c;
|
||||||
CoglPipeline *white = cogl_pipeline_new (ctx);
|
CoglPipeline *white = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
cogl_pipeline_set_color4f (white, 1, 1, 1, 1);
|
cogl_pipeline_set_color4f (white, 1, 1, 1, 1);
|
||||||
|
|
||||||
@ -200,10 +200,10 @@ test_path (void)
|
|||||||
{
|
{
|
||||||
TestState state;
|
TestState state;
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0,
|
0, 0,
|
||||||
cogl_framebuffer_get_width (fb),
|
cogl_framebuffer_get_width (test_fb),
|
||||||
cogl_framebuffer_get_height (fb),
|
cogl_framebuffer_get_height (test_fb),
|
||||||
-1,
|
-1,
|
||||||
100);
|
100);
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ create_pipeline_for_shader (TestState *state, const char *shader_source)
|
|||||||
CoglHandle shader;
|
CoglHandle shader;
|
||||||
CoglHandle program;
|
CoglHandle program;
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
|
shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
|
||||||
cogl_shader_source (shader, shader_source);
|
cogl_shader_source (shader, shader_source);
|
||||||
@ -177,7 +177,7 @@ destroy_state (TestState *state)
|
|||||||
static void
|
static void
|
||||||
paint_pipeline (CoglPipeline *pipeline, int pos)
|
paint_pipeline (CoglPipeline *pipeline, int pos)
|
||||||
{
|
{
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline,
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
|
||||||
pos * 10, 0, pos * 10 + 10, 10);
|
pos * 10, 0, pos * 10 + 10, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ paint_long_pipeline (TestState *state)
|
|||||||
static void
|
static void
|
||||||
paint (TestState *state)
|
paint (TestState *state)
|
||||||
{
|
{
|
||||||
cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
|
cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
|
||||||
|
|
||||||
paint_color_pipelines (state);
|
paint_color_pipelines (state);
|
||||||
paint_matrix_pipeline (state->matrix_pipeline);
|
paint_matrix_pipeline (state->matrix_pipeline);
|
||||||
@ -351,7 +351,7 @@ paint (TestState *state)
|
|||||||
static void
|
static void
|
||||||
check_pos (int pos, uint32_t color)
|
check_pos (int pos, uint32_t color)
|
||||||
{
|
{
|
||||||
test_utils_check_pixel (fb, pos * 10 + 5, 5, color);
|
test_utils_check_pixel (test_fb, pos * 10 + 5, 5, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -390,10 +390,10 @@ test_pipeline_uniforms (void)
|
|||||||
|
|
||||||
init_state (&state);
|
init_state (&state);
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0,
|
0, 0,
|
||||||
cogl_framebuffer_get_width (fb),
|
cogl_framebuffer_get_width (test_fb),
|
||||||
cogl_framebuffer_get_height (fb),
|
cogl_framebuffer_get_height (test_fb),
|
||||||
-1,
|
-1,
|
||||||
100);
|
100);
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ validate_result (TestState *state)
|
|||||||
verify this by reading back the entire stage */
|
verify this by reading back the entire stage */
|
||||||
pixels = g_malloc (state->width * state->height * 4);
|
pixels = g_malloc (state->width * state->height * 4);
|
||||||
|
|
||||||
cogl_framebuffer_read_pixels (fb, 0, 0, state->width, state->height,
|
cogl_framebuffer_read_pixels (test_fb, 0, 0, state->width, state->height,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
(uint8_t *)pixels);
|
(uint8_t *)pixels);
|
||||||
|
|
||||||
@ -56,17 +56,17 @@ paint (TestState *state)
|
|||||||
CoglMatrix matrix;
|
CoglMatrix matrix;
|
||||||
CoglError *error = NULL;
|
CoglError *error = NULL;
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0,
|
0, 0,
|
||||||
state->width,
|
state->width,
|
||||||
state->height,
|
state->height,
|
||||||
-1,
|
-1,
|
||||||
100);
|
100);
|
||||||
|
|
||||||
cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
|
cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
|
||||||
|
|
||||||
cogl_matrix_init_identity (&matrix);
|
cogl_matrix_init_identity (&matrix);
|
||||||
cogl_framebuffer_set_modelview_matrix (fb, &matrix);
|
cogl_framebuffer_set_modelview_matrix (test_fb, &matrix);
|
||||||
|
|
||||||
tex0 = cogl_texture_new_from_data (2, 2,
|
tex0 = cogl_texture_new_from_data (2, 2,
|
||||||
COGL_TEXTURE_NO_ATLAS,
|
COGL_TEXTURE_NO_ATLAS,
|
||||||
@ -81,7 +81,7 @@ paint (TestState *state)
|
|||||||
6,
|
6,
|
||||||
data1);
|
data1);
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
/* Set the two textures as layers */
|
/* Set the two textures as layers */
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, tex0);
|
cogl_pipeline_set_layer_texture (pipeline, 0, tex0);
|
||||||
@ -114,7 +114,7 @@ paint (TestState *state)
|
|||||||
cogl_matrix_scale (&matrix, -1.0f, 1.0f, 1.0f);
|
cogl_matrix_scale (&matrix, -1.0f, 1.0f, 1.0f);
|
||||||
cogl_pipeline_set_layer_matrix (pipeline, 1, &matrix);
|
cogl_pipeline_set_layer_matrix (pipeline, 1, &matrix);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb,
|
cogl_framebuffer_draw_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
0, 0,
|
0, 0,
|
||||||
state->width, state->height);
|
state->width, state->height);
|
||||||
@ -129,8 +129,8 @@ test_pipeline_user_matrix (void)
|
|||||||
{
|
{
|
||||||
TestState state;
|
TestState state;
|
||||||
|
|
||||||
state.width = cogl_framebuffer_get_width (fb);
|
state.width = cogl_framebuffer_get_width (test_fb);
|
||||||
state.height = cogl_framebuffer_get_height (fb);
|
state.height = cogl_framebuffer_get_height (test_fb);
|
||||||
|
|
||||||
paint (&state);
|
paint (&state);
|
||||||
validate_result (&state);
|
validate_result (&state);
|
||||||
|
@ -188,9 +188,9 @@ draw_frame (TestState *state)
|
|||||||
/* Paint the textures */
|
/* Paint the textures */
|
||||||
for (i = 0; i < NB_TILES; i++)
|
for (i = 0; i < NB_TILES; i++)
|
||||||
{
|
{
|
||||||
CoglPipeline *pipeline = cogl_pipeline_new (ctx);
|
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, state->tiles[i].texture);
|
cogl_pipeline_set_layer_texture (pipeline, 0, state->tiles[i].texture);
|
||||||
cogl_framebuffer_draw_rectangle (fb,
|
cogl_framebuffer_draw_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
state->tiles[i].x,
|
state->tiles[i].x,
|
||||||
state->tiles[i].y,
|
state->tiles[i].y,
|
||||||
@ -205,7 +205,7 @@ static void
|
|||||||
validate_tile (TestState *state,
|
validate_tile (TestState *state,
|
||||||
TestTile *tile)
|
TestTile *tile)
|
||||||
{
|
{
|
||||||
test_utils_check_region (fb,
|
test_utils_check_region (test_fb,
|
||||||
tile->x, tile->y,
|
tile->x, tile->y,
|
||||||
TILE_SIZE, TILE_SIZE,
|
TILE_SIZE, TILE_SIZE,
|
||||||
(tile->color[0] << 24) |
|
(tile->color[0] << 24) |
|
||||||
@ -242,20 +242,20 @@ test_pixel_buffer (void)
|
|||||||
{ { 0x7e, 0xff, 0x7e, 0xff }, 0.0f, TILE_SIZE, NULL, NULL }
|
{ { 0x7e, 0xff, 0x7e, 0xff }, 0.0f, TILE_SIZE, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
state.width = cogl_framebuffer_get_width (fb);
|
state.width = cogl_framebuffer_get_width (test_fb);
|
||||||
state.height = cogl_framebuffer_get_height (fb);
|
state.height = cogl_framebuffer_get_height (test_fb);
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0,
|
0, 0,
|
||||||
state.width,
|
state.width,
|
||||||
state.height,
|
state.height,
|
||||||
-1,
|
-1,
|
||||||
100);
|
100);
|
||||||
|
|
||||||
create_map_tile (ctx, &tiles[TILE_MAP]);
|
create_map_tile (test_ctx, &tiles[TILE_MAP]);
|
||||||
#if 0
|
#if 0
|
||||||
create_set_region_tile (shared_state->ctx, &tiles[TILE_SET_REGION]);
|
create_set_region_tile (shared_state->ctx, &tiles[TILE_SET_REGION]);
|
||||||
#endif
|
#endif
|
||||||
create_set_data_tile (ctx, &tiles[TILE_SET_DATA]);
|
create_set_data_tile (test_ctx, &tiles[TILE_SET_DATA]);
|
||||||
|
|
||||||
state.tiles = tiles;
|
state.tiles = tiles;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ calc_coord_offset (int pos, int pos_index, int point_size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
verify_point_size (CoglFramebuffer *fb,
|
verify_point_size (CoglFramebuffer *test_fb,
|
||||||
int x_pos,
|
int x_pos,
|
||||||
int y_pos,
|
int y_pos,
|
||||||
int point_size)
|
int point_size)
|
||||||
@ -37,7 +37,7 @@ verify_point_size (CoglFramebuffer *fb,
|
|||||||
CoglBool in_point = x >= 1 && x <= 2 && y >= 1 && y <= 2;
|
CoglBool in_point = x >= 1 && x <= 2 && y >= 1 && y <= 2;
|
||||||
uint32_t expected_pixel = in_point ? 0x00ff00ff : 0xff0000ff;
|
uint32_t expected_pixel = in_point ? 0x00ff00ff : 0xff0000ff;
|
||||||
|
|
||||||
test_utils_check_pixel (fb,
|
test_utils_check_pixel (test_fb,
|
||||||
calc_coord_offset (x_pos, x, point_size),
|
calc_coord_offset (x_pos, x, point_size),
|
||||||
calc_coord_offset (y_pos, y, point_size),
|
calc_coord_offset (y_pos, y, point_size),
|
||||||
expected_pixel);
|
expected_pixel);
|
||||||
@ -47,18 +47,18 @@ verify_point_size (CoglFramebuffer *fb,
|
|||||||
void
|
void
|
||||||
test_point_size (void)
|
test_point_size (void)
|
||||||
{
|
{
|
||||||
int fb_width = cogl_framebuffer_get_width (fb);
|
int fb_width = cogl_framebuffer_get_width (test_fb);
|
||||||
int fb_height = cogl_framebuffer_get_height (fb);
|
int fb_height = cogl_framebuffer_get_height (test_fb);
|
||||||
int point_size;
|
int point_size;
|
||||||
int x_pos;
|
int x_pos;
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0, /* x_1, y_1 */
|
0, 0, /* x_1, y_1 */
|
||||||
fb_width, /* x_2 */
|
fb_width, /* x_2 */
|
||||||
fb_height /* y_2 */,
|
fb_height /* y_2 */,
|
||||||
-1, 100 /* near/far */);
|
-1, 100 /* near/far */);
|
||||||
|
|
||||||
cogl_framebuffer_clear4f (fb,
|
cogl_framebuffer_clear4f (test_fb,
|
||||||
COGL_BUFFER_BIT_COLOR,
|
COGL_BUFFER_BIT_COLOR,
|
||||||
1.0f, 0.0f, 0.0f, 1.0f);
|
1.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
@ -68,18 +68,18 @@ test_point_size (void)
|
|||||||
point_size >= 4;
|
point_size >= 4;
|
||||||
x_pos += POINT_BOX_SIZE, point_size /= 2)
|
x_pos += POINT_BOX_SIZE, point_size /= 2)
|
||||||
{
|
{
|
||||||
CoglPipeline *pipeline = cogl_pipeline_new (ctx);
|
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
|
||||||
CoglVertexP2 point = { x_pos + POINT_BOX_SIZE / 2,
|
CoglVertexP2 point = { x_pos + POINT_BOX_SIZE / 2,
|
||||||
POINT_BOX_SIZE / 2 };
|
POINT_BOX_SIZE / 2 };
|
||||||
CoglPrimitive *prim =
|
CoglPrimitive *prim =
|
||||||
cogl_primitive_new_p2 (ctx,
|
cogl_primitive_new_p2 (test_ctx,
|
||||||
COGL_VERTICES_MODE_POINTS,
|
COGL_VERTICES_MODE_POINTS,
|
||||||
1, /* n_vertices */
|
1, /* n_vertices */
|
||||||
&point);
|
&point);
|
||||||
|
|
||||||
cogl_pipeline_set_point_size (pipeline, point_size);
|
cogl_pipeline_set_point_size (pipeline, point_size);
|
||||||
cogl_pipeline_set_color4ub (pipeline, 0, 255, 0, 255);
|
cogl_pipeline_set_color4ub (pipeline, 0, 255, 0, 255);
|
||||||
cogl_framebuffer_draw_primitive (fb,
|
cogl_framebuffer_draw_primitive (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
prim);
|
prim);
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ test_point_size (void)
|
|||||||
for (x_pos = 0, point_size = MAX_POINT_SIZE;
|
for (x_pos = 0, point_size = MAX_POINT_SIZE;
|
||||||
point_size >= 4;
|
point_size >= 4;
|
||||||
x_pos += POINT_BOX_SIZE, point_size /= 2)
|
x_pos += POINT_BOX_SIZE, point_size /= 2)
|
||||||
verify_point_size (fb,
|
verify_point_size (test_fb,
|
||||||
x_pos + POINT_BOX_SIZE / 2,
|
x_pos + POINT_BOX_SIZE / 2,
|
||||||
POINT_BOX_SIZE / 2,
|
POINT_BOX_SIZE / 2,
|
||||||
point_size);
|
point_size);
|
||||||
|
@ -21,8 +21,8 @@ tex_data[3 * 2 * 2] =
|
|||||||
static void
|
static void
|
||||||
do_test (CoglBool check_orientation)
|
do_test (CoglBool check_orientation)
|
||||||
{
|
{
|
||||||
int fb_width = cogl_framebuffer_get_width (fb);
|
int fb_width = cogl_framebuffer_get_width (test_fb);
|
||||||
int fb_height = cogl_framebuffer_get_height (fb);
|
int fb_height = cogl_framebuffer_get_height (test_fb);
|
||||||
CoglPrimitive *prim;
|
CoglPrimitive *prim;
|
||||||
CoglError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglTexture2D *tex_2d;
|
CoglTexture2D *tex_2d;
|
||||||
@ -30,13 +30,13 @@ do_test (CoglBool check_orientation)
|
|||||||
CoglBool res;
|
CoglBool res;
|
||||||
int tex_height;
|
int tex_height;
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0, /* x_1, y_1 */
|
0, 0, /* x_1, y_1 */
|
||||||
fb_width, /* x_2 */
|
fb_width, /* x_2 */
|
||||||
fb_height /* y_2 */,
|
fb_height /* y_2 */,
|
||||||
-1, 100 /* near/far */);
|
-1, 100 /* near/far */);
|
||||||
|
|
||||||
cogl_framebuffer_clear4f (fb,
|
cogl_framebuffer_clear4f (test_fb,
|
||||||
COGL_BUFFER_BIT_COLOR,
|
COGL_BUFFER_BIT_COLOR,
|
||||||
1.0f, 1.0f, 1.0f, 1.0f);
|
1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ do_test (CoglBool check_orientation)
|
|||||||
else
|
else
|
||||||
tex_height = 1;
|
tex_height = 1;
|
||||||
|
|
||||||
tex_2d = cogl_texture_2d_new_from_data (ctx,
|
tex_2d = cogl_texture_2d_new_from_data (test_ctx,
|
||||||
2, tex_height, /* width/height */
|
2, tex_height, /* width/height */
|
||||||
COGL_PIXEL_FORMAT_RGB_888,
|
COGL_PIXEL_FORMAT_RGB_888,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
@ -58,7 +58,7 @@ do_test (CoglBool check_orientation)
|
|||||||
g_assert (tex_2d != NULL);
|
g_assert (tex_2d != NULL);
|
||||||
g_assert (error == NULL);
|
g_assert (error == NULL);
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (tex_2d));
|
cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (tex_2d));
|
||||||
|
|
||||||
res = cogl_pipeline_set_layer_point_sprite_coords_enabled (pipeline,
|
res = cogl_pipeline_set_layer_point_sprite_coords_enabled (pipeline,
|
||||||
@ -76,12 +76,12 @@ do_test (CoglBool check_orientation)
|
|||||||
COGL_PIPELINE_FILTER_NEAREST);
|
COGL_PIPELINE_FILTER_NEAREST);
|
||||||
cogl_pipeline_set_point_size (pipeline, POINT_SIZE);
|
cogl_pipeline_set_point_size (pipeline, POINT_SIZE);
|
||||||
|
|
||||||
prim = cogl_primitive_new_p2t2 (ctx,
|
prim = cogl_primitive_new_p2t2 (test_ctx,
|
||||||
COGL_VERTICES_MODE_POINTS,
|
COGL_VERTICES_MODE_POINTS,
|
||||||
1, /* n_vertices */
|
1, /* n_vertices */
|
||||||
&point);
|
&point);
|
||||||
|
|
||||||
cogl_framebuffer_draw_primitive (fb,
|
cogl_framebuffer_draw_primitive (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
prim);
|
prim);
|
||||||
|
|
||||||
@ -94,36 +94,36 @@ do_test (CoglBool check_orientation)
|
|||||||
/* enable */
|
/* enable */
|
||||||
FALSE,
|
FALSE,
|
||||||
&error);
|
&error);
|
||||||
cogl_framebuffer_push_matrix (fb);
|
cogl_framebuffer_push_matrix (test_fb);
|
||||||
cogl_framebuffer_translate (fb,
|
cogl_framebuffer_translate (test_fb,
|
||||||
POINT_SIZE * 2, /* x */
|
POINT_SIZE * 2, /* x */
|
||||||
0.0f, /* y */
|
0.0f, /* y */
|
||||||
0.0f /* z */);
|
0.0f /* z */);
|
||||||
cogl_framebuffer_draw_primitive (fb,
|
cogl_framebuffer_draw_primitive (test_fb,
|
||||||
solid_pipeline,
|
solid_pipeline,
|
||||||
prim);
|
prim);
|
||||||
cogl_framebuffer_pop_matrix (fb);
|
cogl_framebuffer_pop_matrix (test_fb);
|
||||||
|
|
||||||
cogl_object_unref (prim);
|
cogl_object_unref (prim);
|
||||||
cogl_object_unref (solid_pipeline);
|
cogl_object_unref (solid_pipeline);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
cogl_object_unref (tex_2d);
|
cogl_object_unref (tex_2d);
|
||||||
|
|
||||||
test_utils_check_pixel (fb,
|
test_utils_check_pixel (test_fb,
|
||||||
POINT_SIZE - POINT_SIZE / 4,
|
POINT_SIZE - POINT_SIZE / 4,
|
||||||
POINT_SIZE - POINT_SIZE / 4,
|
POINT_SIZE - POINT_SIZE / 4,
|
||||||
0x0000ffff);
|
0x0000ffff);
|
||||||
test_utils_check_pixel (fb,
|
test_utils_check_pixel (test_fb,
|
||||||
POINT_SIZE + POINT_SIZE / 4,
|
POINT_SIZE + POINT_SIZE / 4,
|
||||||
POINT_SIZE - POINT_SIZE / 4,
|
POINT_SIZE - POINT_SIZE / 4,
|
||||||
0x00ff00ff);
|
0x00ff00ff);
|
||||||
test_utils_check_pixel (fb,
|
test_utils_check_pixel (test_fb,
|
||||||
POINT_SIZE - POINT_SIZE / 4,
|
POINT_SIZE - POINT_SIZE / 4,
|
||||||
POINT_SIZE + POINT_SIZE / 4,
|
POINT_SIZE + POINT_SIZE / 4,
|
||||||
check_orientation ?
|
check_orientation ?
|
||||||
0x00ffffff :
|
0x00ffffff :
|
||||||
0x0000ffff);
|
0x0000ffff);
|
||||||
test_utils_check_pixel (fb,
|
test_utils_check_pixel (test_fb,
|
||||||
POINT_SIZE + POINT_SIZE / 4,
|
POINT_SIZE + POINT_SIZE / 4,
|
||||||
POINT_SIZE + POINT_SIZE / 4,
|
POINT_SIZE + POINT_SIZE / 4,
|
||||||
check_orientation ?
|
check_orientation ?
|
||||||
@ -133,7 +133,7 @@ do_test (CoglBool check_orientation)
|
|||||||
/* When rendering without the point sprites all of the texture
|
/* When rendering without the point sprites all of the texture
|
||||||
coordinates should be 0,0 so it should get the top-left texel
|
coordinates should be 0,0 so it should get the top-left texel
|
||||||
which is blue */
|
which is blue */
|
||||||
test_utils_check_region (fb,
|
test_utils_check_region (test_fb,
|
||||||
POINT_SIZE * 3 - POINT_SIZE / 2 + 1,
|
POINT_SIZE * 3 - POINT_SIZE / 2 + 1,
|
||||||
POINT_SIZE - POINT_SIZE / 2 + 1,
|
POINT_SIZE - POINT_SIZE / 2 + 1,
|
||||||
POINT_SIZE - 2, POINT_SIZE - 2,
|
POINT_SIZE - 2, POINT_SIZE - 2,
|
||||||
|
@ -46,7 +46,7 @@ make_texture (uint32_t color,
|
|||||||
CoglTexture2D *tex_2d;
|
CoglTexture2D *tex_2d;
|
||||||
guchar *tex_data = gen_tex_data (color);
|
guchar *tex_data = gen_tex_data (color);
|
||||||
|
|
||||||
tex_2d = cogl_texture_2d_new_from_data (ctx,
|
tex_2d = cogl_texture_2d_new_from_data (test_ctx,
|
||||||
QUAD_WIDTH,
|
QUAD_WIDTH,
|
||||||
QUAD_WIDTH,
|
QUAD_WIDTH,
|
||||||
src_format,
|
src_format,
|
||||||
@ -86,24 +86,24 @@ check_texture (CoglPipeline *pipeline,
|
|||||||
uint32_t expected_result)
|
uint32_t expected_result)
|
||||||
{
|
{
|
||||||
/* Legacy */
|
/* Legacy */
|
||||||
cogl_push_framebuffer (fb);
|
cogl_push_framebuffer (test_fb);
|
||||||
cogl_material_set_layer (material, 0, tex);
|
cogl_material_set_layer (material, 0, tex);
|
||||||
cogl_set_source (material);
|
cogl_set_source (material);
|
||||||
cogl_rectangle (x * QUAD_WIDTH,
|
cogl_rectangle (x * QUAD_WIDTH,
|
||||||
y * QUAD_WIDTH,
|
y * QUAD_WIDTH,
|
||||||
x * QUAD_WIDTH + QUAD_WIDTH,
|
x * QUAD_WIDTH + QUAD_WIDTH,
|
||||||
y * QUAD_WIDTH + QUAD_WIDTH);
|
y * QUAD_WIDTH + QUAD_WIDTH);
|
||||||
test_utils_check_pixel (fb, x * QUAD_WIDTH + QUAD_WIDTH / 2, y * QUAD_WIDTH + QUAD_WIDTH / 2, expected_result);
|
test_utils_check_pixel (test_fb, x * QUAD_WIDTH + QUAD_WIDTH / 2, y * QUAD_WIDTH + QUAD_WIDTH / 2, expected_result);
|
||||||
cogl_pop_framebuffer ();
|
cogl_pop_framebuffer ();
|
||||||
|
|
||||||
/* New API */
|
/* New API */
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (tex));
|
cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (tex));
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline,
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
|
||||||
x * QUAD_WIDTH,
|
x * QUAD_WIDTH,
|
||||||
y * QUAD_WIDTH,
|
y * QUAD_WIDTH,
|
||||||
x * QUAD_WIDTH + QUAD_WIDTH,
|
x * QUAD_WIDTH + QUAD_WIDTH,
|
||||||
y * QUAD_WIDTH + QUAD_WIDTH);
|
y * QUAD_WIDTH + QUAD_WIDTH);
|
||||||
test_utils_check_pixel (fb, x * QUAD_WIDTH + QUAD_WIDTH / 2, y * QUAD_WIDTH + QUAD_WIDTH / 2, expected_result);
|
test_utils_check_pixel (test_fb, x * QUAD_WIDTH + QUAD_WIDTH / 2, y * QUAD_WIDTH + QUAD_WIDTH / 2, expected_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -113,13 +113,13 @@ test_premult (void)
|
|||||||
CoglHandle material;
|
CoglHandle material;
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb, 0, 0,
|
cogl_framebuffer_orthographic (test_fb, 0, 0,
|
||||||
cogl_framebuffer_get_width (fb),
|
cogl_framebuffer_get_width (test_fb),
|
||||||
cogl_framebuffer_get_height (fb),
|
cogl_framebuffer_get_height (test_fb),
|
||||||
-1,
|
-1,
|
||||||
100);
|
100);
|
||||||
|
|
||||||
cogl_framebuffer_clear4f (fb,
|
cogl_framebuffer_clear4f (test_fb,
|
||||||
COGL_BUFFER_BIT_COLOR,
|
COGL_BUFFER_BIT_COLOR,
|
||||||
1.0f, 1.0f, 1.0f, 1.0f);
|
1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ test_premult (void)
|
|||||||
"RGBA = REPLACE (TEXTURE)", NULL);
|
"RGBA = REPLACE (TEXTURE)", NULL);
|
||||||
|
|
||||||
/* New API */
|
/* New API */
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_set_blend (pipeline,
|
cogl_pipeline_set_blend (pipeline,
|
||||||
"RGBA = ADD (SRC_COLOR, 0)", NULL);
|
"RGBA = ADD (SRC_COLOR, 0)", NULL);
|
||||||
cogl_pipeline_set_layer_combine (pipeline, 0,
|
cogl_pipeline_set_layer_combine (pipeline, 0,
|
||||||
|
@ -23,7 +23,7 @@ test_prim_p2 (CoglContext *ctx, uint32_t *expected_color)
|
|||||||
static const CoglVertexP2 verts[] =
|
static const CoglVertexP2 verts[] =
|
||||||
{ { 0, 0 }, { 0, 10 }, { 10, 0 } };
|
{ { 0, 0 }, { 0, 10 }, { 10, 0 } };
|
||||||
|
|
||||||
return cogl_primitive_new_p2 (ctx,
|
return cogl_primitive_new_p2 (test_ctx,
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
COGL_VERTICES_MODE_TRIANGLES,
|
||||||
3, /* n_vertices */
|
3, /* n_vertices */
|
||||||
verts);
|
verts);
|
||||||
@ -35,7 +35,7 @@ test_prim_p3 (CoglContext *ctx, uint32_t *expected_color)
|
|||||||
static const CoglVertexP3 verts[] =
|
static const CoglVertexP3 verts[] =
|
||||||
{ { 0, 0, 0 }, { 0, 10, 0 }, { 10, 0, 0 } };
|
{ { 0, 0, 0 }, { 0, 10, 0 }, { 10, 0, 0 } };
|
||||||
|
|
||||||
return cogl_primitive_new_p3 (ctx,
|
return cogl_primitive_new_p3 (test_ctx,
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
COGL_VERTICES_MODE_TRIANGLES,
|
||||||
3, /* n_vertices */
|
3, /* n_vertices */
|
||||||
verts);
|
verts);
|
||||||
@ -51,7 +51,7 @@ test_prim_p2c4 (CoglContext *ctx, uint32_t *expected_color)
|
|||||||
|
|
||||||
*expected_color = 0xffff00ff;
|
*expected_color = 0xffff00ff;
|
||||||
|
|
||||||
return cogl_primitive_new_p2c4 (ctx,
|
return cogl_primitive_new_p2c4 (test_ctx,
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
COGL_VERTICES_MODE_TRIANGLES,
|
||||||
3, /* n_vertices */
|
3, /* n_vertices */
|
||||||
verts);
|
verts);
|
||||||
@ -67,7 +67,7 @@ test_prim_p3c4 (CoglContext *ctx, uint32_t *expected_color)
|
|||||||
|
|
||||||
*expected_color = 0xffff00ff;
|
*expected_color = 0xffff00ff;
|
||||||
|
|
||||||
return cogl_primitive_new_p3c4 (ctx,
|
return cogl_primitive_new_p3c4 (test_ctx,
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
COGL_VERTICES_MODE_TRIANGLES,
|
||||||
3, /* n_vertices */
|
3, /* n_vertices */
|
||||||
verts);
|
verts);
|
||||||
@ -83,7 +83,7 @@ test_prim_p2t2 (CoglContext *ctx, uint32_t *expected_color)
|
|||||||
|
|
||||||
*expected_color = TEX_COLOR;
|
*expected_color = TEX_COLOR;
|
||||||
|
|
||||||
return cogl_primitive_new_p2t2 (ctx,
|
return cogl_primitive_new_p2t2 (test_ctx,
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
COGL_VERTICES_MODE_TRIANGLES,
|
||||||
3, /* n_vertices */
|
3, /* n_vertices */
|
||||||
verts);
|
verts);
|
||||||
@ -99,7 +99,7 @@ test_prim_p3t2 (CoglContext *ctx, uint32_t *expected_color)
|
|||||||
|
|
||||||
*expected_color = TEX_COLOR;
|
*expected_color = TEX_COLOR;
|
||||||
|
|
||||||
return cogl_primitive_new_p3t2 (ctx,
|
return cogl_primitive_new_p3t2 (test_ctx,
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
COGL_VERTICES_MODE_TRIANGLES,
|
||||||
3, /* n_vertices */
|
3, /* n_vertices */
|
||||||
verts);
|
verts);
|
||||||
@ -116,7 +116,7 @@ test_prim_p2t2c4 (CoglContext *ctx, uint32_t *expected_color)
|
|||||||
/* The blue component of the texture color should be replaced with 0xf0 */
|
/* The blue component of the texture color should be replaced with 0xf0 */
|
||||||
*expected_color = (TEX_COLOR & 0xffff00ff) | 0x0000f000;
|
*expected_color = (TEX_COLOR & 0xffff00ff) | 0x0000f000;
|
||||||
|
|
||||||
return cogl_primitive_new_p2t2c4 (ctx,
|
return cogl_primitive_new_p2t2c4 (test_ctx,
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
COGL_VERTICES_MODE_TRIANGLES,
|
||||||
3, /* n_vertices */
|
3, /* n_vertices */
|
||||||
verts);
|
verts);
|
||||||
@ -133,7 +133,7 @@ test_prim_p3t2c4 (CoglContext *ctx, uint32_t *expected_color)
|
|||||||
/* The blue component of the texture color should be replaced with 0xf0 */
|
/* The blue component of the texture color should be replaced with 0xf0 */
|
||||||
*expected_color = (TEX_COLOR & 0xffff00ff) | 0x0000f000;
|
*expected_color = (TEX_COLOR & 0xffff00ff) | 0x0000f000;
|
||||||
|
|
||||||
return cogl_primitive_new_p3t2c4 (ctx,
|
return cogl_primitive_new_p3t2c4 (test_ctx,
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
COGL_VERTICES_MODE_TRIANGLES,
|
||||||
3, /* n_vertices */
|
3, /* n_vertices */
|
||||||
verts);
|
verts);
|
||||||
@ -176,7 +176,7 @@ test_paint (TestState *state)
|
|||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
6, /* rowstride */
|
6, /* rowstride */
|
||||||
tex_data);
|
tex_data);
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_set_color4ub (pipeline,
|
cogl_pipeline_set_color4ub (pipeline,
|
||||||
(PRIM_COLOR >> 24) & 0xff,
|
(PRIM_COLOR >> 24) & 0xff,
|
||||||
(PRIM_COLOR >> 16) & 0xff,
|
(PRIM_COLOR >> 16) & 0xff,
|
||||||
@ -190,14 +190,14 @@ test_paint (TestState *state)
|
|||||||
CoglPrimitive *prim;
|
CoglPrimitive *prim;
|
||||||
uint32_t expected_color = PRIM_COLOR;
|
uint32_t expected_color = PRIM_COLOR;
|
||||||
|
|
||||||
prim = test_prim_funcs[i] (ctx, &expected_color);
|
prim = test_prim_funcs[i] (test_ctx, &expected_color);
|
||||||
|
|
||||||
cogl_framebuffer_push_matrix (fb);
|
cogl_framebuffer_push_matrix (test_fb);
|
||||||
cogl_framebuffer_translate (fb, i * 10, 0, 0);
|
cogl_framebuffer_translate (test_fb, i * 10, 0, 0);
|
||||||
cogl_framebuffer_draw_primitive (fb, pipeline, prim);
|
cogl_framebuffer_draw_primitive (test_fb, pipeline, prim);
|
||||||
cogl_framebuffer_pop_matrix (fb);
|
cogl_framebuffer_pop_matrix (test_fb);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, i * 10 + 2, 2, expected_color);
|
test_utils_check_pixel (test_fb, i * 10 + 2, 2, expected_color);
|
||||||
|
|
||||||
cogl_object_unref (prim);
|
cogl_object_unref (prim);
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ test_copy (TestState *state)
|
|||||||
{
|
{
|
||||||
static const uint16_t indices_data[2] = { 1, 2 };
|
static const uint16_t indices_data[2] = { 1, 2 };
|
||||||
CoglAttributeBuffer *buffer =
|
CoglAttributeBuffer *buffer =
|
||||||
cogl_attribute_buffer_new (ctx, 100, NULL);
|
cogl_attribute_buffer_new (test_ctx, 100, NULL);
|
||||||
CoglAttribute *attributes[N_ATTRIBS];
|
CoglAttribute *attributes[N_ATTRIBS];
|
||||||
CoglAttribute *attributes_a[N_ATTRIBS], *attributes_b[N_ATTRIBS];
|
CoglAttribute *attributes_a[N_ATTRIBS], *attributes_b[N_ATTRIBS];
|
||||||
CoglAttribute **p;
|
CoglAttribute **p;
|
||||||
@ -259,7 +259,7 @@ test_copy (TestState *state)
|
|||||||
attributes,
|
attributes,
|
||||||
N_ATTRIBS);
|
N_ATTRIBS);
|
||||||
|
|
||||||
indices = cogl_indices_new (ctx,
|
indices = cogl_indices_new (test_ctx,
|
||||||
COGL_INDICES_TYPE_UNSIGNED_SHORT,
|
COGL_INDICES_TYPE_UNSIGNED_SHORT,
|
||||||
indices_data,
|
indices_data,
|
||||||
2 /* n_indices */);
|
2 /* n_indices */);
|
||||||
@ -316,10 +316,10 @@ test_primitive (void)
|
|||||||
{
|
{
|
||||||
TestState state;
|
TestState state;
|
||||||
|
|
||||||
state.fb_width = cogl_framebuffer_get_width (fb);
|
state.fb_width = cogl_framebuffer_get_width (test_fb);
|
||||||
state.fb_height = cogl_framebuffer_get_height (fb);
|
state.fb_height = cogl_framebuffer_get_height (test_fb);
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0,
|
0, 0,
|
||||||
state.fb_width,
|
state.fb_width,
|
||||||
state.fb_height,
|
state.fb_height,
|
||||||
|
@ -146,7 +146,7 @@ test_read_texture_formats (void)
|
|||||||
{
|
{
|
||||||
CoglTexture2D *tex_2d;
|
CoglTexture2D *tex_2d;
|
||||||
|
|
||||||
tex_2d = cogl_texture_2d_new_from_data (ctx,
|
tex_2d = cogl_texture_2d_new_from_data (test_ctx,
|
||||||
1, 1, /* width / height */
|
1, 1, /* width / height */
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
|
@ -29,7 +29,7 @@ create_texture_pipeline (TestState *state)
|
|||||||
8, /* rowstride */
|
8, /* rowstride */
|
||||||
tex_data);
|
tex_data);
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, tex);
|
cogl_pipeline_set_layer_texture (pipeline, 0, tex);
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ simple_fragment_snippet (TestState *state)
|
|||||||
CoglSnippet *snippet;
|
CoglSnippet *snippet;
|
||||||
|
|
||||||
/* Simple fragment snippet */
|
/* Simple fragment snippet */
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255);
|
cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255);
|
||||||
|
|
||||||
@ -59,11 +59,11 @@ simple_fragment_snippet (TestState *state)
|
|||||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 0, 0, 10, 10);
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10);
|
||||||
|
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 5, 5, 0xffff00ff);
|
test_utils_check_pixel (test_fb, 5, 5, 0xffff00ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -73,7 +73,7 @@ simple_vertex_snippet (TestState *state)
|
|||||||
CoglSnippet *snippet;
|
CoglSnippet *snippet;
|
||||||
|
|
||||||
/* Simple vertex snippet */
|
/* Simple vertex snippet */
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255);
|
cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255);
|
||||||
|
|
||||||
@ -83,11 +83,11 @@ simple_vertex_snippet (TestState *state)
|
|||||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 10, 0, 20, 10);
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 10, 0, 20, 10);
|
||||||
|
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 15, 5, 0xff00ffff);
|
test_utils_check_pixel (test_fb, 15, 5, 0xff00ffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -99,7 +99,7 @@ shared_uniform (TestState *state)
|
|||||||
|
|
||||||
/* Snippets sharing a uniform across the vertex and fragment
|
/* Snippets sharing a uniform across the vertex and fragment
|
||||||
hooks */
|
hooks */
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
location = cogl_pipeline_get_uniform_location (pipeline, "a_value");
|
location = cogl_pipeline_get_uniform_location (pipeline, "a_value");
|
||||||
cogl_pipeline_set_uniform_1f (pipeline, location, 0.25f);
|
cogl_pipeline_set_uniform_1f (pipeline, location, 0.25f);
|
||||||
@ -117,13 +117,13 @@ shared_uniform (TestState *state)
|
|||||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb,
|
cogl_framebuffer_draw_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
20, 0, 30, 10);
|
20, 0, 30, 10);
|
||||||
|
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 25, 5, 0xff0080ff);
|
test_utils_check_pixel (test_fb, 25, 5, 0xff0080ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -135,7 +135,7 @@ lots_snippets (TestState *state)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Lots of snippets on one pipeline */
|
/* Lots of snippets on one pipeline */
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
cogl_pipeline_set_color4ub (pipeline, 0, 0, 0, 255);
|
cogl_pipeline_set_color4ub (pipeline, 0, 0, 0, 255);
|
||||||
|
|
||||||
@ -163,11 +163,11 @@ lots_snippets (TestState *state)
|
|||||||
g_free (declarations);
|
g_free (declarations);
|
||||||
}
|
}
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 30, 0, 40, 10);
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 30, 0, 40, 10);
|
||||||
|
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 35, 5, 0x19334cff);
|
test_utils_check_pixel (test_fb, 35, 5, 0x19334cff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -178,7 +178,7 @@ shared_variable_pre_post (TestState *state)
|
|||||||
|
|
||||||
/* Test that the pre string can declare variables used by the post
|
/* Test that the pre string can declare variables used by the post
|
||||||
string */
|
string */
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
cogl_pipeline_set_color4ub (pipeline, 255, 255, 255, 255);
|
cogl_pipeline_set_color4ub (pipeline, 255, 255, 255, 255);
|
||||||
|
|
||||||
@ -189,11 +189,11 @@ shared_variable_pre_post (TestState *state)
|
|||||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 40, 0, 50, 10);
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 40, 0, 50, 10);
|
||||||
|
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 45, 5, 0xff0000ff);
|
test_utils_check_pixel (test_fb, 45, 5, 0xff0000ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -214,20 +214,20 @@ test_pipeline_caching (TestState *state)
|
|||||||
" unrelated pipelines */",
|
" unrelated pipelines */",
|
||||||
"cogl_color_out = vec4 (0.0, 1.0, 0.0, 1.0);\n");
|
"cogl_color_out = vec4 (0.0, 1.0, 0.0, 1.0);\n");
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 50, 0, 60, 10);
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 50, 0, 60, 10);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 60, 0, 70, 10);
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 60, 0, 70, 10);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 55, 5, 0x00ff00ff);
|
test_utils_check_pixel (test_fb, 55, 5, 0x00ff00ff);
|
||||||
test_utils_check_pixel (fb, 65, 5, 0x00ff00ff);
|
test_utils_check_pixel (test_fb, 65, 5, 0x00ff00ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -247,14 +247,14 @@ test_replace_string (TestState *state)
|
|||||||
cogl_snippet_set_post (snippet,
|
cogl_snippet_set_post (snippet,
|
||||||
"cogl_color_out += vec4 (0.5, 0.0, 0.0, 1.0);");
|
"cogl_color_out += vec4 (0.5, 0.0, 0.0, 1.0);");
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 70, 0, 80, 10);
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 70, 0, 80, 10);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 75, 5, 0x808000ff);
|
test_utils_check_pixel (test_fb, 75, 5, 0x808000ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -273,7 +273,7 @@ test_texture_lookup_hook (TestState *state)
|
|||||||
|
|
||||||
pipeline = create_texture_pipeline (state);
|
pipeline = create_texture_pipeline (state);
|
||||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
80, 0, 90, 10,
|
80, 0, 90, 10,
|
||||||
0, 0, 0, 0);
|
0, 0, 0, 0);
|
||||||
@ -281,7 +281,7 @@ test_texture_lookup_hook (TestState *state)
|
|||||||
|
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 85, 5, 0x00ffffff);
|
test_utils_check_pixel (test_fb, 85, 5, 0x00ffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -302,12 +302,12 @@ test_multiple_samples (TestState *state)
|
|||||||
|
|
||||||
pipeline = create_texture_pipeline (state);
|
pipeline = create_texture_pipeline (state);
|
||||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 0, 0, 10, 10);
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 5, 5, 0xffff00ff);
|
test_utils_check_pixel (test_fb, 5, 5, 0xffff00ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -322,7 +322,7 @@ test_replace_lookup_hook (TestState *state)
|
|||||||
|
|
||||||
pipeline = create_texture_pipeline (state);
|
pipeline = create_texture_pipeline (state);
|
||||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
90, 0, 100, 10,
|
90, 0, 100, 10,
|
||||||
0, 0, 0, 0);
|
0, 0, 0, 0);
|
||||||
@ -330,7 +330,7 @@ test_replace_lookup_hook (TestState *state)
|
|||||||
|
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 95, 5, 0x0000ffff);
|
test_utils_check_pixel (test_fb, 95, 5, 0x0000ffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -355,13 +355,13 @@ test_replace_snippet (TestState *state)
|
|||||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
100, 0, 110, 10,
|
100, 0, 110, 10,
|
||||||
0, 0, 0, 0);
|
0, 0, 0, 0);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 105, 5, 0xff0000ff);
|
test_utils_check_pixel (test_fb, 105, 5, 0xff0000ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -387,13 +387,13 @@ test_replace_fragment_layer (TestState *state)
|
|||||||
"A = REPLACE(PREVIOUS)",
|
"A = REPLACE(PREVIOUS)",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
110, 0, 120, 10,
|
110, 0, 120, 10,
|
||||||
0, 0, 0, 0);
|
0, 0, 0, 0);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 115, 5, 0xff00ffff);
|
test_utils_check_pixel (test_fb, 115, 5, 0xff00ffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -403,7 +403,7 @@ test_modify_fragment_layer (TestState *state)
|
|||||||
CoglSnippet *snippet;
|
CoglSnippet *snippet;
|
||||||
|
|
||||||
/* Test modifying the fragment layer code */
|
/* Test modifying the fragment layer code */
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
cogl_pipeline_set_uniform_1f (pipeline,
|
cogl_pipeline_set_uniform_1f (pipeline,
|
||||||
cogl_pipeline_get_uniform_location (pipeline,
|
cogl_pipeline_get_uniform_location (pipeline,
|
||||||
@ -416,13 +416,13 @@ test_modify_fragment_layer (TestState *state)
|
|||||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
120, 0, 130, 10,
|
120, 0, 130, 10,
|
||||||
0, 0, 0, 0);
|
0, 0, 0, 0);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 125, 5, 0xff80ffff);
|
test_utils_check_pixel (test_fb, 125, 5, 0xff80ffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -445,13 +445,13 @@ test_modify_vertex_layer (TestState *state)
|
|||||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
130, 0, 140, 10,
|
130, 0, 140, 10,
|
||||||
0, 0, 0, 0);
|
0, 0, 0, 0);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 135, 5, 0xffff00ff);
|
test_utils_check_pixel (test_fb, 135, 5, 0xffff00ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -475,13 +475,13 @@ test_replace_vertex_layer (TestState *state)
|
|||||||
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
cogl_pipeline_add_layer_snippet (pipeline, 0, snippet);
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
140, 0, 150, 10,
|
140, 0, 150, 10,
|
||||||
0, 0, 0, 0);
|
0, 0, 0, 0);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 145, 5, 0x00ff00ff);
|
test_utils_check_pixel (test_fb, 145, 5, 0x00ff00ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -497,7 +497,7 @@ test_vertex_transform_hook (TestState *state)
|
|||||||
|
|
||||||
cogl_matrix_init_identity (&identity_matrix);
|
cogl_matrix_init_identity (&identity_matrix);
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
cogl_pipeline_set_color4ub (pipeline, 255, 0, 255, 255);
|
cogl_pipeline_set_color4ub (pipeline, 255, 0, 255, 255);
|
||||||
|
|
||||||
@ -510,7 +510,7 @@ test_vertex_transform_hook (TestState *state)
|
|||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
/* Copy the current projection matrix to a uniform */
|
/* Copy the current projection matrix to a uniform */
|
||||||
cogl_framebuffer_get_projection_matrix (fb, &matrix);
|
cogl_framebuffer_get_projection_matrix (test_fb, &matrix);
|
||||||
location = cogl_pipeline_get_uniform_location (pipeline, "pmat");
|
location = cogl_pipeline_get_uniform_location (pipeline, "pmat");
|
||||||
cogl_pipeline_set_uniform_matrix (pipeline,
|
cogl_pipeline_set_uniform_matrix (pipeline,
|
||||||
location,
|
location,
|
||||||
@ -521,15 +521,15 @@ test_vertex_transform_hook (TestState *state)
|
|||||||
|
|
||||||
/* Replace the real projection matrix with the identity. This should
|
/* Replace the real projection matrix with the identity. This should
|
||||||
mess up the drawing unless the snippet replacement is working */
|
mess up the drawing unless the snippet replacement is working */
|
||||||
cogl_framebuffer_set_projection_matrix (fb, &identity_matrix);
|
cogl_framebuffer_set_projection_matrix (test_fb, &identity_matrix);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 150, 0, 160, 10);
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 150, 0, 160, 10);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
/* Restore the projection matrix */
|
/* Restore the projection matrix */
|
||||||
cogl_framebuffer_set_projection_matrix (fb, &matrix);
|
cogl_framebuffer_set_projection_matrix (test_fb, &matrix);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 155, 5, 0xff00ffff);
|
test_utils_check_pixel (test_fb, 155, 5, 0xff00ffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -545,7 +545,7 @@ test_snippet_order (TestState *state)
|
|||||||
sections in the same order as they were added. Therefore the r
|
sections in the same order as they were added. Therefore the r
|
||||||
component should be taken from the the second snippet and the g
|
component should be taken from the the second snippet and the g
|
||||||
component from the first */
|
component from the first */
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
cogl_pipeline_set_color4ub (pipeline, 0, 0, 0, 255);
|
cogl_pipeline_set_color4ub (pipeline, 0, 0, 0, 255);
|
||||||
|
|
||||||
@ -564,10 +564,10 @@ test_snippet_order (TestState *state)
|
|||||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 160, 0, 170, 10);
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 160, 0, 170, 10);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 165, 5, 0x80ff00ff);
|
test_utils_check_pixel (test_fb, 165, 5, 0x80ff00ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -588,24 +588,24 @@ test_naming_texture_units (TestState *state)
|
|||||||
"texture2D (cogl_sampler100, vec2 (0.0, 0.0)) + "
|
"texture2D (cogl_sampler100, vec2 (0.0, 0.0)) + "
|
||||||
"texture2D (cogl_sampler200, vec2 (0.0, 0.0));");
|
"texture2D (cogl_sampler200, vec2 (0.0, 0.0));");
|
||||||
|
|
||||||
tex1 = test_utils_create_color_texture (ctx, 0xff0000ff);
|
tex1 = test_utils_create_color_texture (test_ctx, 0xff0000ff);
|
||||||
tex2 = test_utils_create_color_texture (ctx, 0x00ff00ff);
|
tex2 = test_utils_create_color_texture (test_ctx, 0x00ff00ff);
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 100, tex1);
|
cogl_pipeline_set_layer_texture (pipeline, 100, tex1);
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 200, tex2);
|
cogl_pipeline_set_layer_texture (pipeline, 200, tex2);
|
||||||
|
|
||||||
cogl_pipeline_add_snippet (pipeline, snippet);
|
cogl_pipeline_add_snippet (pipeline, snippet);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 0, 0, 10, 10);
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10);
|
||||||
|
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
cogl_object_unref (snippet);
|
cogl_object_unref (snippet);
|
||||||
cogl_object_unref (tex1);
|
cogl_object_unref (tex1);
|
||||||
cogl_object_unref (tex2);
|
cogl_object_unref (tex2);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 5, 5, 0xffff00ff);
|
test_utils_check_pixel (test_fb, 5, 5, 0xffff00ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -680,7 +680,7 @@ run_tests (TestState *state)
|
|||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (tests); i++)
|
for (i = 0; i < G_N_ELEMENTS (tests); i++)
|
||||||
{
|
{
|
||||||
cogl_framebuffer_clear4f (fb,
|
cogl_framebuffer_clear4f (test_fb,
|
||||||
COGL_BUFFER_BIT_COLOR,
|
COGL_BUFFER_BIT_COLOR,
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
|
|
||||||
@ -696,10 +696,10 @@ test_snippets (void)
|
|||||||
{
|
{
|
||||||
TestState state;
|
TestState state;
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0,
|
0, 0,
|
||||||
cogl_framebuffer_get_width (fb),
|
cogl_framebuffer_get_width (test_fb),
|
||||||
cogl_framebuffer_get_height (fb),
|
cogl_framebuffer_get_height (test_fb),
|
||||||
-1,
|
-1,
|
||||||
100);
|
100);
|
||||||
|
|
||||||
|
@ -15,17 +15,17 @@ test_sparse_layer_combine (TestState *state)
|
|||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
CoglTexture *tex1, *tex2;
|
CoglTexture *tex1, *tex2;
|
||||||
|
|
||||||
cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
|
cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
|
||||||
|
|
||||||
/* This tests that the TEXTURE_* numbers used in the layer combine
|
/* This tests that the TEXTURE_* numbers used in the layer combine
|
||||||
string refer to the layer number rather than the unit numbers by
|
string refer to the layer number rather than the unit numbers by
|
||||||
creating a pipeline with very large layer numbers. This should
|
creating a pipeline with very large layer numbers. This should
|
||||||
end up being mapped to much smaller unit numbers */
|
end up being mapped to much smaller unit numbers */
|
||||||
|
|
||||||
tex1 = test_utils_create_color_texture (ctx, 0xff0000ff);
|
tex1 = test_utils_create_color_texture (test_ctx, 0xff0000ff);
|
||||||
tex2 = test_utils_create_color_texture (ctx, 0x00ff00ff);
|
tex2 = test_utils_create_color_texture (test_ctx, 0x00ff00ff);
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 50, tex1);
|
cogl_pipeline_set_layer_texture (pipeline, 50, tex1);
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 100, tex2);
|
cogl_pipeline_set_layer_texture (pipeline, 100, tex2);
|
||||||
@ -33,9 +33,9 @@ test_sparse_layer_combine (TestState *state)
|
|||||||
"RGBA = ADD(TEXTURE_50, TEXTURE_100)",
|
"RGBA = ADD(TEXTURE_50, TEXTURE_100)",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline, -1, -1, 1, 1);
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline, -1, -1, 1, 1);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 2, 2, 0xffff00ff);
|
test_utils_check_pixel (test_fb, 2, 2, 0xffff00ff);
|
||||||
|
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
cogl_object_unref (tex1);
|
cogl_object_unref (tex1);
|
||||||
@ -47,8 +47,8 @@ test_sparse_pipeline (void)
|
|||||||
{
|
{
|
||||||
TestState state;
|
TestState state;
|
||||||
|
|
||||||
state.fb_width = cogl_framebuffer_get_width (fb);
|
state.fb_width = cogl_framebuffer_get_width (test_fb);
|
||||||
state.fb_height = cogl_framebuffer_get_height (fb);
|
state.fb_height = cogl_framebuffer_get_height (test_fb);
|
||||||
|
|
||||||
test_sparse_layer_combine (&state);
|
test_sparse_layer_combine (&state);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ create_source (TestState *state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tex = cogl_texture_2d_new_from_data (ctx,
|
tex = cogl_texture_2d_new_from_data (test_ctx,
|
||||||
SOURCE_SIZE, SOURCE_SIZE,
|
SOURCE_SIZE, SOURCE_SIZE,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888,
|
COGL_PIXEL_FORMAT_RGBA_8888,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
@ -84,7 +84,7 @@ create_test_texture (TestState *state)
|
|||||||
*(p++) = 255;
|
*(p++) = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
tex = cogl_texture_2d_new_from_data (ctx,
|
tex = cogl_texture_2d_new_from_data (test_ctx,
|
||||||
256, 256,
|
256, 256,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
@ -101,10 +101,10 @@ paint (TestState *state)
|
|||||||
{
|
{
|
||||||
CoglTexture2D *full_texture;
|
CoglTexture2D *full_texture;
|
||||||
CoglSubTexture *sub_texture, *sub_sub_texture;
|
CoglSubTexture *sub_texture, *sub_sub_texture;
|
||||||
CoglPipeline *pipeline = cogl_pipeline_new (ctx);
|
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
/* Create a sub texture of the bottom right quarter of the texture */
|
/* Create a sub texture of the bottom right quarter of the texture */
|
||||||
sub_texture = cogl_sub_texture_new (ctx,
|
sub_texture = cogl_sub_texture_new (test_ctx,
|
||||||
COGL_TEXTURE (state->tex),
|
COGL_TEXTURE (state->tex),
|
||||||
DIVISION_WIDTH,
|
DIVISION_WIDTH,
|
||||||
DIVISION_HEIGHT,
|
DIVISION_HEIGHT,
|
||||||
@ -114,21 +114,21 @@ paint (TestState *state)
|
|||||||
/* Paint it */
|
/* Paint it */
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (sub_texture));
|
cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (sub_texture));
|
||||||
cogl_object_unref (sub_texture);
|
cogl_object_unref (sub_texture);
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline,
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
|
||||||
0.0f, 0.0f, DIVISION_WIDTH, DIVISION_HEIGHT);
|
0.0f, 0.0f, DIVISION_WIDTH, DIVISION_HEIGHT);
|
||||||
|
|
||||||
|
|
||||||
/* Repeat a sub texture of the top half of the full texture. This is
|
/* Repeat a sub texture of the top half of the full texture. This is
|
||||||
documented to be undefined so it doesn't technically have to work
|
documented to be undefined so it doesn't technically have to work
|
||||||
but it will with the current implementation */
|
but it will with the current implementation */
|
||||||
sub_texture = cogl_sub_texture_new (ctx,
|
sub_texture = cogl_sub_texture_new (test_ctx,
|
||||||
COGL_TEXTURE (state->tex),
|
COGL_TEXTURE (state->tex),
|
||||||
0, 0,
|
0, 0,
|
||||||
SOURCE_SIZE,
|
SOURCE_SIZE,
|
||||||
DIVISION_HEIGHT);
|
DIVISION_HEIGHT);
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (sub_texture));
|
cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (sub_texture));
|
||||||
cogl_object_unref (sub_texture);
|
cogl_object_unref (sub_texture);
|
||||||
cogl_framebuffer_draw_textured_rectangle (fb, pipeline,
|
cogl_framebuffer_draw_textured_rectangle (test_fb, pipeline,
|
||||||
0.0f,
|
0.0f,
|
||||||
SOURCE_SIZE,
|
SOURCE_SIZE,
|
||||||
SOURCE_SIZE * 2.0f,
|
SOURCE_SIZE * 2.0f,
|
||||||
@ -138,17 +138,17 @@ paint (TestState *state)
|
|||||||
|
|
||||||
/* Create a sub texture of a sub texture */
|
/* Create a sub texture of a sub texture */
|
||||||
full_texture = create_test_texture (state);
|
full_texture = create_test_texture (state);
|
||||||
sub_texture = cogl_sub_texture_new (ctx,
|
sub_texture = cogl_sub_texture_new (test_ctx,
|
||||||
COGL_TEXTURE (full_texture),
|
COGL_TEXTURE (full_texture),
|
||||||
20, 10, 30, 20);
|
20, 10, 30, 20);
|
||||||
cogl_object_unref (full_texture);
|
cogl_object_unref (full_texture);
|
||||||
sub_sub_texture = cogl_sub_texture_new (ctx,
|
sub_sub_texture = cogl_sub_texture_new (test_ctx,
|
||||||
COGL_TEXTURE (sub_texture),
|
COGL_TEXTURE (sub_texture),
|
||||||
20, 10, 10, 10);
|
20, 10, 10, 10);
|
||||||
cogl_object_unref (sub_texture);
|
cogl_object_unref (sub_texture);
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (sub_sub_texture));
|
cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (sub_sub_texture));
|
||||||
cogl_object_unref (sub_sub_texture);
|
cogl_object_unref (sub_sub_texture);
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline,
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
|
||||||
0.0f, SOURCE_SIZE * 2.0f,
|
0.0f, SOURCE_SIZE * 2.0f,
|
||||||
10.0f, SOURCE_SIZE * 2.0f + 10.0f);
|
10.0f, SOURCE_SIZE * 2.0f + 10.0f);
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ validate_part (int xpos, int ypos,
|
|||||||
int width, int height,
|
int width, int height,
|
||||||
uint32_t color)
|
uint32_t color)
|
||||||
{
|
{
|
||||||
test_utils_check_region (fb,
|
test_utils_check_region (test_fb,
|
||||||
xpos + TEST_INSET,
|
xpos + TEST_INSET,
|
||||||
ypos + TEST_INSET,
|
ypos + TEST_INSET,
|
||||||
width - TEST_INSET - 2,
|
width - TEST_INSET - 2,
|
||||||
@ -216,7 +216,7 @@ validate_result (TestState *state)
|
|||||||
/* Sub sub texture */
|
/* Sub sub texture */
|
||||||
p = texture_data = g_malloc (10 * 10 * 4);
|
p = texture_data = g_malloc (10 * 10 * 4);
|
||||||
cogl_flush ();
|
cogl_flush ();
|
||||||
cogl_framebuffer_read_pixels (fb,
|
cogl_framebuffer_read_pixels (test_fb,
|
||||||
0, SOURCE_SIZE * 2, 10, 10,
|
0, SOURCE_SIZE * 2, 10, 10,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888,
|
COGL_PIXEL_FORMAT_RGBA_8888,
|
||||||
p);
|
p);
|
||||||
@ -230,7 +230,7 @@ validate_result (TestState *state)
|
|||||||
g_free (texture_data);
|
g_free (texture_data);
|
||||||
|
|
||||||
/* Try reading back the texture data */
|
/* Try reading back the texture data */
|
||||||
sub_texture = cogl_sub_texture_new (ctx,
|
sub_texture = cogl_sub_texture_new (test_ctx,
|
||||||
COGL_TEXTURE (state->tex),
|
COGL_TEXTURE (state->tex),
|
||||||
SOURCE_SIZE / 4,
|
SOURCE_SIZE / 4,
|
||||||
SOURCE_SIZE / 4,
|
SOURCE_SIZE / 4,
|
||||||
@ -261,7 +261,7 @@ validate_result (TestState *state)
|
|||||||
/* Create a 256x256 test texture */
|
/* Create a 256x256 test texture */
|
||||||
test_tex = create_test_texture (state);
|
test_tex = create_test_texture (state);
|
||||||
/* Create a sub texture the views the center half of the texture */
|
/* Create a sub texture the views the center half of the texture */
|
||||||
sub_texture = cogl_sub_texture_new (ctx,
|
sub_texture = cogl_sub_texture_new (test_ctx,
|
||||||
COGL_TEXTURE (test_tex),
|
COGL_TEXTURE (test_tex),
|
||||||
64, 64, 128, 128);
|
64, 64, 128, 128);
|
||||||
/* Update the center half of the sub texture */
|
/* Update the center half of the sub texture */
|
||||||
@ -309,10 +309,10 @@ test_sub_texture (void)
|
|||||||
|
|
||||||
state.tex = create_source (&state);
|
state.tex = create_source (&state);
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0,
|
0, 0,
|
||||||
cogl_framebuffer_get_width (fb),
|
cogl_framebuffer_get_width (test_fb),
|
||||||
cogl_framebuffer_get_height (fb),
|
cogl_framebuffer_get_height (test_fb),
|
||||||
-1,
|
-1,
|
||||||
100);
|
100);
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ create_texture_3d (CoglContext *context)
|
|||||||
static void
|
static void
|
||||||
draw_frame (TestState *state)
|
draw_frame (TestState *state)
|
||||||
{
|
{
|
||||||
CoglTexture *tex = COGL_TEXTURE (create_texture_3d (ctx));
|
CoglTexture *tex = COGL_TEXTURE (create_texture_3d (test_ctx));
|
||||||
CoglPipeline *pipeline = cogl_pipeline_new (ctx);
|
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
|
||||||
typedef struct { float x, y, s, t, r; } Vert;
|
typedef struct { float x, y, s, t, r; } Vert;
|
||||||
CoglPrimitive *primitive;
|
CoglPrimitive *primitive;
|
||||||
CoglAttributeBuffer *attribute_buffer;
|
CoglAttributeBuffer *attribute_buffer;
|
||||||
@ -91,7 +91,7 @@ draw_frame (TestState *state)
|
|||||||
/* Render the texture repeated horizontally twice using a regular
|
/* Render the texture repeated horizontally twice using a regular
|
||||||
cogl rectangle. This should end up with the r texture coordinates
|
cogl rectangle. This should end up with the r texture coordinates
|
||||||
as zero */
|
as zero */
|
||||||
cogl_framebuffer_draw_textured_rectangle (fb, pipeline,
|
cogl_framebuffer_draw_textured_rectangle (test_fb, pipeline,
|
||||||
0.0f, 0.0f, TEX_WIDTH * 2, TEX_HEIGHT,
|
0.0f, 0.0f, TEX_WIDTH * 2, TEX_HEIGHT,
|
||||||
0.0f, 0.0f, 2.0f, 1.0f);
|
0.0f, 0.0f, 2.0f, 1.0f);
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ draw_frame (TestState *state)
|
|||||||
v++;
|
v++;
|
||||||
}
|
}
|
||||||
|
|
||||||
attribute_buffer = cogl_attribute_buffer_new (ctx,
|
attribute_buffer = cogl_attribute_buffer_new (test_ctx,
|
||||||
4 * TEX_DEPTH * sizeof (Vert),
|
4 * TEX_DEPTH * sizeof (Vert),
|
||||||
verts);
|
verts);
|
||||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||||
@ -152,11 +152,11 @@ draw_frame (TestState *state)
|
|||||||
2 /* n_attributes */);
|
2 /* n_attributes */);
|
||||||
|
|
||||||
cogl_primitive_set_indices (primitive,
|
cogl_primitive_set_indices (primitive,
|
||||||
cogl_get_rectangle_indices (ctx,
|
cogl_get_rectangle_indices (test_ctx,
|
||||||
TEX_DEPTH),
|
TEX_DEPTH),
|
||||||
6 * TEX_DEPTH);
|
6 * TEX_DEPTH);
|
||||||
|
|
||||||
cogl_framebuffer_draw_primitive (fb, pipeline, primitive);
|
cogl_framebuffer_draw_primitive (test_fb, pipeline, primitive);
|
||||||
|
|
||||||
g_free (verts);
|
g_free (verts);
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ validate_block (int block_x, int block_y, int z)
|
|||||||
|
|
||||||
for (y = 0; y < TEX_HEIGHT; y++)
|
for (y = 0; y < TEX_HEIGHT; y++)
|
||||||
for (x = 0; x < TEX_WIDTH; x++)
|
for (x = 0; x < TEX_WIDTH; x++)
|
||||||
test_utils_check_pixel_rgb (fb,
|
test_utils_check_pixel_rgb (test_fb,
|
||||||
block_x * TEX_WIDTH + x,
|
block_x * TEX_WIDTH + x,
|
||||||
block_y * TEX_HEIGHT + y,
|
block_y * TEX_HEIGHT + y,
|
||||||
255 - x * 8,
|
255 - x * 8,
|
||||||
@ -201,20 +201,20 @@ test_multi_texture (TestState *state)
|
|||||||
CoglTexture2D *tex_2d;
|
CoglTexture2D *tex_2d;
|
||||||
uint8_t tex_data[4];
|
uint8_t tex_data[4];
|
||||||
|
|
||||||
cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
|
cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
|
||||||
|
|
||||||
/* Tests a pipeline that is using multi-texturing to combine a 3D
|
/* Tests a pipeline that is using multi-texturing to combine a 3D
|
||||||
texture with a 2D texture. The texture from another layer is
|
texture with a 2D texture. The texture from another layer is
|
||||||
sampled with TEXTURE_? just to pick up a specific bug that was
|
sampled with TEXTURE_? just to pick up a specific bug that was
|
||||||
happening with the ARBfp fragend */
|
happening with the ARBfp fragend */
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
tex_data[0] = 0xff;
|
tex_data[0] = 0xff;
|
||||||
tex_data[1] = 0x00;
|
tex_data[1] = 0x00;
|
||||||
tex_data[2] = 0x00;
|
tex_data[2] = 0x00;
|
||||||
tex_data[3] = 0xff;
|
tex_data[3] = 0xff;
|
||||||
tex_2d = cogl_texture_2d_new_from_data (ctx,
|
tex_2d = cogl_texture_2d_new_from_data (test_ctx,
|
||||||
1, 1, /* width/height */
|
1, 1, /* width/height */
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
@ -227,7 +227,7 @@ test_multi_texture (TestState *state)
|
|||||||
tex_data[1] = 0xff;
|
tex_data[1] = 0xff;
|
||||||
tex_data[2] = 0x00;
|
tex_data[2] = 0x00;
|
||||||
tex_data[3] = 0xff;
|
tex_data[3] = 0xff;
|
||||||
tex_3d = cogl_texture_3d_new_from_data (ctx,
|
tex_3d = cogl_texture_3d_new_from_data (test_ctx,
|
||||||
1, 1, 1, /* width/height/depth */
|
1, 1, 1, /* width/height/depth */
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
@ -244,9 +244,9 @@ test_multi_texture (TestState *state)
|
|||||||
"RGBA = ADD(TEXTURE_0, TEXTURE_1)",
|
"RGBA = ADD(TEXTURE_0, TEXTURE_1)",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
cogl_framebuffer_draw_rectangle (fb, pipeline, 0, 0, 10, 10);
|
cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10);
|
||||||
|
|
||||||
test_utils_check_pixel (fb, 5, 5, 0xffff00ff);
|
test_utils_check_pixel (test_fb, 5, 5, 0xffff00ff);
|
||||||
|
|
||||||
cogl_object_unref (tex_2d);
|
cogl_object_unref (tex_2d);
|
||||||
cogl_object_unref (tex_3d);
|
cogl_object_unref (tex_3d);
|
||||||
@ -258,14 +258,14 @@ test_texture_3d (void)
|
|||||||
{
|
{
|
||||||
/* Check whether GL supports the rectangle extension. If not we'll
|
/* Check whether GL supports the rectangle extension. If not we'll
|
||||||
just assume the test passes */
|
just assume the test passes */
|
||||||
if (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D))
|
if (cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_3D))
|
||||||
{
|
{
|
||||||
TestState state;
|
TestState state;
|
||||||
|
|
||||||
state.fb_width = cogl_framebuffer_get_width (fb);
|
state.fb_width = cogl_framebuffer_get_width (test_fb);
|
||||||
state.fb_height = cogl_framebuffer_get_height (fb);
|
state.fb_height = cogl_framebuffer_get_height (test_fb);
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0, /* x_1, y_1 */
|
0, 0, /* x_1, y_1 */
|
||||||
state.fb_width, /* x_2 */
|
state.fb_width, /* x_2 */
|
||||||
state.fb_height /* y_2 */,
|
state.fb_height /* y_2 */,
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
static CoglBool cogl_test_is_verbose;
|
static CoglBool cogl_test_is_verbose;
|
||||||
|
|
||||||
CoglContext *ctx;
|
CoglContext *test_ctx;
|
||||||
CoglFramebuffer *fb;
|
CoglFramebuffer *test_fb;
|
||||||
|
|
||||||
void
|
void
|
||||||
test_utils_init (TestFlags flags)
|
test_utils_init (TestFlags flags)
|
||||||
@ -45,11 +45,11 @@ test_utils_init (TestFlags flags)
|
|||||||
|
|
||||||
g_setenv ("COGL_X11_SYNC", "1", 0);
|
g_setenv ("COGL_X11_SYNC", "1", 0);
|
||||||
|
|
||||||
ctx = cogl_context_new (NULL, &error);
|
test_ctx = cogl_context_new (NULL, &error);
|
||||||
if (!ctx)
|
if (!test_ctx)
|
||||||
g_critical ("Failed to create a CoglContext: %s", error->message);
|
g_critical ("Failed to create a CoglContext: %s", error->message);
|
||||||
|
|
||||||
display = cogl_context_get_display (ctx);
|
display = cogl_context_get_display (test_ctx);
|
||||||
renderer = cogl_display_get_renderer (display);
|
renderer = cogl_display_get_renderer (display);
|
||||||
|
|
||||||
if (flags & TEST_REQUIREMENT_GL &&
|
if (flags & TEST_REQUIREMENT_GL &&
|
||||||
@ -60,31 +60,31 @@ test_utils_init (TestFlags flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & TEST_REQUIREMENT_NPOT &&
|
if (flags & TEST_REQUIREMENT_NPOT &&
|
||||||
!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT))
|
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT))
|
||||||
{
|
{
|
||||||
missing_requirement = TRUE;
|
missing_requirement = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & TEST_REQUIREMENT_TEXTURE_3D &&
|
if (flags & TEST_REQUIREMENT_TEXTURE_3D &&
|
||||||
!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D))
|
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_3D))
|
||||||
{
|
{
|
||||||
missing_requirement = TRUE;
|
missing_requirement = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & TEST_REQUIREMENT_POINT_SPRITE &&
|
if (flags & TEST_REQUIREMENT_POINT_SPRITE &&
|
||||||
!cogl_has_feature (ctx, COGL_FEATURE_ID_POINT_SPRITE))
|
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_POINT_SPRITE))
|
||||||
{
|
{
|
||||||
missing_requirement = TRUE;
|
missing_requirement = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & TEST_REQUIREMENT_GLES2_CONTEXT &&
|
if (flags & TEST_REQUIREMENT_GLES2_CONTEXT &&
|
||||||
!cogl_has_feature (ctx, COGL_FEATURE_ID_GLES2_CONTEXT))
|
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_GLES2_CONTEXT))
|
||||||
{
|
{
|
||||||
missing_requirement = TRUE;
|
missing_requirement = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & TEST_REQUIREMENT_MAP_WRITE &&
|
if (flags & TEST_REQUIREMENT_MAP_WRITE &&
|
||||||
!cogl_has_feature (ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE))
|
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE))
|
||||||
{
|
{
|
||||||
missing_requirement = TRUE;
|
missing_requirement = TRUE;
|
||||||
}
|
}
|
||||||
@ -96,13 +96,13 @@ test_utils_init (TestFlags flags)
|
|||||||
|
|
||||||
if (getenv ("COGL_TEST_ONSCREEN"))
|
if (getenv ("COGL_TEST_ONSCREEN"))
|
||||||
{
|
{
|
||||||
onscreen = cogl_onscreen_new (ctx, 640, 480);
|
onscreen = cogl_onscreen_new (test_ctx, 640, 480);
|
||||||
fb = COGL_FRAMEBUFFER (onscreen);
|
test_fb = COGL_FRAMEBUFFER (onscreen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CoglOffscreen *offscreen;
|
CoglOffscreen *offscreen;
|
||||||
CoglTexture2D *tex = cogl_texture_2d_new_with_size (ctx,
|
CoglTexture2D *tex = cogl_texture_2d_new_with_size (test_ctx,
|
||||||
FB_WIDTH, FB_HEIGHT,
|
FB_WIDTH, FB_HEIGHT,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
&error);
|
&error);
|
||||||
@ -110,16 +110,16 @@ test_utils_init (TestFlags flags)
|
|||||||
g_critical ("Failed to allocate texture: %s", error->message);
|
g_critical ("Failed to allocate texture: %s", error->message);
|
||||||
|
|
||||||
offscreen = cogl_offscreen_new_to_texture (COGL_TEXTURE (tex));
|
offscreen = cogl_offscreen_new_to_texture (COGL_TEXTURE (tex));
|
||||||
fb = COGL_FRAMEBUFFER (offscreen);
|
test_fb = COGL_FRAMEBUFFER (offscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cogl_framebuffer_allocate (fb, &error))
|
if (!cogl_framebuffer_allocate (test_fb, &error))
|
||||||
g_critical ("Failed to allocate framebuffer: %s", error->message);
|
g_critical ("Failed to allocate framebuffer: %s", error->message);
|
||||||
|
|
||||||
if (onscreen)
|
if (onscreen)
|
||||||
cogl_onscreen_show (onscreen);
|
cogl_onscreen_show (onscreen);
|
||||||
|
|
||||||
cogl_framebuffer_clear4f (fb,
|
cogl_framebuffer_clear4f (test_fb,
|
||||||
COGL_BUFFER_BIT_COLOR |
|
COGL_BUFFER_BIT_COLOR |
|
||||||
COGL_BUFFER_BIT_DEPTH |
|
COGL_BUFFER_BIT_DEPTH |
|
||||||
COGL_BUFFER_BIT_STENCIL,
|
COGL_BUFFER_BIT_STENCIL,
|
||||||
@ -132,11 +132,11 @@ test_utils_init (TestFlags flags)
|
|||||||
void
|
void
|
||||||
test_utils_fini (void)
|
test_utils_fini (void)
|
||||||
{
|
{
|
||||||
if (fb)
|
if (test_fb)
|
||||||
cogl_object_unref (fb);
|
cogl_object_unref (test_fb);
|
||||||
|
|
||||||
if (ctx)
|
if (test_ctx)
|
||||||
cogl_object_unref (ctx);
|
cogl_object_unref (test_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
@ -167,12 +167,12 @@ test_utils_compare_pixel (const uint8_t *screen_pixel, uint32_t expected_pixel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_utils_check_pixel (CoglFramebuffer *fb,
|
test_utils_check_pixel (CoglFramebuffer *test_fb,
|
||||||
int x, int y, uint32_t expected_pixel)
|
int x, int y, uint32_t expected_pixel)
|
||||||
{
|
{
|
||||||
uint8_t pixel[4];
|
uint8_t pixel[4];
|
||||||
|
|
||||||
cogl_framebuffer_read_pixels (fb,
|
cogl_framebuffer_read_pixels (test_fb,
|
||||||
x, y, 1, 1,
|
x, y, 1, 1,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
pixel);
|
pixel);
|
||||||
@ -181,14 +181,14 @@ test_utils_check_pixel (CoglFramebuffer *fb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_utils_check_pixel_rgb (CoglFramebuffer *fb,
|
test_utils_check_pixel_rgb (CoglFramebuffer *test_fb,
|
||||||
int x, int y, int r, int g, int b)
|
int x, int y, int r, int g, int b)
|
||||||
{
|
{
|
||||||
test_utils_check_pixel (fb, x, y, (r << 24) | (g << 16) | (b << 8));
|
test_utils_check_pixel (test_fb, x, y, (r << 24) | (g << 16) | (b << 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_utils_check_region (CoglFramebuffer *fb,
|
test_utils_check_region (CoglFramebuffer *test_fb,
|
||||||
int x, int y,
|
int x, int y,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
uint32_t expected_rgba)
|
uint32_t expected_rgba)
|
||||||
@ -196,7 +196,7 @@ test_utils_check_region (CoglFramebuffer *fb,
|
|||||||
uint8_t *pixels, *p;
|
uint8_t *pixels, *p;
|
||||||
|
|
||||||
pixels = p = g_malloc (width * height * 4);
|
pixels = p = g_malloc (width * height * 4);
|
||||||
cogl_framebuffer_read_pixels (fb,
|
cogl_framebuffer_read_pixels (test_fb,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
width,
|
width,
|
||||||
|
@ -20,8 +20,8 @@ typedef enum _TestFlags
|
|||||||
TEST_REQUIREMENT_MAP_WRITE = 1<<6
|
TEST_REQUIREMENT_MAP_WRITE = 1<<6
|
||||||
} TestFlags;
|
} TestFlags;
|
||||||
|
|
||||||
extern CoglContext *ctx;
|
extern CoglContext *test_ctx;
|
||||||
extern CoglFramebuffer *fb;
|
extern CoglFramebuffer *test_fb;
|
||||||
|
|
||||||
void
|
void
|
||||||
test_utils_init (TestFlags flags);
|
test_utils_init (TestFlags flags);
|
||||||
|
@ -45,7 +45,7 @@ create_pipeline (TestState *state,
|
|||||||
{
|
{
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, state->texture);
|
cogl_pipeline_set_layer_texture (pipeline, 0, state->texture);
|
||||||
cogl_pipeline_set_layer_filters (pipeline, 0,
|
cogl_pipeline_set_layer_filters (pipeline, 0,
|
||||||
COGL_PIPELINE_FILTER_NEAREST,
|
COGL_PIPELINE_FILTER_NEAREST,
|
||||||
@ -94,7 +94,7 @@ draw_tests (TestState *state)
|
|||||||
wrap_mode_t = wrap_modes[i + 1];
|
wrap_mode_t = wrap_modes[i + 1];
|
||||||
pipeline = create_pipeline (state, wrap_mode_s, wrap_mode_t);
|
pipeline = create_pipeline (state, wrap_mode_s, wrap_mode_t);
|
||||||
/* Render the pipeline at four times the size of the texture */
|
/* Render the pipeline at four times the size of the texture */
|
||||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
cogl_framebuffer_draw_textured_rectangle (test_fb,
|
||||||
pipeline,
|
pipeline,
|
||||||
i * TEX_SIZE,
|
i * TEX_SIZE,
|
||||||
0,
|
0,
|
||||||
@ -186,7 +186,7 @@ validate_set (TestState *state, int offset)
|
|||||||
wrap_mode_s = wrap_modes[i];
|
wrap_mode_s = wrap_modes[i];
|
||||||
wrap_mode_t = wrap_modes[i + 1];
|
wrap_mode_t = wrap_modes[i + 1];
|
||||||
|
|
||||||
cogl_framebuffer_read_pixels (fb, i * TEX_SIZE, offset * TEX_SIZE * 2,
|
cogl_framebuffer_read_pixels (test_fb, i * TEX_SIZE, offset * TEX_SIZE * 2,
|
||||||
TEX_SIZE * 2, TEX_SIZE * 2,
|
TEX_SIZE * 2, TEX_SIZE * 2,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888,
|
COGL_PIXEL_FORMAT_RGBA_8888,
|
||||||
data);
|
data);
|
||||||
@ -273,10 +273,10 @@ test_wrap_modes (void)
|
|||||||
{
|
{
|
||||||
TestState state;
|
TestState state;
|
||||||
|
|
||||||
state.width = cogl_framebuffer_get_width (fb);
|
state.width = cogl_framebuffer_get_width (test_fb);
|
||||||
state.height = cogl_framebuffer_get_height (fb);
|
state.height = cogl_framebuffer_get_height (test_fb);
|
||||||
|
|
||||||
cogl_framebuffer_orthographic (fb,
|
cogl_framebuffer_orthographic (test_fb,
|
||||||
0, 0,
|
0, 0,
|
||||||
state.width,
|
state.width,
|
||||||
state.height,
|
state.height,
|
||||||
@ -285,7 +285,7 @@ test_wrap_modes (void)
|
|||||||
|
|
||||||
/* XXX: we have to push/pop a framebuffer since this test currently
|
/* XXX: we have to push/pop a framebuffer since this test currently
|
||||||
* uses the legacy cogl_vertex_buffer_draw() api. */
|
* uses the legacy cogl_vertex_buffer_draw() api. */
|
||||||
cogl_push_framebuffer (fb);
|
cogl_push_framebuffer (test_fb);
|
||||||
paint (&state);
|
paint (&state);
|
||||||
cogl_pop_framebuffer ();
|
cogl_pop_framebuffer ();
|
||||||
|
|
||||||
|
@ -141,43 +141,43 @@ test_write_int (CoglContext *context,
|
|||||||
void
|
void
|
||||||
test_write_texture_formats (void)
|
test_write_texture_formats (void)
|
||||||
{
|
{
|
||||||
test_write_byte (ctx, COGL_PIXEL_FORMAT_A_8, 0x34, 0x00000034);
|
test_write_byte (test_ctx, COGL_PIXEL_FORMAT_A_8, 0x34, 0x00000034);
|
||||||
#if 0
|
#if 0
|
||||||
/* I'm not sure what's the right value to put here because Nvidia
|
/* I'm not sure what's the right value to put here because Nvidia
|
||||||
and Mesa seem to behave differently so one of them must be
|
and Mesa seem to behave differently so one of them must be
|
||||||
wrong. */
|
wrong. */
|
||||||
test_write_byte (ctx, COGL_PIXEL_FORMAT_G_8, 0x34, 0x340000ff);
|
test_write_byte (test_ctx, COGL_PIXEL_FORMAT_G_8, 0x34, 0x340000ff);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
test_write_short (ctx, COGL_PIXEL_FORMAT_RGB_565, 0x0843, 0x080819ff);
|
test_write_short (test_ctx, COGL_PIXEL_FORMAT_RGB_565, 0x0843, 0x080819ff);
|
||||||
test_write_short (ctx, COGL_PIXEL_FORMAT_RGBA_4444_PRE, 0x1234, 0x11223344);
|
test_write_short (test_ctx, COGL_PIXEL_FORMAT_RGBA_4444_PRE, 0x1234, 0x11223344);
|
||||||
test_write_short (ctx, COGL_PIXEL_FORMAT_RGBA_5551_PRE, 0x0887, 0x081019ff);
|
test_write_short (test_ctx, COGL_PIXEL_FORMAT_RGBA_5551_PRE, 0x0887, 0x081019ff);
|
||||||
|
|
||||||
test_write_bytes (ctx, COGL_PIXEL_FORMAT_RGB_888, 0x123456ff, 0x123456ff);
|
test_write_bytes (test_ctx, COGL_PIXEL_FORMAT_RGB_888, 0x123456ff, 0x123456ff);
|
||||||
test_write_bytes (ctx, COGL_PIXEL_FORMAT_BGR_888, 0x563412ff, 0x123456ff);
|
test_write_bytes (test_ctx, COGL_PIXEL_FORMAT_BGR_888, 0x563412ff, 0x123456ff);
|
||||||
|
|
||||||
test_write_bytes (ctx, COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
test_write_bytes (test_ctx, COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||||
0x12345678, 0x12345678);
|
0x12345678, 0x12345678);
|
||||||
test_write_bytes (ctx, COGL_PIXEL_FORMAT_BGRA_8888_PRE,
|
test_write_bytes (test_ctx, COGL_PIXEL_FORMAT_BGRA_8888_PRE,
|
||||||
0x56341278, 0x12345678);
|
0x56341278, 0x12345678);
|
||||||
test_write_bytes (ctx, COGL_PIXEL_FORMAT_ARGB_8888_PRE,
|
test_write_bytes (test_ctx, COGL_PIXEL_FORMAT_ARGB_8888_PRE,
|
||||||
0x78123456, 0x12345678);
|
0x78123456, 0x12345678);
|
||||||
test_write_bytes (ctx, COGL_PIXEL_FORMAT_ABGR_8888_PRE,
|
test_write_bytes (test_ctx, COGL_PIXEL_FORMAT_ABGR_8888_PRE,
|
||||||
0x78563412, 0x12345678);
|
0x78563412, 0x12345678);
|
||||||
|
|
||||||
test_write_int (ctx, COGL_PIXEL_FORMAT_RGBA_1010102_PRE,
|
test_write_int (test_ctx, COGL_PIXEL_FORMAT_RGBA_1010102_PRE,
|
||||||
0x123456ff,
|
0x123456ff,
|
||||||
10, 0x12, 10, 0x34, 10, 0x56, 2, 0xff,
|
10, 0x12, 10, 0x34, 10, 0x56, 2, 0xff,
|
||||||
-1);
|
-1);
|
||||||
test_write_int (ctx, COGL_PIXEL_FORMAT_BGRA_1010102_PRE,
|
test_write_int (test_ctx, COGL_PIXEL_FORMAT_BGRA_1010102_PRE,
|
||||||
0x123456ff,
|
0x123456ff,
|
||||||
10, 0x56, 10, 0x34, 10, 0x12, 2, 0xff,
|
10, 0x56, 10, 0x34, 10, 0x12, 2, 0xff,
|
||||||
-1);
|
-1);
|
||||||
test_write_int (ctx, COGL_PIXEL_FORMAT_ARGB_2101010_PRE,
|
test_write_int (test_ctx, COGL_PIXEL_FORMAT_ARGB_2101010_PRE,
|
||||||
0x123456ff,
|
0x123456ff,
|
||||||
2, 0xff, 10, 0x12, 10, 0x34, 10, 0x56,
|
2, 0xff, 10, 0x12, 10, 0x34, 10, 0x56,
|
||||||
-1);
|
-1);
|
||||||
test_write_int (ctx, COGL_PIXEL_FORMAT_ABGR_2101010_PRE,
|
test_write_int (test_ctx, COGL_PIXEL_FORMAT_ABGR_2101010_PRE,
|
||||||
0x123456ff,
|
0x123456ff,
|
||||||
2, 0xff, 10, 0x56, 10, 0x34, 10, 0x12,
|
2, 0xff, 10, 0x56, 10, 0x34, 10, 0x12,
|
||||||
-1);
|
-1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user