From e9f721216e4f7974912b58480e8ca001c82a270a Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Tue, 9 Jul 2013 23:47:29 +0100 Subject: [PATCH] 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 (cherry picked from commit 418912b93ff81a47f9b38114d05335ab76277c48) Conflicts: cogl-pango/cogl-pango-display-list.c cogl/Makefile.am cogl/cogl-framebuffer.c cogl/cogl-pipeline-layer-state.h cogl/cogl2-path.c cogl/driver/gl/cogl-clip-stack-gl.c --- cogl-pango/cogl-pango-display-list.c | 6 ++-- cogl/cogl-bitmap.h | 6 ++-- cogl/cogl-enum-types.c.in | 6 ++++ cogl/cogl-framebuffer-private.h | 6 ---- cogl/cogl-framebuffer.c | 31 ++-------------- cogl/cogl-framebuffer.h | 24 ++++++------- cogl/cogl-pixel-buffer.h | 6 ++-- cogl/cogl-primitive-private.h | 3 ++ cogl/cogl-primitive.c | 36 +++++++++++++++++++ cogl/cogl-primitive.h | 25 +++++++++++++ cogl/cogl-vertex-buffer.c | 9 ++--- cogl/cogl.symbols | 2 +- cogl/driver/gl/cogl-clip-stack-gl.c | 15 ++++---- .../cogl-2.0-experimental-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 +- 30 files changed, 133 insertions(+), 100 deletions(-) diff --git a/cogl-pango/cogl-pango-display-list.c b/cogl-pango/cogl-pango-display-list.c index 6a88befca..e9bb684f3 100644 --- a/cogl-pango/cogl-pango-display-list.c +++ b/cogl-pango/cogl-pango-display-list.c @@ -373,9 +373,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 diff --git a/cogl/cogl-bitmap.h b/cogl/cogl-bitmap.h index 4d3eec376..3efe612d3 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 #include #include @@ -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-enum-types.c.in b/cogl/cogl-enum-types.c.in index a77911b9e..a08711ba2 100644 --- a/cogl/cogl-enum-types.c.in +++ b/cogl/cogl-enum-types.c.in @@ -3,6 +3,12 @@ #include "config.h" #endif +/* We need to undefine this so that we will be sure to include + * cogl-path.h instead of cogl2-path.h when we include the framebuffer + * header. Otherwise it will include both headers and it won't + * compile. */ +#undef COGL_ENABLE_EXPERIMENTAL_2_0_API + #include "cogl-enum-types.h" /*** END file-header ***/ diff --git a/cogl/cogl-framebuffer-private.h b/cogl/cogl-framebuffer-private.h index 94310c545..a220de9cf 100644 --- a/cogl/cogl-framebuffer-private.h +++ b/cogl/cogl-framebuffer-private.h @@ -406,12 +406,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 d9ec88d18..bbf837bdf 100644 --- a/cogl/cogl-framebuffer.c +++ b/cogl/cogl-framebuffer.c @@ -2554,40 +2554,13 @@ cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer, COGL_DRAW_SKIP_LEGACY_STATE); } -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, - COGL_DRAW_SKIP_LEGACY_STATE); + _cogl_primitive_draw (primitive, framebuffer, pipeline, + COGL_DRAW_SKIP_LEGACY_STATE); } void diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h index e3fdb1211..760770c93 100644 --- a/cogl/cogl-framebuffer.h +++ b/cogl/cogl-framebuffer.h @@ -32,6 +32,11 @@ #include #endif /* COGL_HAS_WIN32_SUPPORT */ +/* We forward declare the CoglFramebuffer type here to avoid some circular + * dependency issues with the following headers. + */ +typedef struct _CoglFramebuffer CoglFramebuffer; + #ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API #include #else @@ -87,8 +92,6 @@ COGL_BEGIN_DECLS * configuration. */ -typedef struct _CoglFramebuffer CoglFramebuffer; - #ifdef COGL_ENABLE_EXPERIMENTAL_API #define COGL_FRAMEBUFFER(X) ((CoglFramebuffer *)(X)) @@ -1387,9 +1390,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. * @@ -1454,10 +1456,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. * * This api can not currently handle multiple high-level meta * texture layers. The first layer may be a high level meta texture @@ -1562,9 +1563,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-pixel-buffer.h b/cogl/cogl-pixel-buffer.h index 09ee5e9fa..de52ad1d5 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 #include @@ -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 9d03a6bf6..d9103c24a 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 6f3a40e2e..580f4b87d 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 #include @@ -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 f1f44985c..3aa3f12dd 100644 --- a/cogl/cogl-primitive.h +++ b/cogl/cogl-primitive.h @@ -38,6 +38,7 @@ typedef struct _CoglPrimitive CoglPrimitive; #include /* for CoglVerticesMode */ #include +#include COGL_BEGIN_DECLS @@ -860,6 +861,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-vertex-buffer.c b/cogl/cogl-vertex-buffer.c index 74b31333d..20f327fdf 100644 --- a/cogl/cogl-vertex-buffer.c +++ b/cogl/cogl-vertex-buffer.c @@ -105,6 +105,7 @@ #include "cogl-pipeline-private.h" #include "cogl-primitives.h" #include "cogl-framebuffer-private.h" +#include "cogl-primitive-private.h" #include "cogl-journal-private.h" #include "cogl1-context.h" @@ -1627,10 +1628,10 @@ update_primitive_and_draw (CoglVertexBuffer *buffer, * to enable it) */ cogl_push_source (pipeline_priv->real_source); - _cogl_framebuffer_draw_primitive (cogl_get_draw_framebuffer (), - pipeline_priv->real_source, - buffer->primitive, - 0 /* no draw flags */); + _cogl_primitive_draw (buffer->primitive, + cogl_get_draw_framebuffer (), + pipeline_priv->real_source, + 0 /* no draw flags */); cogl_pop_source (); } diff --git a/cogl/cogl.symbols b/cogl/cogl.symbols index c74f667e7..100fa6d87 100644 --- a/cogl/cogl.symbols +++ b/cogl/cogl.symbols @@ -228,7 +228,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 @@ -684,6 +683,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 e44025653..6bdcb075f 100644 --- a/cogl/driver/gl/cogl-clip-stack-gl.c +++ b/cogl/driver/gl/cogl-clip-stack-gl.c @@ -35,6 +35,7 @@ #include "cogl-pipeline-opengl-private.h" #include "cogl-path-private.h" #include "cogl-clip-stack-gl-private.h" +#include "cogl-primitive-private.h" #ifndef GL_CLIP_PLANE0 #define GL_CLIP_PLANE0 0x3000 @@ -400,13 +401,13 @@ 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_DRAW_SKIP_LEGACY_STATE); + _cogl_primitive_draw (user_data, + framebuffer, + pipeline, + COGL_DRAW_SKIP_JOURNAL_FLUSH | + COGL_DRAW_SKIP_PIPELINE_VALIDATION | + COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH | + COGL_DRAW_SKIP_LEGACY_STATE); } static void 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 5b5c6ef08..c27a81e4e 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 @@ -298,6 +298,7 @@ cogl_primitive_set_indices cogl_primitive_copy CoglPrimitiveAttributeCallback cogl_primitive_foreach_attribute +cogl_primitive_draw
@@ -541,7 +542,6 @@ cogl_framebuffer_set_dither_enabled cogl_framebuffer_get_dither_enabled -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 f3a412f4d..acba1e565 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 c5d083d8e..e969e95d4 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 8093851f7..f696dcae1 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 49f9336de..602ac4915 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 ea5ce8fc0..b498c42cc 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 ef0d08d79..3d656e3dd 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 fb51c7fad..7dfabdd59 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 1622266c6..01a47e3e9 100644 --- a/examples/cogl-x11-foreign.c +++ b/examples/cogl-x11-foreign.c @@ -195,7 +195,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 4c0c27f52..3d7c5538e 100644 --- a/examples/cogland.c +++ b/examples/cogland.c @@ -392,8 +392,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 e67f11b09..3c6235b5f 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 81cae95bb..a08d1daa9 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 2ab515007..3c3af0f5e 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 99372fba7..ac9075cd1 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 a69afe216..f978cd5ee 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 0d4d35354..57747e8be 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 97c47cf4d..894477f71 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);