[cogl] primitive: Adds _cogl_primitive_draw api taking flags
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] primitive: Adds _cogl_primitive_draw api taking flags
- Date: Tue, 1 Nov 2011 12:07:41 +0000 (UTC)
commit 7a834cf68154caec28b997b0d30ca03d6fdd8fcf
Author: Robert Bragg <robert linux intel com>
Date: Tue Oct 25 18:45:16 2011 +0100
primitive: Adds _cogl_primitive_draw api taking flags
This adds an internal _cogl_primitive_draw API that takes CoglDrawFlags
like _cogl_draw_attributes does which allows us to draw a primitive but
skip things like flushing journals, flushing framebuffer state and avoid
validating the current pipeline. This allows us to draw primitives in
places that could otherwise cause recursion.
Reviewed-by: Neil Roberts <neil linux intel com>
cogl/cogl-primitive-private.h | 5 +++++
cogl/cogl-primitive.c | 35 ++++++++++++++++++++++-------------
2 files changed, 27 insertions(+), 13 deletions(-)
---
diff --git a/cogl/cogl-primitive-private.h b/cogl/cogl-primitive-private.h
index 3deb1e7..c3fd991 100644
--- a/cogl/cogl-primitive-private.h
+++ b/cogl/cogl-primitive-private.h
@@ -30,6 +30,7 @@
#include "cogl-object-private.h"
#include "cogl-attribute-buffer-private.h"
+#include "cogl-attribute-private.h"
struct _CoglPrimitive
{
@@ -55,5 +56,9 @@ _cogl_primitive_immutable_ref (CoglPrimitive *primitive);
void
_cogl_primitive_immutable_unref (CoglPrimitive *primitive);
+void
+_cogl_primitive_draw (CoglPrimitive *primitive,
+ CoglDrawFlags flags);
+
#endif /* __COGL_PRIMITIVE_PRIVATE_H */
diff --git a/cogl/cogl-primitive.c b/cogl/cogl-primitive.c
index 145bc8b..cba40ff 100644
--- a/cogl/cogl-primitive.c
+++ b/cogl/cogl-primitive.c
@@ -550,21 +550,30 @@ _cogl_primitive_immutable_unref (CoglPrimitive *primitive)
_cogl_attribute_immutable_unref (primitive->attributes[i]);
}
-/* XXX: cogl_draw_primitive() ? */
void
-cogl_primitive_draw (CoglPrimitive *primitive)
+_cogl_primitive_draw (CoglPrimitive *primitive,
+ CoglDrawFlags flags)
{
if (primitive->indices)
- cogl_draw_indexed_attributes (primitive->mode,
- primitive->first_vertex,
- primitive->n_vertices,
- primitive->indices,
- primitive->attributes,
- primitive->n_attributes);
+ _cogl_draw_indexed_attributes (primitive->mode,
+ primitive->first_vertex,
+ primitive->n_vertices,
+ primitive->indices,
+ primitive->attributes,
+ primitive->n_attributes,
+ flags);
else
- cogl_draw_attributes (primitive->mode,
- primitive->first_vertex,
- primitive->n_vertices,
- primitive->attributes,
- primitive->n_attributes);
+ _cogl_draw_attributes (primitive->mode,
+ primitive->first_vertex,
+ primitive->n_vertices,
+ primitive->attributes,
+ primitive->n_attributes,
+ flags);
+}
+
+/* XXX: cogl_draw_primitive() ? */
+void
+cogl_primitive_draw (CoglPrimitive *primitive)
+{
+ _cogl_primitive_draw (primitive, 0 /* no flags */);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]