diff options
author | Robert Bragg <robert@linux.intel.com> | 2013-07-10 00:39:18 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2013-07-15 22:58:19 +0100 |
commit | 7395925bcc01aad6c695fd0d9af78b784b3c64d4 (patch) | |
tree | e5ce201895c66b0ddd24b0ca6914f1849ee4d44d | |
parent | 81d0725e19595196ca70971fc8d3e351bcdd7a65 (diff) | |
download | cogl-7395925bcc01aad6c695fd0d9af78b784b3c64d4.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>
-rw-r--r-- | cogl-path/cogl-path.c | 15 | ||||
-rw-r--r-- | cogl/cogl-framebuffer.c | 107 | ||||
-rw-r--r-- | cogl/cogl-framebuffer.h | 215 | ||||
-rw-r--r-- | cogl/cogl-meta-texture.h | 16 | ||||
-rw-r--r-- | cogl/cogl-primitive-texture.h | 6 | ||||
-rw-r--r-- | cogl/cogl.symbols | 2 | ||||
-rw-r--r-- | doc/reference/cogl2/cogl2-sections.txt | 4 | ||||
-rw-r--r-- | tests/conform/test-custom-attributes.c | 68 | ||||
-rw-r--r-- | tests/conform/test-map-buffer-range.c | 17 |
9 files changed, 68 insertions, 382 deletions
diff --git a/cogl-path/cogl-path.c b/cogl-path/cogl-path.c index 4e56ac57..c54ca01e 100644 --- a/cogl-path/cogl-path.c +++ b/cogl-path/cogl-path.c @@ -239,14 +239,17 @@ cogl_path_stroke (CoglPath *path, path_start < data->path_nodes->len; path_start += node->path_size) { + CoglPrimitive *primitive; + node = &g_array_index (data->path_nodes, CoglPathNode, path_start); - cogl_framebuffer_vdraw_attributes (framebuffer, - pipeline, - COGL_VERTICES_MODE_LINE_STRIP, - 0, node->path_size, - data->stroke_attributes[path_num], - NULL); + primitive = + cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_LINE_STRIP, + node->path_size, + &data->stroke_attributes[path_num], + 1); + cogl_primitive_draw (primitive, framebuffer, pipeline); + cogl_object_unref (primitive); path_num++; } diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c index 56e84693..32e62785 100644 --- a/cogl/cogl-framebuffer.c +++ b/cogl/cogl-framebuffer.c @@ -2076,57 +2076,6 @@ _cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer, } void -cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer, - CoglPipeline *pipeline, - CoglVerticesMode mode, - int first_vertex, - int n_vertices, - CoglAttribute **attributes, - int n_attributes) -{ - _cogl_framebuffer_draw_attributes (framebuffer, - pipeline, - mode, - first_vertex, - n_vertices, - attributes, n_attributes, - 0 /* flags */); -} - -void -cogl_framebuffer_vdraw_attributes (CoglFramebuffer *framebuffer, - CoglPipeline *pipeline, - CoglVerticesMode mode, - int first_vertex, - int n_vertices, - ...) -{ - va_list ap; - int n_attributes; - CoglAttribute *attribute; - CoglAttribute **attributes; - int i; - - va_start (ap, n_vertices); - for (n_attributes = 0; va_arg (ap, CoglAttribute *); n_attributes++) - ; - va_end (ap); - - attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes); - - va_start (ap, n_vertices); - for (i = 0; (attribute = va_arg (ap, CoglAttribute *)); i++) - attributes[i] = attribute; - va_end (ap); - - _cogl_framebuffer_draw_attributes (framebuffer, - pipeline, - mode, first_vertex, n_vertices, - attributes, n_attributes, - 0 /* flags */); -} - -void _cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer, CoglPipeline *pipeline, CoglVerticesMode mode, @@ -2166,62 +2115,6 @@ _cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer, } void -cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer, - CoglPipeline *pipeline, - CoglVerticesMode mode, - int first_vertex, - int n_vertices, - CoglIndices *indices, - CoglAttribute **attributes, - int n_attributes) -{ - _cogl_framebuffer_draw_indexed_attributes (framebuffer, - pipeline, - mode, first_vertex, - n_vertices, indices, - attributes, n_attributes, - 0 /* flags */); -} - -void -cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer, - CoglPipeline *pipeline, - CoglVerticesMode mode, - int first_vertex, - int n_vertices, - CoglIndices *indices, - ...) -{ - va_list ap; - int n_attributes; - CoglAttribute **attributes; - int i; - CoglAttribute *attribute; - - va_start (ap, indices); - for (n_attributes = 0; va_arg (ap, CoglAttribute *); n_attributes++) - ; - va_end (ap); - - attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes); - - va_start (ap, indices); - for (i = 0; (attribute = va_arg (ap, CoglAttribute *)); i++) - attributes[i] = attribute; - va_end (ap); - - _cogl_framebuffer_draw_indexed_attributes (framebuffer, - pipeline, - mode, - first_vertex, - n_vertices, - indices, - attributes, - n_attributes, - 0 /* flags */); -} - -void cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer, CoglPipeline *pipeline, float x_1, diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h index 273442d9..508b2cfd 100644 --- a/cogl/cogl-framebuffer.h +++ b/cogl/cogl-framebuffer.h @@ -1060,206 +1060,6 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer, float alpha); /** - * cogl_framebuffer_vdraw_attributes: - * @framebuffer: A destination #CoglFramebuffer - * @pipeline: A #CoglPipeline state object - * @mode: The #CoglVerticesMode defining the topology of vertices - * @first_vertex: The vertex offset within the given attributes to draw from - * @n_vertices: The number of vertices to draw from the given attributes - * @...: A set of vertex #CoglAttribute<!-- -->s defining vertex geometry - * - * First defines a geometry primitive by grouping a set of vertex attributes; - * specifying a @first_vertex; a number of vertices (@n_vertices) and - * specifying what kind of topology the vertices have via @mode. - * - * Then the function draws the given @primitive geometry to the specified - * destination @framebuffer using the graphics processing pipeline described by - * @pipeline. - * - * The list of #CoglAttribute<!-- -->s define the attributes of the vertices to - * be drawn, such as positions, colors and normals and should be %NULL - * terminated. - * - * This drawing api doesn't support high-level meta texture types such - * as #CoglTexture2DSliced so it is the user's responsibility to - * ensure that only low-level textures that can be directly sampled by - * a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D - * are associated with layers of the given @pipeline. - * - * Stability: unstable - * Since: 1.10 - */ -void -cogl_framebuffer_vdraw_attributes (CoglFramebuffer *framebuffer, - CoglPipeline *pipeline, - CoglVerticesMode mode, - int first_vertex, - int n_vertices, - ...) COGL_GNUC_NULL_TERMINATED; - -/** - * cogl_framebuffer_draw_attributes: - * @framebuffer: A destination #CoglFramebuffer - * @pipeline: A #CoglPipeline state object - * @mode: The #CoglVerticesMode defining the topology of vertices - * @first_vertex: The vertex offset within the given attributes to draw from - * @n_vertices: The number of vertices to draw from the given attributes - * @attributes: An array of pointers to #CoglAttribute<-- -->s defining vertex - * geometry - * @n_attributes: The number of attributes in the @attributes array. - * - * First defines a geometry primitive by grouping a set of vertex @attributes; - * specifying a @first_vertex; a number of vertices (@n_vertices) and - * specifying what kind of topology the vertices have via @mode. - * - * Then the function draws the given @primitive geometry to the specified - * destination @framebuffer using the graphics processing pipeline described by - * @pipeline. - * - * The list of #CoglAttribute<!-- -->s define the attributes of the vertices to - * be drawn, such as positions, colors and normals and the number of attributes - * is given as @n_attributes. - * - * This drawing api doesn't support high-level meta texture types such - * as #CoglTexture2DSliced so it is the user's responsibility to - * ensure that only low-level textures that can be directly sampled by - * a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D - * are associated with layers of the given @pipeline. - * - * Stability: unstable - * Since: 1.10 - */ -void -cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer, - CoglPipeline *pipeline, - CoglVerticesMode mode, - int first_vertex, - int n_vertices, - CoglAttribute **attributes, - int n_attributes); - -/** - * cogl_framebuffer_vdraw_indexed_attributes: - * @framebuffer: A destination #CoglFramebuffer - * @pipeline: A #CoglPipeline state object - * @mode: The #CoglVerticesMode defining the topology of vertices - * @first_vertex: The vertex offset within the given attributes to draw from - * @n_vertices: The number of vertices to draw from the given attributes - * @indices: The array of indices used by the GPU to lookup attribute - * data for each vertex. - * @...: A set of vertex #CoglAttribute<!-- -->s defining vertex geometry - * - * Behaves the same as cogl_framebuffer_vdraw_attributes() except that - * instead of reading vertex data sequentially from the specified - * attributes the @indices provide an indirection for how the data - * should be indexed allowing a random access order to be - * specified. - * - * For example an indices array of [0, 1, 2, 0, 2, 3] could be used - * used to draw two triangles (@mode = %COGL_VERTICES_MODE_TRIANGLES + - * @n_vertices = 6) but only provide attribute data for the 4 corners - * of a rectangle. When the GPU needs to read in each of the 6 - * vertices it will read the @indices array for each vertex in - * sequence and use the index to look up the vertex attribute data. So - * here you can see that first and fourth vertex will point to the - * same data and third and fifth vertex will also point to shared - * data. - * - * Drawing with indices can be a good way of minimizing the size of a - * mesh by allowing you to avoid data for duplicate vertices because - * multiple entries in the index array can refer back to a single - * shared vertex. - * - * <note>The @indices array must be at least as long as @first_vertex - * + @n_vertices otherwise the GPU will overrun the indices array when - * looking up vertex data.</note> - * - * Since it's very common to want to draw a run of rectangles using - * indices to avoid duplicating vertex data you can use - * cogl_get_rectangle_indices() to get a set of indices that can be - * shared. - * - * This drawing api doesn't support high-level meta texture types such - * as #CoglTexture2DSliced so it is the user's responsibility to - * ensure that only low-level textures that can be directly sampled by - * a GPU such as #CoglTexture2D, #CoglTextureRectangle or - * #CoglTexture3D are associated with layers of the given @pipeline. - * - * Stability: unstable - * Since: 1.10 - */ -void -cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer, - CoglPipeline *pipeline, - CoglVerticesMode mode, - int first_vertex, - int n_vertices, - CoglIndices *indices, - ...) COGL_GNUC_NULL_TERMINATED; - -/** - * cogl_framebuffer_draw_indexed_attributes: - * @framebuffer: A destination #CoglFramebuffer - * @pipeline: A #CoglPipeline state object - * @mode: The #CoglVerticesMode defining the topology of vertices - * @first_vertex: The vertex offset within the given attributes to draw from - * @n_vertices: The number of vertices to draw from the given attributes - * @indices: The array of indices used by the GPU to lookup attribute - * data for each vertex. - * @attributes: An array of pointers to #CoglAttribute<-- -->s defining vertex - * geometry - * @n_attributes: The number of attributes in the @attributes array. - * - * Behaves the same as cogl_framebuffer_draw_attributes() except that - * instead of reading vertex data sequentially from the specified - * @attributes the @indices provide an indirection for how the data - * should be indexed allowing a random access order to be - * specified. - * - * For example an indices array of [0, 1, 2, 0, 2, 3] could be used - * used to draw two triangles (@mode = %COGL_VERTICES_MODE_TRIANGLES + - * @n_vertices = 6) but only provide attribute data for the 4 corners - * of a rectangle. When the GPU needs to read in each of the 6 - * vertices it will read the @indices array for each vertex in - * sequence and use the index to look up the vertex attribute data. So - * here you can see that first and fourth vertex will point to the - * same data and third and fifth vertex will also point to shared - * data. - * - * Drawing with indices can be a good way of minimizing the size of a - * mesh by allowing you to avoid data for duplicate vertices because - * multiple entries in the index array can refer back to a single - * shared vertex. - * - * <note>The @indices array must be at least as long as @first_vertex - * + @n_vertices otherwise the GPU will overrun the indices array when - * looking up vertex data.</note> - * - * Since it's very common to want to draw a run of rectangles using - * indices to avoid duplicating vertex data you can use - * cogl_get_rectangle_indices() to get a set of indices that can be - * shared. - * - * This drawing api doesn't support high-level meta texture types such - * as #CoglTexture2DSliced so it is the user's responsibility to - * ensure that only low-level textures that can be directly sampled by - * a GPU such as #CoglTexture2D, #CoglTextureRectangle or - * #CoglTexture3D are associated with layers of the given @pipeline. - * - * Stability: unstable - * Since: 1.10 - */ -void -cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer, - CoglPipeline *pipeline, - CoglVerticesMode mode, - int first_vertex, - int n_vertices, - CoglIndices *indices, - CoglAttribute **attributes, - int n_attributes); - -/** * cogl_framebuffer_draw_rectangle: * @framebuffer: A destination #CoglFramebuffer * @pipeline: A #CoglPipeline state object @@ -1318,9 +1118,8 @@ cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer, * #CoglMetaTexture texture such as #CoglTexture2DSliced textures * which may internally be comprised of multiple low-level textures. * This is unlike low-level drawing apis such as cogl_primitive_draw() - * or cogl_framebuffer_draw_attributes() which only support low level - * texture types that are directly supported by GPUs such as - * #CoglTexture2D. + * which only support low level texture types that are directly + * supported by GPUs such as #CoglTexture2D. * * <note>The given texture coordinates will only be used for the first * texture layer of the pipeline and if your pipeline has more than @@ -1383,9 +1182,8 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer, * #CoglMetaTexture texture for the first layer such as * #CoglTexture2DSliced textures which may internally be comprised of * multiple low-level textures. This is unlike low-level drawing apis - * such as cogl_primitive_draw() or cogl_framebuffer_draw_attributes() - * which only support low level texture types that are directly - * supported by GPUs such as #CoglTexture2D. + * such as cogl_primitive_draw() which only support low level texture + * types that are directly supported by GPUs such as #CoglTexture2D. * * <note>This api can not currently handle multiple high-level meta * texture layers. The first layer may be a high level meta texture @@ -1491,9 +1289,8 @@ cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer, * #CoglMetaTexture texture such as #CoglTexture2DSliced textures * which may internally be comprised of multiple low-level textures. * This is unlike low-level drawing apis such as cogl_primitive_draw() - * or cogl_framebuffer_draw_attributes() which only support low level - * texture types that are directly supported by GPUs such as - * #CoglTexture2D. + * which only support low level texture types that are directly + * supported by GPUs such as #CoglTexture2D. * * The top left corner of the first rectangle is positioned at * (coordinates[0], coordinates[1]) and the bottom right corner is diff --git a/cogl/cogl-meta-texture.h b/cogl/cogl-meta-texture.h index 746e5161..60a3b4ef 100644 --- a/cogl/cogl-meta-texture.h +++ b/cogl/cogl-meta-texture.h @@ -66,10 +66,10 @@ COGL_BEGIN_DECLS * Cogl doesn't aim to pretend that meta-textures are just like real * textures because it would get extremely complex to try and emulate * low-level GPU semantics transparently for these textures. The low - * level drawing APIs of Cogl, such as cogl_framebuffer_draw_attributes() - * don't actually know anything about the #CoglMetaTexture interface and its - * the developer's responsibility to resolve all textures referenced by a - * #CoglPipeline to low-level textures before drawing. + * level drawing APIs of Cogl, such as cogl_primitive_draw() don't + * actually know anything about the #CoglMetaTexture interface and its + * the developer's responsibility to resolve all textures referenced + * by a #CoglPipeline to low-level textures before drawing. * * If you want to develop custom primitive APIs like * cogl_framebuffer_draw_rectangle() and you want to support drawing @@ -77,7 +77,7 @@ COGL_BEGIN_DECLS * example, then you will need to use this #CoglMetaTexture interface * to be able to resolve high-level textures into low-level textures * before drawing with Cogl's low-level drawing APIs such as - * cogl_framebuffer_draw_attributes(). + * cogl_primitive_draw(). * * <note>Most developers won't need to use this interface directly * but still it is worth understanding the distinction between @@ -154,10 +154,10 @@ typedef void (*CoglMetaTextureCallback) (CoglTexture *sub_texture, * textures of any meta textures you have associated with CoglPipeline * layers. * - * <note>The low level drawing APIs such as cogl_framebuffer_draw_attributes() + * <note>The low level drawing APIs such as cogl_primitive_draw() * don't understand the #CoglMetaTexture interface and so it is your - * responsibility to use this API to resolve all CoglPipeline - * textures into low-level textures before drawing.</note> + * responsibility to use this API to resolve all CoglPipeline textures + * into low-level textures before drawing.</note> * * For each low-level texture that makes up part of the given region * of the @meta_texture, @callback is called specifying how the diff --git a/cogl/cogl-primitive-texture.h b/cogl/cogl-primitive-texture.h index 5bd32c77..a7e6a0fd 100644 --- a/cogl/cogl-primitive-texture.h +++ b/cogl/cogl-primitive-texture.h @@ -46,9 +46,9 @@ COGL_BEGIN_DECLS * as #CoglAtlasTexture and #CoglTexture2DSliced. * * A texture that implements this interface can be directly used with - * the attributes API such as cogl_framebuffer_draw_attributes(). - * Other types of textures need to be first resolved to primitive - * textures using the #CoglMetaTexture interface. + * the low level cogl_primitive_draw() API. Other types of textures + * need to be first resolved to primitive textures using the + * #CoglMetaTexture interface. * * <note>Most developers won't need to use this interface directly but * still it is worth understanding the distinction between high-level diff --git a/cogl/cogl.symbols b/cogl/cogl.symbols index 591b7eed..70b83c36 100644 --- a/cogl/cogl.symbols +++ b/cogl/cogl.symbols @@ -180,8 +180,6 @@ cogl_framebuffer_allocate cogl_framebuffer_clear4f cogl_framebuffer_clear cogl_framebuffer_discard_buffers -cogl_framebuffer_draw_attributes -cogl_framebuffer_draw_indexed_attributes cogl_framebuffer_draw_rectangle cogl_framebuffer_draw_rectangles cogl_framebuffer_draw_textured_rectangle diff --git a/doc/reference/cogl2/cogl2-sections.txt b/doc/reference/cogl2/cogl2-sections.txt index 0a20e2c3..4354d0b9 100644 --- a/doc/reference/cogl2/cogl2-sections.txt +++ b/doc/reference/cogl2/cogl2-sections.txt @@ -482,10 +482,6 @@ cogl_framebuffer_set_dither_enabled cogl_framebuffer_get_dither_enabled <SUBSECTION> -cogl_framebuffer_draw_attributes -cogl_framebuffer_vdraw_attributes -cogl_framebuffer_draw_indexed_attributes -cogl_framebuffer_vdraw_indexed_attributes cogl_framebuffer_draw_rectangle cogl_framebuffer_draw_textured_rectangle cogl_framebuffer_draw_multitextured_rectangle 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); |