mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
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>
This commit is contained in:
parent
fd2769f7e8
commit
7a834cf681
@ -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 */
|
||||
|
||||
|
@ -550,21 +550,30 @@ _cogl_primitive_immutable_unref (CoglPrimitive *primitive)
|
||||
_cogl_attribute_immutable_unref (primitive->attributes[i]);
|
||||
}
|
||||
|
||||
void
|
||||
_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,
|
||||
flags);
|
||||
else
|
||||
_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)
|
||||
{
|
||||
if (primitive->indices)
|
||||
cogl_draw_indexed_attributes (primitive->mode,
|
||||
primitive->first_vertex,
|
||||
primitive->n_vertices,
|
||||
primitive->indices,
|
||||
primitive->attributes,
|
||||
primitive->n_attributes);
|
||||
else
|
||||
cogl_draw_attributes (primitive->mode,
|
||||
primitive->first_vertex,
|
||||
primitive->n_vertices,
|
||||
primitive->attributes,
|
||||
primitive->n_attributes);
|
||||
_cogl_primitive_draw (primitive, 0 /* no flags */);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user