typedef struct _TestState
{
- guint frame;
ClutterGeometry stage_geom;
} TestState;
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,
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,
static void
on_paint (ClutterActor *actor, TestState *state)
{
- int frame_num;
-
test_blend (state, 0, 0, /* position */
0xff0000ff, /* src */
0xffffffff, /* dst */
"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
ClutterActor *group;
guint idle_source;
- state.frame = 0;
-
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
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);
typedef struct _TestState
{
- guint frame;
ClutterGeometry stage_geom;
} TestState;
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,
static void
on_paint (ClutterActor *actor, TestState *state)
{
- int frame_num;
CoglMatrix projection_save;
CoglMatrix identity;
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
ClutterActor *group;
guint idle_source;
- state.frame = 0;
-
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
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);
#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;
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,
static void
on_paint (ClutterActor *actor, TestState *state)
{
- int frame_num;
-
test_invalid_texture_layers (state,
0, 0 /* position */
);
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
}
ClutterActor *group;
guint idle_source;
- state.frame = 0;
-
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
typedef struct _TestState
{
- guint frame;
+ guint padding;
} TestState;
static void
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);
ClutterActor *group;
guint idle_source;
- state.frame = 0;
-
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
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);
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
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
#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;
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,
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,
/* 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,
* 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,
/* 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");
/* 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,
* 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,
* 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,
/* 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,
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,
/* 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,
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
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);
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);
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
typedef struct _TestState
{
- guint frame;
+ guint padding;
} TestState;
/* Creates a texture where the pixels are evenly divided between
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);
ClutterActor *group;
guint idle_source;
- state.frame = 0;
-
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
typedef struct _TestState
{
ClutterActor *stage;
- guint frame;
} TestState;
static CoglHandle
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
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
CoglHandle texture;
CoglHandle material;
ClutterGeometry stage_geom;
- guint frame;
} TestState;
static void
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
0x00, 0xff, 0x00, 0xff
};
- state.frame = 0;
-
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
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);
{
CoglHandle buffer;
ClutterGeometry stage_geom;
- guint frame;
} TestState;
typedef struct _InterlevedVertex
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
ClutterActor *group;
guint idle_source;
- state.frame = 0;
-
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
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);
{
CoglHandle buffer;
ClutterGeometry stage_geom;
- guint frame;
} TestState;
static void
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
ClutterActor *group;
guint idle_source;
- state.frame = 0;
-
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
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);
{
ClutterActor *stage;
CoglHandle texture;
- guint frame;
} TestState;
static CoglHandle
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
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);
clutter_actor_show (state.stage);
- g_timeout_add (250, (GSourceFunc) on_timeout, &state);
+ g_idle_add ((GSourceFunc) on_timeout, &state);
clutter_main ();
{
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