summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2013-07-10 00:39:18 +0100
committerNeil Roberts <neil@linux.intel.com>2013-07-30 15:08:39 +0100
commite4f24dba755315fa30e20df6518a0f1d49c76878 (patch)
tree473178473d3affe0220cb255222e4d5901086331 /tests
parente9f721216e4f7974912b58480e8ca001c82a270a (diff)
downloadcogl-e4f24dba755315fa30e20df6518a0f1d49c76878.tar.gz
framebuffer: remove attribute drawing apis
Almost nothing draws attributes directly and for those things that do it's trivial to adapt them to instead draw via the cogl_primitive api. This simplifies the Cogl api a bit. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 7395925bcc01aad6c695fd0d9af78b784b3c64d4) Conflicts: cogl/cogl-framebuffer.c cogl/cogl-framebuffer.h
Diffstat (limited to 'tests')
-rw-r--r--tests/conform/test-custom-attributes.c68
-rw-r--r--tests/conform/test-map-buffer-range.c17
2 files changed, 42 insertions, 43 deletions
diff --git a/tests/conform/test-custom-attributes.c b/tests/conform/test-custom-attributes.c
index fce541e7..c27dfa19 100644
--- a/tests/conform/test-custom-attributes.c
+++ b/tests/conform/test-custom-attributes.c
@@ -31,6 +31,7 @@ test_float_verts (TestState *state, int offset_x, int offset_y)
{
CoglAttribute *attributes[2];
CoglAttributeBuffer *buffer;
+ CoglPrimitive *primitive;
static const FloatVert float_verts[] =
{
@@ -61,13 +62,12 @@ test_float_verts (TestState *state, int offset_x, int offset_y)
cogl_framebuffer_push_matrix (test_fb);
cogl_framebuffer_translate (test_fb, offset_x, offset_y, 0.0f);
- cogl_framebuffer_draw_attributes (test_fb,
- state->pipeline,
- COGL_VERTICES_MODE_TRIANGLES,
- 0, /* first_vertex */
- 6, /* n_vertices */
- attributes,
- 2 /* n_attributes */);
+ primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES,
+ 6, /* n_vertices */
+ attributes,
+ 2); /* n_attributes */
+ cogl_primitive_draw (primitive, test_fb, state->pipeline);
+ cogl_object_unref (primitive);
cogl_framebuffer_pop_matrix (test_fb);
@@ -84,6 +84,7 @@ test_byte_verts (TestState *state, int offset_x, int offset_y)
{
CoglAttribute *attributes[2];
CoglAttributeBuffer *buffer, *unnorm_buffer;
+ CoglPrimitive *primitive;
static const ByteVert norm_verts[] =
{
@@ -122,13 +123,12 @@ test_byte_verts (TestState *state, int offset_x, int offset_y)
cogl_framebuffer_push_matrix (test_fb);
cogl_framebuffer_translate (test_fb, offset_x, offset_y, 0.0f);
- cogl_framebuffer_draw_attributes (test_fb,
- state->pipeline,
- COGL_VERTICES_MODE_TRIANGLES,
- 0, /* first_vertex */
- 6, /* n_vertices */
- attributes,
- 2 /* n_attributes */);
+ primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES,
+ 6, /* n_vertices */
+ attributes,
+ 2); /* n_attributes */
+ cogl_primitive_draw (primitive, test_fb, state->pipeline);
+ cogl_object_unref (primitive);
cogl_object_unref (attributes[1]);
@@ -145,13 +145,12 @@ test_byte_verts (TestState *state, int offset_x, int offset_y)
cogl_framebuffer_translate (test_fb, 20, 0, 0);
- cogl_framebuffer_draw_attributes (test_fb,
- state->pipeline,
- COGL_VERTICES_MODE_TRIANGLES,
- 0, /* first_vertex */
- 3, /* n_vertices */
- attributes,
- 2 /* n_attributes */);
+ primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES,
+ 3, /* n_vertices */
+ attributes,
+ 2); /* n_attributes */
+ cogl_primitive_draw (primitive, test_fb, state->pipeline);
+ cogl_object_unref (primitive);
cogl_framebuffer_pop_matrix (test_fb);
@@ -172,6 +171,7 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
CoglAttributeBuffer *buffer;
CoglPipeline *pipeline, *pipeline2;
CoglSnippet *snippet;
+ CoglPrimitive *primitive;
static const ShortVert short_verts[] =
{
@@ -208,13 +208,12 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
offset_y + 10.0f,
0.0f);
- cogl_framebuffer_draw_attributes (test_fb,
- pipeline,
- COGL_VERTICES_MODE_TRIANGLES,
- 0, /* first_vertex */
- 3, /* n_vertices */
- attributes,
- 1 /* n_attributes */);
+ primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES,
+ 3, /* n_vertices */
+ attributes,
+ 1); /* n_attributes */
+ cogl_primitive_draw (primitive, test_fb, pipeline);
+ cogl_object_unref (primitive);
cogl_framebuffer_pop_matrix (test_fb);
@@ -237,13 +236,12 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
offset_y - 65525,
0.0f);
- cogl_framebuffer_draw_attributes (test_fb,
- pipeline2,
- COGL_VERTICES_MODE_TRIANGLES,
- 0, /* first_vertex */
- 3, /* n_vertices */
- attributes,
- 1 /* n_attributes */);
+ primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES,
+ 3, /* n_vertices */
+ attributes,
+ 1); /* n_attributes */
+ cogl_primitive_draw (primitive, test_fb, pipeline2);
+ cogl_object_unref (primitive);
cogl_framebuffer_pop_matrix (test_fb);
diff --git a/tests/conform/test-map-buffer-range.c b/tests/conform/test-map-buffer-range.c
index a223bbc0..a9c136ba 100644
--- a/tests/conform/test-map-buffer-range.c
+++ b/tests/conform/test-map-buffer-range.c
@@ -32,6 +32,7 @@ test_map_buffer_range (void)
CoglVertexP2T2 *data;
CoglAttribute *pos_attribute;
CoglAttribute *tex_coord_attribute;
+ CoglPrimitive *primitive;
tex = cogl_texture_2d_new_from_data (test_ctx,
2, 2, /* width/height */
@@ -95,14 +96,14 @@ test_map_buffer_range (void)
COGL_BUFFER_BIT_COLOR,
0, 0, 0, 1);
- cogl_framebuffer_vdraw_attributes (test_fb,
- pipeline,
- COGL_VERTICES_MODE_TRIANGLE_STRIP,
- 0, /* first_vertex */
- 4, /* n_vertices */
- pos_attribute,
- tex_coord_attribute,
- NULL);
+ primitive =
+ cogl_primitive_new (COGL_VERTICES_MODE_TRIANGLE_STRIP,
+ 4, /* n_vertices */
+ pos_attribute,
+ tex_coord_attribute,
+ NULL);
+ cogl_primitive_draw (primitive, test_fb, pipeline);
+ cogl_object_unref (primitive);
/* Top left pixel should be the one that is replaced to be green */
test_utils_check_pixel (test_fb, 1, 1, 0x00ff00ff);