mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
tests: don't delay/skip frames due to glReadPixel concerns
This greatly speeds up running all the conformance tests by no longer delaying many of the tests for a number of dummy frames to be painted. We used to skip frames because we thought there was a problem with the driver's glReadPixels implementation. Although we have seen driver issues at times the real reason the delay was needed was because resizing the stage usually happens asynchronously (because a non synchronous X request is used by clutter_stage_set_size()). We now force all X requests to be synchronized for the conformance tests so this is no longer a problem and we can avoid these hacks.
This commit is contained in:
parent
f47152c557
commit
4ca1e491da
@ -24,7 +24,6 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
|
||||
|
||||
typedef struct _TestState
|
||||
{
|
||||
guint frame;
|
||||
ClutterGeometry stage_geom;
|
||||
} TestState;
|
||||
|
||||
@ -127,12 +126,6 @@ test_blend (TestState *state,
|
||||
y_off = y * QUAD_WIDTH + (QUAD_WIDTH / 2);
|
||||
x_off = x * QUAD_WIDTH + (QUAD_WIDTH / 2);
|
||||
|
||||
/* XXX:
|
||||
* We haven't always had good luck with GL drivers implementing glReadPixels
|
||||
* reliably and skipping the first two frames improves our chances... */
|
||||
if (state->frame <= 2)
|
||||
return;
|
||||
|
||||
cogl_read_pixels (x_off, y_off, 1, 1,
|
||||
COGL_READ_PIXELS_COLOR_BUFFER,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||
@ -257,12 +250,6 @@ test_tex_combine (TestState *state,
|
||||
y_off = y * QUAD_WIDTH + (QUAD_WIDTH / 2);
|
||||
x_off = x * QUAD_WIDTH + (QUAD_WIDTH / 2);
|
||||
|
||||
/* XXX:
|
||||
* We haven't always had good luck with GL drivers implementing glReadPixels
|
||||
* reliably and skipping the first two frames improves our chances... */
|
||||
if (state->frame <= 2)
|
||||
return;
|
||||
|
||||
cogl_read_pixels (x_off, y_off, 1, 1,
|
||||
COGL_READ_PIXELS_COLOR_BUFFER,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||
@ -287,8 +274,6 @@ test_tex_combine (TestState *state,
|
||||
static void
|
||||
on_paint (ClutterActor *actor, TestState *state)
|
||||
{
|
||||
int frame_num;
|
||||
|
||||
test_blend (state, 0, 0, /* position */
|
||||
0xff0000ff, /* src */
|
||||
0xffffffff, /* dst */
|
||||
@ -401,19 +386,8 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
"A = REPLACE (PREVIOUS)",
|
||||
0x2a2a2abb); /* expected */
|
||||
|
||||
/* XXX: Experiments have shown that for some buggy drivers, when using
|
||||
* glReadPixels there is some kind of race, so we delay our test for a
|
||||
* few frames and a few seconds:
|
||||
*/
|
||||
frame_num = state->frame++;
|
||||
if (frame_num < 2)
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
|
||||
/* Comment this out if you want visual feedback for what this test paints */
|
||||
#if 1
|
||||
if (frame_num == 3)
|
||||
clutter_main_quit ();
|
||||
#endif
|
||||
clutter_main_quit ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -433,8 +407,6 @@ test_cogl_blend_strings (TestConformSimpleFixture *fixture,
|
||||
ClutterActor *group;
|
||||
guint idle_source;
|
||||
|
||||
state.frame = 0;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
@ -443,9 +415,9 @@ test_cogl_blend_strings (TestConformSimpleFixture *fixture,
|
||||
group = clutter_group_new ();
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
||||
|
||||
/* We force continuous redrawing of the stage, since we need to skip
|
||||
* the first few frames, and we wont be doing anything else that
|
||||
* will trigger redrawing. */
|
||||
/* We force continuous redrawing incase someone comments out the
|
||||
* clutter_main_quit and wants visual feedback for the test since we
|
||||
* wont be doing anything else that will trigger redrawing. */
|
||||
idle_source = g_idle_add (queue_redraw, stage);
|
||||
|
||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
||||
|
@ -26,7 +26,6 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
|
||||
|
||||
typedef struct _TestState
|
||||
{
|
||||
guint frame;
|
||||
ClutterGeometry stage_geom;
|
||||
} TestState;
|
||||
|
||||
@ -136,12 +135,6 @@ test_depth (TestState *state,
|
||||
y_off = y * QUAD_WIDTH + (QUAD_WIDTH / 2);
|
||||
x_off = x * QUAD_WIDTH + (QUAD_WIDTH / 2);
|
||||
|
||||
/* XXX:
|
||||
* We haven't always had good luck with GL drivers implementing glReadPixels
|
||||
* reliably and skipping the first two frames improves our chances... */
|
||||
if (state->frame <= 2)
|
||||
return;
|
||||
|
||||
cogl_read_pixels (x_off, y_off, 1, 1,
|
||||
COGL_READ_PIXELS_COLOR_BUFFER,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||
@ -153,7 +146,6 @@ test_depth (TestState *state,
|
||||
static void
|
||||
on_paint (ClutterActor *actor, TestState *state)
|
||||
{
|
||||
int frame_num;
|
||||
CoglMatrix projection_save;
|
||||
CoglMatrix identity;
|
||||
|
||||
@ -294,18 +286,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
cogl_pop_matrix ();
|
||||
cogl_set_projection_matrix (&projection_save);
|
||||
|
||||
/* XXX: Experiments have shown that for some buggy drivers, when using
|
||||
* glReadPixels there is some kind of race, so we delay our test for a
|
||||
* few frames and a few seconds: */
|
||||
frame_num = state->frame++;
|
||||
if (frame_num < 2)
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
|
||||
/* Comment this out if you want visual feedback for what this test paints */
|
||||
#if 1
|
||||
if (frame_num == 3)
|
||||
clutter_main_quit ();
|
||||
#endif
|
||||
clutter_main_quit ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -325,8 +306,6 @@ test_cogl_depth_test (TestConformSimpleFixture *fixture,
|
||||
ClutterActor *group;
|
||||
guint idle_source;
|
||||
|
||||
state.frame = 0;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
@ -335,9 +314,9 @@ test_cogl_depth_test (TestConformSimpleFixture *fixture,
|
||||
group = clutter_group_new ();
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
||||
|
||||
/* We force continuous redrawing of the stage, since we need to skip
|
||||
* the first few frames, and we wont be doing anything else that
|
||||
* will trigger redrawing. */
|
||||
/* We force continuous redrawing incase someone comments out the
|
||||
* clutter_main_quit and wants visual feedback for the test since we
|
||||
* wont be doing anything else that will trigger redrawing. */
|
||||
idle_source = g_idle_add (queue_redraw, stage);
|
||||
|
||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
||||
|
@ -20,11 +20,8 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
|
||||
#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8);
|
||||
#define MASK_ALPHA(COLOR) (COLOR & 0xff);
|
||||
|
||||
#define SKIP_FRAMES 2
|
||||
|
||||
typedef struct _TestState
|
||||
{
|
||||
guint frame;
|
||||
ClutterGeometry stage_geom;
|
||||
} TestState;
|
||||
|
||||
@ -46,12 +43,6 @@ check_pixel (TestState *state, int x, int y, guint32 color)
|
||||
y_off = y * QUAD_WIDTH + (QUAD_WIDTH / 2);
|
||||
x_off = x * QUAD_WIDTH + (QUAD_WIDTH / 2);
|
||||
|
||||
/* XXX:
|
||||
* We haven't always had good luck with GL drivers implementing glReadPixels
|
||||
* reliably and skipping the first two frames improves our chances... */
|
||||
if (state->frame <= SKIP_FRAMES)
|
||||
return;
|
||||
|
||||
cogl_read_pixels (x_off, y_off, 1, 1,
|
||||
COGL_READ_PIXELS_COLOR_BUFFER,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||
@ -226,8 +217,6 @@ test_invalid_texture_layers_with_constant_colors (TestState *state,
|
||||
static void
|
||||
on_paint (ClutterActor *actor, TestState *state)
|
||||
{
|
||||
int frame_num;
|
||||
|
||||
test_invalid_texture_layers (state,
|
||||
0, 0 /* position */
|
||||
);
|
||||
@ -238,18 +227,9 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
2, 0 /* position */
|
||||
);
|
||||
|
||||
/* XXX: Experiments have shown that for some buggy drivers, when using
|
||||
* glReadPixels there is some kind of race, so we delay our test for a
|
||||
* few frames and a few seconds:
|
||||
*/
|
||||
frame_num = state->frame++;
|
||||
if (frame_num < SKIP_FRAMES)
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
|
||||
/* Comment this out if you want visual feedback for what this test paints */
|
||||
#if 1
|
||||
if (frame_num > SKIP_FRAMES)
|
||||
clutter_main_quit ();
|
||||
clutter_main_quit ();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -270,8 +250,6 @@ test_cogl_materials (TestConformSimpleFixture *fixture,
|
||||
ClutterActor *group;
|
||||
guint idle_source;
|
||||
|
||||
state.frame = 0;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
|
@ -15,7 +15,7 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
|
||||
|
||||
typedef struct _TestState
|
||||
{
|
||||
guint frame;
|
||||
guint padding;
|
||||
} TestState;
|
||||
|
||||
static void
|
||||
@ -111,15 +111,6 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
0.5, 0.5, 1, 1 /* tex1 */
|
||||
};
|
||||
|
||||
/* XXX:
|
||||
* We haven't always had good luck with GL drivers implementing glReadPixels
|
||||
* reliably and skipping the first two frames improves our chances... */
|
||||
if (state->frame++ <= 2)
|
||||
{
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
return;
|
||||
}
|
||||
|
||||
tex0 = make_texture (0x00);
|
||||
tex1 = make_texture (0x11);
|
||||
|
||||
@ -191,8 +182,6 @@ test_cogl_multitexture (TestConformSimpleFixture *fixture,
|
||||
ClutterActor *group;
|
||||
guint idle_source;
|
||||
|
||||
state.frame = 0;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
@ -200,9 +189,9 @@ test_cogl_multitexture (TestConformSimpleFixture *fixture,
|
||||
group = clutter_group_new ();
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
||||
|
||||
/* We force continuous redrawing of the stage, since we need to skip
|
||||
* the first few frames, and we wont be doing anything else that
|
||||
* will trigger redrawing. */
|
||||
/* We force continuous redrawing incase someone comments out the
|
||||
* clutter_main_quit and wants visual feedback for the test since we
|
||||
* wont be doing anything else that will trigger redrawing. */
|
||||
idle_source = g_idle_add (queue_redraw, stage);
|
||||
|
||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
||||
|
@ -95,17 +95,12 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
cogl_set_source_texture (state->texture);
|
||||
cogl_rectangle (0, 0, TEXTURE_RENDER_SIZE, TEXTURE_RENDER_SIZE);
|
||||
|
||||
/* XXX: Experiments have shown that for some buggy drivers, when using
|
||||
* glReadPixels there is some kind of race, so we delay our test for a
|
||||
* few frames and a few seconds:
|
||||
*/
|
||||
/* Need to increment frame first because clutter_stage_read_pixels
|
||||
fires a redraw */
|
||||
/* XXX: validate_result calls clutter_stage_read_pixels which will result in
|
||||
* another paint run so to avoid infinite recursion we only aim to validate
|
||||
* the first frame. */
|
||||
frame_num = state->frame++;
|
||||
if (frame_num == 2)
|
||||
if (frame_num == 1)
|
||||
validate_result (state);
|
||||
else if (frame_num < 2)
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -247,17 +247,12 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
|
||||
draw_frame (state);
|
||||
|
||||
/* XXX: Experiments have shown that for some buggy drivers, when using
|
||||
* glReadPixels there is some kind of race, so we delay our test for a
|
||||
* few frames and a few seconds:
|
||||
*/
|
||||
/* Need to increment frame first because clutter_stage_read_pixels
|
||||
fires a redraw */
|
||||
/* XXX: validate_result calls clutter_stage_read_pixels which will result in
|
||||
* another paint run so to avoid infinite recursion we only aim to validate
|
||||
* the first frame. */
|
||||
frame_num = state->frame++;
|
||||
if (frame_num == 2)
|
||||
if (frame_num == 1)
|
||||
validate_result (state);
|
||||
else if (frame_num < 2)
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -19,11 +19,8 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
|
||||
#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8);
|
||||
#define MASK_ALPHA(COLOR) (COLOR & 0xff);
|
||||
|
||||
#define SKIP_FRAMES 2
|
||||
|
||||
typedef struct _TestState
|
||||
{
|
||||
guint frame;
|
||||
ClutterGeometry stage_geom;
|
||||
CoglHandle passthrough_material;
|
||||
} TestState;
|
||||
@ -118,12 +115,6 @@ check_texture (TestState *state,
|
||||
y_off = y * QUAD_WIDTH + (QUAD_WIDTH / 2);
|
||||
x_off = x * QUAD_WIDTH + (QUAD_WIDTH / 2);
|
||||
|
||||
/* XXX:
|
||||
* We haven't always had good luck with GL drivers implementing glReadPixels
|
||||
* reliably and skipping the first two frames improves our chances... */
|
||||
if (state->frame <= SKIP_FRAMES)
|
||||
return;
|
||||
|
||||
cogl_read_pixels (x_off, y_off, 1, 1,
|
||||
COGL_READ_PIXELS_COLOR_BUFFER,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||
@ -141,13 +132,12 @@ check_texture (TestState *state,
|
||||
static void
|
||||
on_paint (ClutterActor *actor, TestState *state)
|
||||
{
|
||||
int frame_num;
|
||||
CoglHandle tex;
|
||||
guchar *tex_data;
|
||||
|
||||
/* If the user explicitly specifies an unmultiplied internal format then
|
||||
* Cogl shouldn't automatically premultiply the given texture data... */
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("make_texture (0xff00ff80, "
|
||||
"src = RGBA_8888, internal = RGBA_8888)\n");
|
||||
tex = make_texture (0xff00ff80,
|
||||
@ -160,7 +150,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
/* If the user explicitly requests a premultiplied internal format and
|
||||
* gives unmultiplied src data then Cogl should always premultiply that
|
||||
* for us */
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("make_texture (0xff00ff80, "
|
||||
"src = RGBA_8888, internal = RGBA_8888_PRE)\n");
|
||||
tex = make_texture (0xff00ff80,
|
||||
@ -174,7 +164,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
* by default Cogl should premultiply the given texture data...
|
||||
* (In the future there will be additional Cogl API to control this
|
||||
* behaviour) */
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("make_texture (0xff00ff80, "
|
||||
"src = RGBA_8888, internal = ANY)\n");
|
||||
tex = make_texture (0xff00ff80,
|
||||
@ -187,7 +177,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
/* If the user requests a premultiplied internal texture format and supplies
|
||||
* premultiplied source data, Cogl should never modify that source data...
|
||||
*/
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("make_texture (0x80008080, "
|
||||
"src = RGBA_8888_PRE, "
|
||||
"internal = RGBA_8888_PRE)\n");
|
||||
@ -201,7 +191,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
/* If the user requests an unmultiplied internal texture format, but
|
||||
* supplies premultiplied source data, then Cogl should always
|
||||
* un-premultiply the source data... */
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("make_texture (0x80008080, "
|
||||
"src = RGBA_8888_PRE, internal = RGBA_8888)\n");
|
||||
tex = make_texture (0x80008080,
|
||||
@ -215,7 +205,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
* source data then by default Cogl shouldn't modify the source data...
|
||||
* (In the future there will be additional Cogl API to control this
|
||||
* behaviour) */
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("make_texture (0x80008080, "
|
||||
"src = RGBA_8888_PRE, internal = ANY)\n");
|
||||
tex = make_texture (0x80008080,
|
||||
@ -229,13 +219,13 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
* Test cogl_texture_set_region() ....
|
||||
*/
|
||||
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("make_texture (0xDEADBEEF, "
|
||||
"src = RGBA_8888, internal = RGBA_8888)\n");
|
||||
tex = make_texture (0xDEADBEEF,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
|
||||
COGL_PIXEL_FORMAT_RGBA_8888); /* internal format */
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("set_region (0xff00ff80, RGBA_8888)\n");
|
||||
tex_data = gen_tex_data (0xff00ff80);
|
||||
cogl_texture_set_region (tex,
|
||||
@ -253,13 +243,13 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
/* Updating a texture region for an unmultiplied texture using premultiplied
|
||||
* region data should result in Cogl unmultiplying the given region data...
|
||||
*/
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("make_texture (0xDEADBEEF, "
|
||||
"src = RGBA_8888, internal = RGBA_8888)\n");
|
||||
tex = make_texture (0xDEADBEEF,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
|
||||
COGL_PIXEL_FORMAT_RGBA_8888); /* internal format */
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
|
||||
tex_data = gen_tex_data (0x80008080);
|
||||
cogl_texture_set_region (tex,
|
||||
@ -275,14 +265,14 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
0xff00ff80); /* expected */
|
||||
|
||||
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("make_texture (0xDEADBEEF, "
|
||||
"src = RGBA_8888_PRE, "
|
||||
"internal = RGBA_8888_PRE)\n");
|
||||
tex = make_texture (0xDEADBEEF,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE); /* internal format */
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
|
||||
tex_data = gen_tex_data (0x80008080);
|
||||
cogl_texture_set_region (tex,
|
||||
@ -301,14 +291,14 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
/* Updating a texture region for a premultiplied texture using unmultiplied
|
||||
* region data should result in Cogl premultiplying the given region data...
|
||||
*/
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("make_texture (0xDEADBEEF, "
|
||||
"src = RGBA_8888_PRE, "
|
||||
"internal = RGBA_8888_PRE)\n");
|
||||
tex = make_texture (0xDEADBEEF,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE); /* internal format */
|
||||
if (state->frame > SKIP_FRAMES && g_test_verbose ())
|
||||
if (g_test_verbose ())
|
||||
g_print ("set_region (0xff00ff80, RGBA_8888)\n");
|
||||
tex_data = gen_tex_data (0xff00ff80);
|
||||
cogl_texture_set_region (tex,
|
||||
@ -323,20 +313,8 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
tex,
|
||||
0x80008080); /* expected */
|
||||
|
||||
|
||||
/* XXX: Experiments have shown that for some buggy drivers, when using
|
||||
* glReadPixels there is some kind of race, so we delay our test for a
|
||||
* few frames and a few seconds:
|
||||
*/
|
||||
frame_num = state->frame++;
|
||||
if (frame_num < SKIP_FRAMES)
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
|
||||
/* Comment this out if you want visual feedback for what this test paints */
|
||||
#if 1
|
||||
if (frame_num > SKIP_FRAMES)
|
||||
clutter_main_quit ();
|
||||
#endif
|
||||
clutter_main_quit ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -356,7 +334,6 @@ test_cogl_premult (TestConformSimpleFixture *fixture,
|
||||
ClutterActor *group;
|
||||
guint idle_source;
|
||||
|
||||
state.frame = 0;
|
||||
state.passthrough_material = cogl_material_new ();
|
||||
cogl_material_set_blend (state.passthrough_material,
|
||||
"RGBA = ADD (SRC_COLOR, 0)", NULL);
|
||||
@ -371,9 +348,9 @@ test_cogl_premult (TestConformSimpleFixture *fixture,
|
||||
group = clutter_group_new ();
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
||||
|
||||
/* We force continuous redrawing of the stage, since we need to skip
|
||||
* the first few frames, and we wont be doing anything else that
|
||||
* will trigger redrawing. */
|
||||
/* We force continuous redrawing incase someone comments out the
|
||||
* clutter_main_quit and wants visual feedback for the test since we
|
||||
* wont be doing anything else that will trigger redrawing. */
|
||||
idle_source = g_idle_add (queue_redraw, stage);
|
||||
|
||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
||||
|
@ -312,17 +312,12 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
|
||||
draw_frame (state);
|
||||
|
||||
/* XXX: Experiments have shown that for some buggy drivers, when using
|
||||
* glReadPixels there is some kind of race, so we delay our test for a
|
||||
* few frames and a few seconds:
|
||||
*/
|
||||
/* Need to increment frame first because clutter_stage_read_pixels
|
||||
fires a redraw */
|
||||
/* XXX: validate_result calls clutter_stage_read_pixels which will result in
|
||||
* another paint run so to avoid infinite recursion we only aim to validate
|
||||
* the first frame. */
|
||||
frame_num = state->frame++;
|
||||
if (frame_num == 2)
|
||||
if (frame_num == 1)
|
||||
validate_result (state);
|
||||
else if (frame_num < 2)
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -10,7 +10,7 @@ static const ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff };
|
||||
|
||||
typedef struct _TestState
|
||||
{
|
||||
guint frame;
|
||||
guint padding;
|
||||
} TestState;
|
||||
|
||||
/* Creates a texture where the pixels are evenly divided between
|
||||
@ -51,15 +51,6 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
CoglHandle material;
|
||||
guint8 pixels[8];
|
||||
|
||||
/* XXX:
|
||||
* We haven't always had good luck with GL drivers implementing glReadPixels
|
||||
* reliably and skipping the first two frames improves our chances... */
|
||||
if (state->frame++ <= 2)
|
||||
{
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
return;
|
||||
}
|
||||
|
||||
tex = make_texture ();
|
||||
material = cogl_material_new ();
|
||||
cogl_material_set_layer (material, 0, tex);
|
||||
@ -120,8 +111,6 @@ test_cogl_texture_mipmaps (TestConformSimpleFixture *fixture,
|
||||
ClutterActor *group;
|
||||
guint idle_source;
|
||||
|
||||
state.frame = 0;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
|
@ -8,7 +8,6 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
|
||||
typedef struct _TestState
|
||||
{
|
||||
ClutterActor *stage;
|
||||
guint frame;
|
||||
} TestState;
|
||||
|
||||
static CoglHandle
|
||||
@ -198,21 +197,9 @@ validate_result (TestState *state)
|
||||
static void
|
||||
on_paint (ClutterActor *actor, TestState *state)
|
||||
{
|
||||
int frame_num;
|
||||
|
||||
draw_frame (state);
|
||||
|
||||
/* XXX: Experiments have shown that for some buggy drivers, when using
|
||||
* glReadPixels there is some kind of race, so we delay our test for a
|
||||
* few frames and a few seconds:
|
||||
*/
|
||||
/* Need to increment frame first because clutter_stage_read_pixels
|
||||
fires a redraw */
|
||||
frame_num = state->frame++;
|
||||
if (frame_num == 2)
|
||||
validate_result (state);
|
||||
else if (frame_num < 2)
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
validate_result (state);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -257,8 +244,6 @@ test_cogl_texture_rectangle (TestConformSimpleFixture *fixture,
|
||||
guint idle_source;
|
||||
guint paint_handler;
|
||||
|
||||
state.frame = 0;
|
||||
|
||||
state.stage = clutter_stage_get_default ();
|
||||
|
||||
/* Check whether GL supports the rectangle extension. If not we'll
|
||||
|
@ -21,7 +21,6 @@ typedef struct _TestState
|
||||
CoglHandle texture;
|
||||
CoglHandle material;
|
||||
ClutterGeometry stage_geom;
|
||||
guint frame;
|
||||
} TestState;
|
||||
|
||||
static void
|
||||
@ -139,16 +138,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
0, /* first */
|
||||
3); /* count */
|
||||
|
||||
/* XXX: Experiments have shown that for some buggy drivers, when using
|
||||
* glReadPixels there is some kind of race, so we delay our test for a
|
||||
* few frames and a few seconds:
|
||||
*/
|
||||
if (state->frame >= 2)
|
||||
validate_result (state);
|
||||
else
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
|
||||
state->frame++;
|
||||
validate_result (state);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -177,8 +167,6 @@ test_cogl_vertex_buffer_contiguous (TestConformSimpleFixture *fixture,
|
||||
0x00, 0xff, 0x00, 0xff
|
||||
};
|
||||
|
||||
state.frame = 0;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
|
||||
@ -190,9 +178,9 @@ test_cogl_vertex_buffer_contiguous (TestConformSimpleFixture *fixture,
|
||||
state.stage_geom.height);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
||||
|
||||
/* We force continuous redrawing of the stage, since we need to skip
|
||||
* the first few frames, and we wont be doing anything else that
|
||||
* will trigger redrawing. */
|
||||
/* We force continuous redrawing incase someone comments out the
|
||||
* clutter_main_quit and wants visual feedback for the test since we
|
||||
* wont be doing anything else that will trigger redrawing. */
|
||||
idle_source = g_idle_add (queue_redraw, stage);
|
||||
|
||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
||||
|
@ -16,7 +16,6 @@ typedef struct _TestState
|
||||
{
|
||||
CoglHandle buffer;
|
||||
ClutterGeometry stage_geom;
|
||||
guint frame;
|
||||
} TestState;
|
||||
|
||||
typedef struct _InterlevedVertex
|
||||
@ -72,16 +71,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
0, /* first */
|
||||
3); /* count */
|
||||
|
||||
/* XXX: Experiments have shown that for some buggy drivers, when using
|
||||
* glReadPixels there is some kind of race, so we delay our test for a
|
||||
* few frames and a few seconds:
|
||||
*/
|
||||
if (state->frame >= 2)
|
||||
validate_result (state);
|
||||
else
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
|
||||
state->frame++;
|
||||
validate_result (state);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -102,8 +92,6 @@ test_cogl_vertex_buffer_interleved (TestConformSimpleFixture *fixture,
|
||||
ClutterActor *group;
|
||||
guint idle_source;
|
||||
|
||||
state.frame = 0;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
|
||||
@ -115,9 +103,9 @@ test_cogl_vertex_buffer_interleved (TestConformSimpleFixture *fixture,
|
||||
state.stage_geom.height);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
||||
|
||||
/* We force continuous redrawing of the stage, since we need to skip
|
||||
* the first few frames, and we wont be doing anything else that
|
||||
* will trigger redrawing. */
|
||||
/* We force continuous redrawing incase someone comments out the
|
||||
* clutter_main_quit and wants visual feedback for the test since we
|
||||
* wont be doing anything else that will trigger redrawing. */
|
||||
idle_source = g_idle_add (queue_redraw, stage);
|
||||
|
||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
||||
|
@ -15,7 +15,6 @@ typedef struct _TestState
|
||||
{
|
||||
CoglHandle buffer;
|
||||
ClutterGeometry stage_geom;
|
||||
guint frame;
|
||||
} TestState;
|
||||
|
||||
static void
|
||||
@ -115,17 +114,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
0, /* first */
|
||||
3); /* count */
|
||||
|
||||
|
||||
/* XXX: Experiments have shown that for some buggy drivers, when using
|
||||
* glReadPixels there is some kind of race, so we delay our test for a
|
||||
* few frames and a few seconds:
|
||||
*/
|
||||
if (state->frame >= 2)
|
||||
validate_result (state);
|
||||
else
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
|
||||
state->frame++;
|
||||
validate_result (state);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -146,8 +135,6 @@ test_cogl_vertex_buffer_mutability (TestConformSimpleFixture *fixture,
|
||||
ClutterActor *group;
|
||||
guint idle_source;
|
||||
|
||||
state.frame = 0;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
|
||||
@ -159,9 +146,9 @@ test_cogl_vertex_buffer_mutability (TestConformSimpleFixture *fixture,
|
||||
state.stage_geom.height);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
||||
|
||||
/* We force continuous redrawing of the stage, since we need to skip
|
||||
* the first few frames, and we wont be doing anything else that
|
||||
* will trigger redrawing. */
|
||||
/* We force continuous redrawing incase someone comments out the
|
||||
* clutter_main_quit and wants visual feedback for the test since we
|
||||
* wont be doing anything else that will trigger redrawing. */
|
||||
idle_source = g_idle_add (queue_redraw, stage);
|
||||
|
||||
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
|
||||
|
@ -11,7 +11,6 @@ typedef struct _TestState
|
||||
{
|
||||
ClutterActor *stage;
|
||||
CoglHandle texture;
|
||||
guint frame;
|
||||
} TestState;
|
||||
|
||||
static CoglHandle
|
||||
@ -273,21 +272,9 @@ validate_result (TestState *state)
|
||||
static void
|
||||
on_paint (ClutterActor *actor, TestState *state)
|
||||
{
|
||||
int frame_num;
|
||||
|
||||
draw_frame (state);
|
||||
|
||||
/* XXX: Experiments have shown that for some buggy drivers, when using
|
||||
* glReadPixels there is some kind of race, so we delay our test for a
|
||||
* few frames and a few seconds:
|
||||
*/
|
||||
/* Need to increment frame first because clutter_stage_read_pixels
|
||||
fires a redraw */
|
||||
frame_num = state->frame++;
|
||||
if (frame_num == 2)
|
||||
validate_result (state);
|
||||
else if (frame_num < 2)
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
validate_result (state);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -306,8 +293,6 @@ test_cogl_wrap_modes (TestConformSimpleFixture *fixture,
|
||||
guint idle_source;
|
||||
guint paint_handler;
|
||||
|
||||
state.frame = 0;
|
||||
|
||||
state.stage = clutter_stage_get_default ();
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (state.stage), &stage_color);
|
||||
|
@ -149,7 +149,7 @@ test_pick (TestConformSimpleFixture *fixture,
|
||||
|
||||
clutter_actor_show (state.stage);
|
||||
|
||||
g_timeout_add (250, (GSourceFunc) on_timeout, &state);
|
||||
g_idle_add ((GSourceFunc) on_timeout, &state);
|
||||
|
||||
clutter_main ();
|
||||
|
||||
|
@ -153,17 +153,12 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
{
|
||||
int frame_num;
|
||||
|
||||
/* XXX: Experiments have shown that for some buggy drivers, when using
|
||||
* glReadPixels there is some kind of race, so we delay our test for a
|
||||
* few frames and a few seconds:
|
||||
*/
|
||||
/* Need to increment frame first because clutter_stage_read_pixels
|
||||
fires a redraw */
|
||||
/* XXX: validate_result calls clutter_stage_read_pixels which will result in
|
||||
* another paint run so to avoid infinite recursion we only aim to validate
|
||||
* the first frame. */
|
||||
frame_num = state->frame++;
|
||||
if (frame_num == 2)
|
||||
if (frame_num == 1)
|
||||
validate_result (state);
|
||||
else if (frame_num < 2)
|
||||
g_usleep (G_USEC_PER_SEC);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
Loading…
Reference in New Issue
Block a user