[cogl/cogl-1.16] framebuffer: remove attribute drawing apis



commit e4f24dba755315fa30e20df6518a0f1d49c76878
Author: Robert Bragg <robert linux intel com>
Date:   Wed Jul 10 00:39:18 2013 +0100

    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

 cogl/cogl-framebuffer.c                            |  107 ---------
 cogl/cogl-framebuffer.h                            |  227 +-------------------
 cogl/cogl-meta-texture.h                           |   16 +-
 cogl/cogl-primitive-texture.h                      |    6 +-
 cogl/cogl.symbols                                  |    2 -
 cogl/cogl2-compatibility.c                         |   18 +-
 cogl/cogl2-path.c                                  |   15 +-
 .../cogl-2.0-experimental-sections.txt             |    4 -
 tests/conform/test-custom-attributes.c             |   68 +++---
 tests/conform/test-map-buffer-range.c              |   17 +-
 10 files changed, 78 insertions(+), 402 deletions(-)
---
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index bbf837b..b6a3116 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -2409,57 +2409,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,
-                                     COGL_DRAW_SKIP_LEGACY_STATE);
-}
-
-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,
-                                     COGL_DRAW_SKIP_LEGACY_STATE);
-}
-
-void
 _cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
                                            CoglPipeline *pipeline,
                                            CoglVerticesMode mode,
@@ -2499,62 +2448,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,
-                                             COGL_DRAW_SKIP_LEGACY_STATE);
-}
-
-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,
-                                             COGL_DRAW_SKIP_LEGACY_STATE);
-}
-
-void
 cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
                                  CoglPipeline *pipeline,
                                  CoglPrimitive *primitive)
diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h
index 760770c..899d735 100644
--- a/cogl/cogl-framebuffer.h
+++ b/cogl/cogl-framebuffer.h
@@ -1121,218 +1121,6 @@ cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
                                  CoglPrimitive *primitive);
 
 /**
- * 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.
- *
- * <note>This api doesn't support any of the legacy global state options such
- * as cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or
- * cogl_program_use()</note>
- *
- * 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.
- *
- * <note>This api doesn't support any of the legacy global state
- * options such as cogl_set_depth_test_enabled(),
- * cogl_set_backface_culling_enabled() or cogl_program_use()</note>
- *
- * 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.
- *
- * <note>This api doesn't support any of the legacy global state
- * options such as cogl_set_depth_test_enabled(),
- * cogl_set_backface_culling_enabled() or cogl_program_use()</note>
- *
- * 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
@@ -1391,9 +1179,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
@@ -1456,9 +1243,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
@@ -1564,9 +1350,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 8d838c6..30d94e4 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
@@ -153,10 +153,10 @@ typedef void (*CoglMetaTextureCallback) (CoglTexture *sub_texture,
  * internally use this API to resolve the low level 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 5bd32c7..a7e6a0f 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 100fa6d..0766c31 100644
--- a/cogl/cogl.symbols
+++ b/cogl/cogl.symbols
@@ -226,8 +226,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/cogl/cogl2-compatibility.c b/cogl/cogl2-compatibility.c
index fa03368..2b4142c 100644
--- a/cogl/cogl2-compatibility.c
+++ b/cogl/cogl2-compatibility.c
@@ -31,6 +31,7 @@
 
 #include "cogl2-compatibility.h"
 #include "cogl-framebuffer.h"
+#include "cogl-framebuffer-private.h"
 #include "cogl-index-buffer.h"
 #include "cogl-pipeline.h"
 
@@ -137,12 +138,13 @@ cogl_vdraw_indexed_attributes (CoglFramebuffer *framebuffer,
     attributes[i] = attribute;
   va_end (ap);
 
-  cogl_framebuffer_draw_indexed_attributes (framebuffer,
-                                            pipeline,
-                                            mode,
-                                            first_vertex,
-                                            n_vertices,
-                                            indices,
-                                            attributes,
-                                            n_attributes);
+  _cogl_framebuffer_draw_indexed_attributes (framebuffer,
+                                             pipeline,
+                                             mode,
+                                             first_vertex,
+                                             n_vertices,
+                                             indices,
+                                             attributes,
+                                             n_attributes,
+                                             COGL_DRAW_SKIP_LEGACY_STATE);
 }
diff --git a/cogl/cogl2-path.c b/cogl/cogl2-path.c
index 30b165c..6535093 100644
--- a/cogl/cogl2-path.c
+++ b/cogl/cogl2-path.c
@@ -225,14 +225,17 @@ _cogl_path_stroke_nodes (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/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt 
b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
index c27a81e..6b2dfec 100644
--- a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
+++ b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
@@ -542,10 +542,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 fce541e..c27dfa1 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 a223bbc..a9c136b 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]