[cogl] Add _primitive_draw to replace _framebuffer_draw_primitive



commit 418912b93ff81a47f9b38114d05335ab76277c48
Author: Robert Bragg <robert linux intel com>
Date:   Tue Jul 9 23:47:29 2013 +0100

    Add _primitive_draw to replace _framebuffer_draw_primitive
    
    When splitting out the CoglPath api we saw that we would be left with
    inconsistent drawing apis if the drawing apis in core Cogl were lumped
    into the cogl_framebuffer_ api considering other Cogl sub-libraries or
    that others will want to create higher level drawing apis outside of
    Cogl but can't use the same namespace.
    
    So that we can aim for a more consistent style this adds a
    cogl_primitive_draw() api, comparable to cogl_path_fill() or
    cogl_pango_show_layout() that's intended to replace
    cogl_framebuffer_draw_primitive()
    
    Note: the attribute and rectangle drawing apis are still in the
    cogl_framebuffer_ namespace and this might potentially change but in
    these cases there is no single object representing the thing being drawn
    so it seems a more reasonable they they live in the framebuffer
    namespace for now.
    
    Note: the cogl_framebuffer_draw_primitive() api isn't removed by this
    patch so it can more conveniently be cherry picked to the 1.16 branch so
    we can mark it deprecated for a short while. Even though it's marked as
    experimental api we know that there are people using the api so we'd
    like to give them a chance to switch to the new api.
    
    Reviewed-by: Neil Roberts <neil linux intel com>

 cogl-pango/cogl-pango-display-list.c       |   10 ++++----
 cogl-path/cogl-path.c                      |    9 ++++---
 cogl/Makefile.am                           |    2 +-
 cogl/cogl-bitmap.h                         |    6 +++-
 cogl/cogl-framebuffer-private.h            |    6 ----
 cogl/cogl-framebuffer.c                    |   31 +----------------------
 cogl/cogl-framebuffer.h                    |   17 +++++-------
 cogl/cogl-pipeline-layer-state.h           |    2 +-
 cogl/cogl-pixel-buffer.h                   |    6 +++-
 cogl/cogl-primitive-private.h              |    3 ++
 cogl/cogl-primitive.c                      |   36 ++++++++++++++++++++++++++++
 cogl/cogl-primitive.h                      |   25 +++++++++++++++++++
 cogl/cogl.symbols                          |    2 +-
 cogl/driver/gl/cogl-clip-stack-gl.c        |   13 +++++----
 doc/reference/cogl2/cogl2-sections.txt     |    2 +-
 examples/cogl-crate.c                      |    2 +-
 examples/cogl-emscripten-hello.c           |    2 +-
 examples/cogl-gles2-context.c              |    2 +-
 examples/cogl-hello.c                      |    6 ++--
 examples/cogl-msaa.c                       |    4 +-
 examples/cogl-sdl-hello.c                  |    2 +-
 examples/cogl-sdl2-hello.c                 |    2 +-
 examples/cogl-x11-foreign.c                |    2 +-
 examples/cogland.c                         |    4 +-
 tests/conform/test-blend.c                 |    4 +-
 tests/conform/test-point-size-attribute.c  |    2 +-
 tests/conform/test-point-size.c            |    4 +--
 tests/conform/test-point-sprite.c          |    8 +----
 tests/conform/test-primitive-and-journal.c |    8 +----
 tests/conform/test-primitive.c             |    2 +-
 tests/conform/test-texture-3d.c            |    2 +-
 31 files changed, 125 insertions(+), 101 deletions(-)
---
diff --git a/cogl-pango/cogl-pango-display-list.c b/cogl-pango/cogl-pango-display-list.c
index a2f2e27..46f0d2a 100644
--- a/cogl-pango/cogl-pango-display-list.c
+++ b/cogl-pango/cogl-pango-display-list.c
@@ -380,9 +380,9 @@ emit_vertex_buffer_geometry (CoglFramebuffer *fb,
       cogl_object_unref (attributes[1]);
     }
 
-  cogl_framebuffer_draw_primitive (fb,
-                                   pipeline,
-                                   node->d.texture.primitive);
+  cogl_primitive_draw (node->d.texture.primitive,
+                       fb,
+                       pipeline);
 }
 
 static void
@@ -455,8 +455,8 @@ _cogl_pango_display_list_render (CoglFramebuffer *fb,
           break;
 
         case COGL_PANGO_DISPLAY_LIST_TRAPEZOID:
-          cogl_framebuffer_draw_primitive (fb, node->pipeline,
-                                           node->d.trapezoid.primitive);
+          cogl_primitive_draw (node->d.trapezoid.primitive,
+                               fb, node->pipeline);
           break;
         }
     }
diff --git a/cogl-path/cogl-path.c b/cogl-path/cogl-path.c
index be8bb04..4e56ac5 100644
--- a/cogl-path/cogl-path.c
+++ b/cogl-path/cogl-path.c
@@ -42,6 +42,7 @@
 #include "cogl-primitives-private.h"
 #include "cogl-private.h"
 #include "cogl-attribute-private.h"
+#include "cogl-primitive-private.h"
 #include "tesselator/tesselator.h"
 
 #include <string.h>
@@ -369,10 +370,10 @@ _cogl_path_fill_nodes (CoglPath *path,
 
       primitive = _cogl_path_get_fill_primitive (path);
 
-      _cogl_framebuffer_draw_primitive (framebuffer,
-                                        pipeline,
-                                        primitive,
-                                        flags);
+      _cogl_primitive_draw (primitive,
+                            framebuffer,
+                            pipeline,
+                            flags);
     }
 }
 
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index 1161987..6d6280f 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -506,7 +506,7 @@ libcogl2_la_LDFLAGS = \
        -no-undefined \
        -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ \
        -export-dynamic \
-       -export-symbols-regex 
"^(cogl|_cogl_debug_flags|_cogl_atlas_new|_cogl_atlas_add_reorganize_callback|_cogl_atlas_reserve_space|_cogl_callback|_cogl_util_get_eye_planes_for_screen_poly|_cogl_atlas_texture_remove_reorganize_callback|_cogl_atlas_texture_add_reorganize_callback|_cogl_texture_foreach_sub_texture_in_region|_cogl_profile_trace_message|_cogl_context_get_default|_cogl_framebuffer_get_stencil_bits|_cogl_clip_stack_push_rectangle|_cogl_framebuffer_get_modelview_stack|_cogl_object_default_unref|_cogl_pipeline_foreach_layer_internal|_cogl_clip_stack_push_primitive|_cogl_buffer_unmap_for_fill_or_fallback|_cogl_framebuffer_draw_primitive|_cogl_debug_instances|_cogl_framebuffer_get_projection_stack|_cogl_pipeline_layer_get_texture|_cogl_buffer_map_for_fill_or_fallback|_cogl_framebuffer_get_clip_state|_cogl_texture_can_hardware_repeat|_cogl_pipeline_prune_to_n_layers|test_|unit_test_).*"
+       -export-symbols-regex 
"^(cogl|_cogl_debug_flags|_cogl_atlas_new|_cogl_atlas_add_reorganize_callback|_cogl_atlas_reserve_space|_cogl_callback|_cogl_util_get_eye_planes_for_screen_poly|_cogl_atlas_texture_remove_reorganize_callback|_cogl_atlas_texture_add_reorganize_callback|_cogl_texture_foreach_sub_texture_in_region|_cogl_profile_trace_message|_cogl_context_get_default|_cogl_framebuffer_get_stencil_bits|_cogl_clip_stack_push_rectangle|_cogl_framebuffer_get_modelview_stack|_cogl_object_default_unref|_cogl_pipeline_foreach_layer_internal|_cogl_clip_stack_push_primitive|_cogl_buffer_unmap_for_fill_or_fallback|_cogl_primitive_draw|_cogl_debug_instances|_cogl_framebuffer_get_projection_stack|_cogl_pipeline_layer_get_texture|_cogl_buffer_map_for_fill_or_fallback|_cogl_framebuffer_get_clip_state|_cogl_texture_can_hardware_repeat|_cogl_pipeline_prune_to_n_layers|test_|unit_test_).*"
 
 libcogl2_la_SOURCES = $(cogl_sources_c)
 nodist_libcogl2_la_SOURCES = $(BUILT_SOURCES)
diff --git a/cogl/cogl-bitmap.h b/cogl/cogl-bitmap.h
index 8a91bab..20b4d66 100644
--- a/cogl/cogl-bitmap.h
+++ b/cogl/cogl-bitmap.h
@@ -28,6 +28,10 @@
 #ifndef __COGL_BITMAP_H__
 #define __COGL_BITMAP_H__
 
+/* XXX: We forward declare CoglBitmap here to allow for circular
+ * dependencies between some headers */
+typedef struct _CoglBitmap CoglBitmap;
+
 #include <cogl/cogl-types.h>
 #include <cogl/cogl-buffer.h>
 #include <cogl/cogl-context.h>
@@ -39,8 +43,6 @@
 
 COGL_BEGIN_DECLS
 
-typedef struct _CoglBitmap CoglBitmap;
-
 /**
  * SECTION:cogl-bitmap
  * @short_description: Functions for loading images
diff --git a/cogl/cogl-framebuffer-private.h b/cogl/cogl-framebuffer-private.h
index ffe5e86..d56a1b3 100644
--- a/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl-framebuffer-private.h
@@ -397,12 +397,6 @@ _cogl_framebuffer_restore_clip_stack (CoglFramebuffer *framebuffer);
 void
 _cogl_framebuffer_unref (CoglFramebuffer *framebuffer);
 
-void
-_cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
-                                  CoglPipeline *pipeline,
-                                  CoglPrimitive *primitive,
-                                  CoglDrawFlags flags);
-
 /* This can be called directly by the CoglJournal to draw attributes
  * skipping the implicit journal flush, the framebuffer flush and
  * pipeline validation. */
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index 153c205..cb8c66a 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -2222,39 +2222,12 @@ cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer,
 }
 
 void
-_cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
-                                  CoglPipeline *pipeline,
-                                  CoglPrimitive *primitive,
-                                  CoglDrawFlags flags)
-{
-  if (primitive->indices)
-    _cogl_framebuffer_draw_indexed_attributes (framebuffer,
-                                               pipeline,
-                                               primitive->mode,
-                                               primitive->first_vertex,
-                                               primitive->n_vertices,
-                                               primitive->indices,
-                                               primitive->attributes,
-                                               primitive->n_attributes,
-                                               flags);
-  else
-    _cogl_framebuffer_draw_attributes (framebuffer,
-                                       pipeline,
-                                       primitive->mode,
-                                       primitive->first_vertex,
-                                       primitive->n_vertices,
-                                       primitive->attributes,
-                                       primitive->n_attributes,
-                                       flags);
-}
-
-void
 cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
                                  CoglPipeline *pipeline,
                                  CoglPrimitive *primitive)
 {
-  _cogl_framebuffer_draw_primitive (framebuffer, pipeline, primitive,
-                                    0 /* flags */);
+  _cogl_primitive_draw (primitive, framebuffer, pipeline,
+                        0 /* flags */);
 }
 
 void
diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h
index fde5c35..7b12999 100644
--- a/cogl/cogl-framebuffer.h
+++ b/cogl/cogl-framebuffer.h
@@ -1340,9 +1340,8 @@ cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer,
  * This is a high level drawing api that can handle any kind of
  * #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_framebuffer_draw_primitive() or
- * cogl_framebuffer_draw_attributes() which only support low level
+ * 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.
  *
@@ -1407,10 +1406,9 @@ 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_framebuffer_draw_primitive() 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() or cogl_framebuffer_draw_attributes()
+ * 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
@@ -1515,9 +1513,8 @@ cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer,
  * This is a high level drawing api that can handle any kind of
  * #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_framebuffer_draw_primitive() or
- * cogl_framebuffer_draw_attributes() which only support low level
+ * 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.
  *
diff --git a/cogl/cogl-pipeline-layer-state.h b/cogl/cogl-pipeline-layer-state.h
index 743a5a8..9dec6fa 100644
--- a/cogl/cogl-pipeline-layer-state.h
+++ b/cogl/cogl-pipeline-layer-state.h
@@ -85,7 +85,7 @@ typedef enum {
  *   cogl_framebuffer_draw_rectangle(), it will use repeat mode if any
  *   of the texture coordinates are outside the range 0→1, otherwise
  *   it will use clamp to edge. For cogl_framebuffer_draw_attributes()
- *   or cogl_framebuffer_draw_primitive() it will use repeat mode
+ *   or cogl_primitive_draw() it will use repeat mode
  *   except for layers that have point sprite coordinate generation
  *   enabled. This is the default value.
  *
diff --git a/cogl/cogl-pixel-buffer.h b/cogl/cogl-pixel-buffer.h
index 0e5ea38..9c32d06 100644
--- a/cogl/cogl-pixel-buffer.h
+++ b/cogl/cogl-pixel-buffer.h
@@ -32,6 +32,10 @@
 #ifndef __COGL_PIXEL_BUFFER_H__
 #define __COGL_PIXEL_BUFFER_H__
 
+/* XXX: We forward declare CoglPixelBuffer here to allow for circular
+ * dependencies between some headers */
+typedef struct _CoglPixelBuffer CoglPixelBuffer;
+
 #include <cogl/cogl-types.h>
 #include <cogl/cogl-context.h>
 
@@ -39,8 +43,6 @@ COGL_BEGIN_DECLS
 
 #define COGL_PIXEL_BUFFER(buffer) ((CoglPixelBuffer *)(buffer))
 
-typedef struct _CoglPixelBuffer CoglPixelBuffer;
-
 /**
  * cogl_pixel_buffer_new:
  * @context: A #CoglContext
diff --git a/cogl/cogl-primitive-private.h b/cogl/cogl-primitive-private.h
index 9d03a6b..d9103c2 100644
--- a/cogl/cogl-primitive-private.h
+++ b/cogl/cogl-primitive-private.h
@@ -31,6 +31,7 @@
 #include "cogl-object-private.h"
 #include "cogl-attribute-buffer-private.h"
 #include "cogl-attribute-private.h"
+#include "cogl-framebuffer.h"
 
 struct _CoglPrimitive
 {
@@ -58,6 +59,8 @@ _cogl_primitive_immutable_unref (CoglPrimitive *primitive);
 
 void
 _cogl_primitive_draw (CoglPrimitive *primitive,
+                      CoglFramebuffer *framebuffer,
+                      CoglPipeline *pipeline,
                       CoglDrawFlags flags);
 
 #endif /* __COGL_PRIMITIVE_PRIVATE_H */
diff --git a/cogl/cogl-primitive.c b/cogl/cogl-primitive.c
index 6f3a40e..580f4b8 100644
--- a/cogl/cogl-primitive.c
+++ b/cogl/cogl-primitive.c
@@ -34,6 +34,7 @@
 #include "cogl-primitive.h"
 #include "cogl-primitive-private.h"
 #include "cogl-attribute-private.h"
+#include "cogl-framebuffer-private.h"
 
 #include <stdarg.h>
 #include <string.h>
@@ -599,3 +600,38 @@ cogl_primitive_foreach_attribute (CoglPrimitive *primitive,
     if (!callback (primitive, primitive->attributes[i], user_data))
       break;
 }
+
+void
+_cogl_primitive_draw (CoglPrimitive *primitive,
+                      CoglFramebuffer *framebuffer,
+                      CoglPipeline *pipeline,
+                      CoglDrawFlags flags)
+{
+  if (primitive->indices)
+    _cogl_framebuffer_draw_indexed_attributes (framebuffer,
+                                               pipeline,
+                                               primitive->mode,
+                                               primitive->first_vertex,
+                                               primitive->n_vertices,
+                                               primitive->indices,
+                                               primitive->attributes,
+                                               primitive->n_attributes,
+                                               flags);
+  else
+    _cogl_framebuffer_draw_attributes (framebuffer,
+                                       pipeline,
+                                       primitive->mode,
+                                       primitive->first_vertex,
+                                       primitive->n_vertices,
+                                       primitive->attributes,
+                                       primitive->n_attributes,
+                                       flags);
+}
+
+void
+cogl_primitive_draw (CoglPrimitive *primitive,
+                     CoglFramebuffer *framebuffer,
+                     CoglPipeline *pipeline)
+{
+  _cogl_primitive_draw (primitive, framebuffer, pipeline, 0 /* flags */);
+}
diff --git a/cogl/cogl-primitive.h b/cogl/cogl-primitive.h
index 983a118..e2c7a56 100644
--- a/cogl/cogl-primitive.h
+++ b/cogl/cogl-primitive.h
@@ -38,6 +38,7 @@ typedef struct _CoglPrimitive CoglPrimitive;
 
 #include <cogl/cogl-types.h>
 #include <cogl/cogl-attribute.h>
+#include <cogl/cogl-framebuffer.h>
 
 COGL_BEGIN_DECLS
 
@@ -852,6 +853,30 @@ cogl_primitive_foreach_attribute (CoglPrimitive *primitive,
                                   CoglPrimitiveAttributeCallback callback,
                                   void *user_data);
 
+/**
+ * cogl_primitive_draw:
+ * @primitive: A #CoglPrimitive geometry object
+ * @framebuffer: A destination #CoglFramebuffer
+ * @pipeline: A #CoglPipeline state object
+ *
+ * Draws the given @primitive geometry to the specified destination
+ * @framebuffer using the graphics processing state described by @pipeline.
+ *
+ * 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.16
+ */
+void
+cogl_primitive_draw (CoglPrimitive *primitive,
+                     CoglFramebuffer *framebuffer,
+                     CoglPipeline *pipeline);
+
+
 COGL_END_DECLS
 
 #endif /* __COGL_PRIMITIVE_H__ */
diff --git a/cogl/cogl.symbols b/cogl/cogl.symbols
index 20109b8..591b7ee 100644
--- a/cogl/cogl.symbols
+++ b/cogl/cogl.symbols
@@ -182,7 +182,6 @@ cogl_framebuffer_clear
 cogl_framebuffer_discard_buffers
 cogl_framebuffer_draw_attributes
 cogl_framebuffer_draw_indexed_attributes
-cogl_framebuffer_draw_primitive
 cogl_framebuffer_draw_rectangle
 cogl_framebuffer_draw_rectangles
 cogl_framebuffer_draw_textured_rectangle
@@ -456,6 +455,7 @@ cogl_primitive_set_first_vertex
 cogl_primitive_set_indices
 cogl_primitive_set_mode
 cogl_primitive_set_n_vertices
+cogl_primitive_draw
 
 cogl_primitive_texture_set_auto_mipmap
 
diff --git a/cogl/driver/gl/cogl-clip-stack-gl.c b/cogl/driver/gl/cogl-clip-stack-gl.c
index b198bde..f83ad6d 100644
--- a/cogl/driver/gl/cogl-clip-stack-gl.c
+++ b/cogl/driver/gl/cogl-clip-stack-gl.c
@@ -34,6 +34,7 @@
 #include "cogl-primitives-private.h"
 #include "cogl-pipeline-opengl-private.h"
 #include "cogl-clip-stack-gl-private.h"
+#include "cogl-primitive-private.h"
 
 #ifndef GL_CLIP_PLANE0
 #define GL_CLIP_PLANE0 0x3000
@@ -364,12 +365,12 @@ paint_primitive_silhouette (CoglFramebuffer *framebuffer,
                             CoglPipeline *pipeline,
                             void *user_data)
 {
-  _cogl_framebuffer_draw_primitive (framebuffer,
-                                    pipeline,
-                                    user_data,
-                                    COGL_DRAW_SKIP_JOURNAL_FLUSH |
-                                    COGL_DRAW_SKIP_PIPELINE_VALIDATION |
-                                    COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
+  _cogl_primitive_draw (user_data,
+                        framebuffer,
+                        pipeline,
+                        COGL_DRAW_SKIP_JOURNAL_FLUSH |
+                        COGL_DRAW_SKIP_PIPELINE_VALIDATION |
+                        COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
 }
 
 static void
diff --git a/doc/reference/cogl2/cogl2-sections.txt b/doc/reference/cogl2/cogl2-sections.txt
index 51fc7a5..0a20e2c 100644
--- a/doc/reference/cogl2/cogl2-sections.txt
+++ b/doc/reference/cogl2/cogl2-sections.txt
@@ -250,6 +250,7 @@ cogl_primitive_set_indices
 cogl_primitive_copy
 CoglPrimitiveAttributeCallback
 cogl_primitive_foreach_attribute
+cogl_primitive_draw
 </SECTION>
 
 <SECTION>
@@ -481,7 +482,6 @@ cogl_framebuffer_set_dither_enabled
 cogl_framebuffer_get_dither_enabled
 
 <SUBSECTION>
-cogl_framebuffer_draw_primitive
 cogl_framebuffer_draw_attributes
 cogl_framebuffer_vdraw_attributes
 cogl_framebuffer_draw_indexed_attributes
diff --git a/examples/cogl-crate.c b/examples/cogl-crate.c
index 3caa37c..9c22be7 100644
--- a/examples/cogl-crate.c
+++ b/examples/cogl-crate.c
@@ -115,7 +115,7 @@ paint (Data *data)
   cogl_framebuffer_rotate (fb, rotation, 0, 1, 0);
   cogl_framebuffer_rotate (fb, rotation, 1, 0, 0);
 
-  cogl_framebuffer_draw_primitive (fb, data->crate_pipeline, data->prim);
+  cogl_primitive_draw (data->prim, fb, data->crate_pipeline);
 
   cogl_framebuffer_pop_matrix (fb);
 
diff --git a/examples/cogl-emscripten-hello.c b/examples/cogl-emscripten-hello.c
index c5d083d..e969e95 100644
--- a/examples/cogl-emscripten-hello.c
+++ b/examples/cogl-emscripten-hello.c
@@ -30,7 +30,7 @@ redraw (Data *data)
   cogl_framebuffer_push_matrix (fb);
   cogl_framebuffer_translate (fb, data->center_x, -data->center_y, 0.0f);
 
-  cogl_framebuffer_draw_primitive (fb, data->pipeline, data->triangle);
+  cogl_primitive_draw (data->triangle, fb, data->pipeline);
   cogl_framebuffer_pop_matrix (fb);
 
   cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
diff --git a/examples/cogl-gles2-context.c b/examples/cogl-gles2-context.c
index 8093851..f696dca 100644
--- a/examples/cogl-gles2-context.c
+++ b/examples/cogl-gles2-context.c
@@ -46,7 +46,7 @@ paint_cb (void *user_data)
     cogl_pop_gles2_context (data->ctx);
 
     /* Draw scene with Cogl */
-    cogl_framebuffer_draw_primitive (data->fb, data->pipeline, data->triangle);
+    cogl_primitive_draw (data->triangle, data->fb, data->pipeline);
 
     cogl_onscreen_swap_buffers (COGL_ONSCREEN (data->fb));
 
diff --git a/examples/cogl-hello.c b/examples/cogl-hello.c
index 49f9336..602ac49 100644
--- a/examples/cogl-hello.c
+++ b/examples/cogl-hello.c
@@ -24,9 +24,9 @@ paint_cb (void *user_data)
     data->draw_ready = FALSE;
 
     cogl_framebuffer_clear4f (data->fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
-    cogl_framebuffer_draw_primitive (data->fb,
-                                     data->pipeline,
-                                     data->triangle);
+    cogl_primitive_draw (data->triangle,
+                         data->fb,
+                         data->pipeline);
     cogl_onscreen_swap_buffers (COGL_ONSCREEN (data->fb));
 
     return G_SOURCE_REMOVE;
diff --git a/examples/cogl-msaa.c b/examples/cogl-msaa.c
index 5e13e29..2c527b8 100644
--- a/examples/cogl-msaa.c
+++ b/examples/cogl-msaa.c
@@ -92,10 +92,10 @@ main (int argc, char **argv)
         cogl_framebuffer_push_matrix (fb);
         cogl_framebuffer_scale (fb, 0.5, 1, 1);
         cogl_framebuffer_translate (fb, -1, 0, 0);
-        cogl_framebuffer_draw_primitive (fb, pipeline, triangle);
+        cogl_primitive_draw (triangle, fb, pipeline);
         cogl_framebuffer_pop_matrix (fb);
 
-        cogl_framebuffer_draw_primitive (fb, pipeline, triangle);
+        cogl_primitive_draw (triangle, fb, pipeline);
         cogl_framebuffer_resolve_samples (offscreen_fb);
 
         texture_pipeline = cogl_pipeline_new (ctx);
diff --git a/examples/cogl-sdl-hello.c b/examples/cogl-sdl-hello.c
index ef0d08d..3d656e3 100644
--- a/examples/cogl-sdl-hello.c
+++ b/examples/cogl-sdl-hello.c
@@ -26,7 +26,7 @@ redraw (Data *data)
   cogl_framebuffer_push_matrix (fb);
   cogl_framebuffer_translate (fb, data->center_x, -data->center_y, 0.0f);
 
-  cogl_framebuffer_draw_primitive (fb, data->pipeline, data->triangle);
+  cogl_primitive_draw (data->triangle, fb, data->pipeline);
   cogl_framebuffer_pop_matrix (fb);
 
   cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
diff --git a/examples/cogl-sdl2-hello.c b/examples/cogl-sdl2-hello.c
index fb51c7f..7dfabdd 100644
--- a/examples/cogl-sdl2-hello.c
+++ b/examples/cogl-sdl2-hello.c
@@ -26,7 +26,7 @@ redraw (Data *data)
   cogl_framebuffer_push_matrix (fb);
   cogl_framebuffer_translate (fb, data->center_x, -data->center_y, 0.0f);
 
-  cogl_framebuffer_draw_primitive (fb, data->pipeline, data->triangle);
+  cogl_primitive_draw (data->triangle, fb, data->pipeline);
   cogl_framebuffer_pop_matrix (fb);
 
   cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
diff --git a/examples/cogl-x11-foreign.c b/examples/cogl-x11-foreign.c
index cdc2c88..e3ee8fc 100644
--- a/examples/cogl-x11-foreign.c
+++ b/examples/cogl-x11-foreign.c
@@ -188,7 +188,7 @@ main (int argc, char **argv)
                                    poll_fds, n_poll_fds);
 
       cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
-      cogl_framebuffer_draw_primitive (fb, pipeline, triangle);
+      cogl_primitive_draw (triangle, fb, pipeline);
       cogl_onscreen_swap_buffers (onscreen);
     }
 
diff --git a/examples/cogland.c b/examples/cogland.c
index 0d8e27d..82876c2 100644
--- a/examples/cogland.c
+++ b/examples/cogland.c
@@ -390,8 +390,8 @@ paint_cb (void *user_data)
 
       cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
 
-      cogl_framebuffer_draw_primitive (fb, compositor->triangle_pipeline,
-                                       compositor->triangle);
+      cogl_primitive_draw (compositor->triangle,
+                           fb, compositor->triangle_pipeline);
 
       for (l2 = compositor->surfaces; l2; l2 = l2->next)
         {
diff --git a/tests/conform/test-blend.c b/tests/conform/test-blend.c
index e67f11b..3c6235b 100644
--- a/tests/conform/test-blend.c
+++ b/tests/conform/test-blend.c
@@ -41,8 +41,8 @@ paint (void)
    * primitive will be drawn with blending still disabled.
    */
 
-  cogl_framebuffer_draw_primitive (test_fb, pipeline, tri0);
-  cogl_framebuffer_draw_primitive (test_fb, pipeline, tri1);
+  cogl_primitive_draw (tri0, test_fb, pipeline);
+  cogl_primitive_draw (tri1, test_fb, pipeline);
 
   test_utils_check_pixel_and_alpha (test_fb,
                                     half_width + 5,
diff --git a/tests/conform/test-point-size-attribute.c b/tests/conform/test-point-size-attribute.c
index 81cae95..a08d1da 100644
--- a/tests/conform/test-point-size-attribute.c
+++ b/tests/conform/test-point-size-attribute.c
@@ -122,7 +122,7 @@ do_test (const char *attribute_name,
   cogl_pipeline_set_per_vertex_point_size (pipeline, TRUE, NULL);
   if (pipeline_setup_func)
     pipeline_setup_func (pipeline);
-  cogl_framebuffer_draw_primitive (test_fb, pipeline, primitive);
+  cogl_primitive_draw (primitive, test_fb, pipeline);
   cogl_object_unref (pipeline);
   cogl_object_unref (primitive);
 
diff --git a/tests/conform/test-point-size.c b/tests/conform/test-point-size.c
index 01d126e..49d0833 100644
--- a/tests/conform/test-point-size.c
+++ b/tests/conform/test-point-size.c
@@ -79,9 +79,7 @@ test_point_size (void)
 
       cogl_pipeline_set_point_size (pipeline, point_size);
       cogl_pipeline_set_color4ub (pipeline, 0, 255, 0, 255);
-      cogl_framebuffer_draw_primitive (test_fb,
-                                       pipeline,
-                                       prim);
+      cogl_primitive_draw (prim, test_fb, pipeline);
 
       cogl_object_unref (prim);
       cogl_object_unref (pipeline);
diff --git a/tests/conform/test-point-sprite.c b/tests/conform/test-point-sprite.c
index 737138f..797673d 100644
--- a/tests/conform/test-point-sprite.c
+++ b/tests/conform/test-point-sprite.c
@@ -81,9 +81,7 @@ do_test (CoglBool check_orientation)
                                   1, /* n_vertices */
                                   &point);
 
-  cogl_framebuffer_draw_primitive (test_fb,
-                                   pipeline,
-                                   prim);
+  cogl_primitive_draw (prim, test_fb, pipeline);
 
   /* Render the primitive again without point sprites to make sure
      disabling it works */
@@ -99,9 +97,7 @@ do_test (CoglBool check_orientation)
                               POINT_SIZE * 2, /* x */
                               0.0f, /* y */
                               0.0f /* z */);
-  cogl_framebuffer_draw_primitive (test_fb,
-                                   solid_pipeline,
-                                   prim);
+  cogl_primitive_draw (prim, test_fb, solid_pipeline);
   cogl_framebuffer_pop_matrix (test_fb);
 
   cogl_object_unref (prim);
diff --git a/tests/conform/test-primitive-and-journal.c b/tests/conform/test-primitive-and-journal.c
index a69afe2..f978cd5 100644
--- a/tests/conform/test-primitive-and-journal.c
+++ b/tests/conform/test-primitive-and-journal.c
@@ -81,9 +81,7 @@ test_primitive_and_journal (void)
   cogl_framebuffer_push_rectangle_clip (test_fb,
                                         0, 50, 300, 100);
 
-  cogl_framebuffer_draw_primitive (test_fb,
-                                   pipeline,
-                                   primitives[0]);
+  cogl_primitive_draw (primitives[0], test_fb, pipeline);
 
   /* Draw a rectangle using the journal in-between the two primitives.
    * This should test that the journal gets flushed correctly and that
@@ -94,9 +92,7 @@ test_primitive_and_journal (void)
                                    100, 0, /* x1/y1 */
                                    300, 100 /* x2/y2 */);
 
-  cogl_framebuffer_draw_primitive (test_fb,
-                                   pipeline,
-                                   primitives[1]);
+  cogl_primitive_draw (primitives[1], test_fb, pipeline);
 
   /* Check the three rectangles */
   test_utils_check_region (test_fb,
diff --git a/tests/conform/test-primitive.c b/tests/conform/test-primitive.c
index 3d5bdc3..45166a8 100644
--- a/tests/conform/test-primitive.c
+++ b/tests/conform/test-primitive.c
@@ -195,7 +195,7 @@ test_paint (TestState *state)
 
       cogl_framebuffer_push_matrix (test_fb);
       cogl_framebuffer_translate (test_fb, i * 10, 0, 0);
-      cogl_framebuffer_draw_primitive (test_fb, pipeline, prim);
+      cogl_primitive_draw (prim, test_fb, pipeline);
       cogl_framebuffer_pop_matrix (test_fb);
 
       test_utils_check_pixel (test_fb, i * 10 + 2, 2, expected_color);
diff --git a/tests/conform/test-texture-3d.c b/tests/conform/test-texture-3d.c
index 3891c31..a52c55c 100644
--- a/tests/conform/test-texture-3d.c
+++ b/tests/conform/test-texture-3d.c
@@ -156,7 +156,7 @@ draw_frame (TestState *state)
                                                           TEX_DEPTH),
                               6 * TEX_DEPTH);
 
-  cogl_framebuffer_draw_primitive (test_fb, pipeline, primitive);
+  cogl_primitive_draw (primitive, test_fb, pipeline);
 
   g_free (verts);
 


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