mirror of
https://github.com/brl/mutter.git
synced 2024-12-03 05:10:40 -05:00
Don't pass around NULL terminated CoglAttribute arrays
For the first iteration of the CoglAttribute API several of the new functions accepted a pointer to a NULL terminated list of CoglAttribute pointers - probably as a way to reduce the number of arguments required. This style isn't consistent with existing Cogl APIs though and so we now explicitly pass n_attributes arguments and don't require the NULL termination.
This commit is contained in:
parent
bf7653ac93
commit
3c1e83c7f5
@ -82,18 +82,20 @@ void
|
|||||||
_cogl_attribute_immutable_unref (CoglAttribute *attribute);
|
_cogl_attribute_immutable_unref (CoglAttribute *attribute);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_draw_attributes_array (CoglVerticesMode mode,
|
_cogl_draw_attributes (CoglVerticesMode mode,
|
||||||
int first_vertex,
|
int first_vertex,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
CoglAttribute **attributes,
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes,
|
||||||
CoglDrawFlags flags);
|
CoglDrawFlags flags);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_draw_indexed_attributes_array (CoglVerticesMode mode,
|
_cogl_draw_indexed_attributes (CoglVerticesMode mode,
|
||||||
int first_vertex,
|
int first_vertex,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
CoglIndices *indices,
|
CoglIndices *indices,
|
||||||
CoglAttribute **attributes,
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes,
|
||||||
CoglDrawFlags flags);
|
CoglDrawFlags flags);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -478,6 +478,7 @@ set_enabled_arrays (CoglBitmask *value_cache,
|
|||||||
static CoglHandle
|
static CoglHandle
|
||||||
enable_gl_state (CoglDrawFlags flags,
|
enable_gl_state (CoglDrawFlags flags,
|
||||||
CoglAttribute **attributes,
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes,
|
||||||
ValidateLayerState *state)
|
ValidateLayerState *state)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||||
@ -504,7 +505,7 @@ enable_gl_state (CoglDrawFlags flags,
|
|||||||
/* Iterate the attributes to work out whether blending needs to be
|
/* Iterate the attributes to work out whether blending needs to be
|
||||||
enabled and how many texture coords there are. We need to do this
|
enabled and how many texture coords there are. We need to do this
|
||||||
before flushing the pipeline. */
|
before flushing the pipeline. */
|
||||||
for (i = 0; attributes[i]; i++)
|
for (i = 0; i < n_attributes; i++)
|
||||||
switch (attributes[i]->name_id)
|
switch (attributes[i]->name_id)
|
||||||
{
|
{
|
||||||
case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY:
|
case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY:
|
||||||
@ -595,7 +596,7 @@ enable_gl_state (CoglDrawFlags flags,
|
|||||||
pipeline is flushed because on GLES2 that is the only point when
|
pipeline is flushed because on GLES2 that is the only point when
|
||||||
we can determine the attribute locations */
|
we can determine the attribute locations */
|
||||||
|
|
||||||
for (i = 0; attributes[i]; i++)
|
for (i = 0; i < n_attributes; i++)
|
||||||
{
|
{
|
||||||
CoglAttribute *attribute = attributes[i];
|
CoglAttribute *attribute = attributes[i];
|
||||||
CoglAttributeBuffer *attribute_buffer;
|
CoglAttributeBuffer *attribute_buffer;
|
||||||
@ -767,6 +768,7 @@ _cogl_attribute_disable_cached_arrays (void)
|
|||||||
* just disable the things not needed after enabling state. */
|
* just disable the things not needed after enabling state. */
|
||||||
static void
|
static void
|
||||||
disable_gl_state (CoglAttribute **attributes,
|
disable_gl_state (CoglAttribute **attributes,
|
||||||
|
int n_attributes,
|
||||||
CoglPipeline *source)
|
CoglPipeline *source)
|
||||||
{
|
{
|
||||||
#ifdef MAY_HAVE_PROGRAMABLE_GL
|
#ifdef MAY_HAVE_PROGRAMABLE_GL
|
||||||
@ -779,7 +781,7 @@ disable_gl_state (CoglAttribute **attributes,
|
|||||||
if (G_UNLIKELY (source != cogl_get_source ()))
|
if (G_UNLIKELY (source != cogl_get_source ()))
|
||||||
cogl_object_unref (source);
|
cogl_object_unref (source);
|
||||||
|
|
||||||
for (i = 0; attributes[i]; i++)
|
for (i = 0; i < n_attributes; i++)
|
||||||
{
|
{
|
||||||
CoglAttribute *attribute = attributes[i];
|
CoglAttribute *attribute = attributes[i];
|
||||||
|
|
||||||
@ -995,17 +997,18 @@ draw_wireframe (CoglVerticesMode mode,
|
|||||||
int first_vertex,
|
int first_vertex,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
CoglAttribute **attributes,
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes,
|
||||||
CoglIndices *indices)
|
CoglIndices *indices)
|
||||||
{
|
{
|
||||||
CoglAttribute *position = NULL;
|
CoglAttribute *position = NULL;
|
||||||
int i;
|
int i;
|
||||||
int n_line_vertices;
|
int n_line_vertices;
|
||||||
static CoglPipeline *wire_pipeline;
|
static CoglPipeline *wire_pipeline;
|
||||||
CoglAttribute *wire_attribute[2];
|
CoglAttribute *wire_attribute[1];
|
||||||
CoglVertexP3 *lines;
|
CoglVertexP3 *lines;
|
||||||
CoglAttributeBuffer *attribute_buffer;
|
CoglAttributeBuffer *attribute_buffer;
|
||||||
|
|
||||||
for (i = 0; attributes[i]; i++)
|
for (i = 0; i < n_attributes; i++)
|
||||||
{
|
{
|
||||||
if (strcmp (attributes[i]->name, "cogl_position_in") == 0)
|
if (strcmp (attributes[i]->name, "cogl_position_in") == 0)
|
||||||
{
|
{
|
||||||
@ -1030,7 +1033,6 @@ draw_wireframe (CoglVerticesMode mode,
|
|||||||
0,
|
0,
|
||||||
3,
|
3,
|
||||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||||
wire_attribute[1] = NULL;
|
|
||||||
cogl_object_unref (attribute_buffer);
|
cogl_object_unref (attribute_buffer);
|
||||||
|
|
||||||
if (!wire_pipeline)
|
if (!wire_pipeline)
|
||||||
@ -1044,10 +1046,11 @@ draw_wireframe (CoglVerticesMode mode,
|
|||||||
|
|
||||||
/* temporarily disable the wireframe to avoid recursion! */
|
/* temporarily disable the wireframe to avoid recursion! */
|
||||||
COGL_DEBUG_CLEAR_FLAG (COGL_DEBUG_WIREFRAME);
|
COGL_DEBUG_CLEAR_FLAG (COGL_DEBUG_WIREFRAME);
|
||||||
_cogl_draw_attributes_array (COGL_VERTICES_MODE_LINES,
|
_cogl_draw_attributes (COGL_VERTICES_MODE_LINES,
|
||||||
0,
|
0,
|
||||||
n_line_vertices,
|
n_line_vertices,
|
||||||
wire_attribute,
|
wire_attribute,
|
||||||
|
1,
|
||||||
COGL_DRAW_SKIP_JOURNAL_FLUSH |
|
COGL_DRAW_SKIP_JOURNAL_FLUSH |
|
||||||
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
|
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
|
||||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
|
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
|
||||||
@ -1096,10 +1099,11 @@ flush_state (CoglDrawFlags flags,
|
|||||||
* skipping the implicit journal flush, the framebuffer flush and
|
* skipping the implicit journal flush, the framebuffer flush and
|
||||||
* pipeline validation. */
|
* pipeline validation. */
|
||||||
void
|
void
|
||||||
_cogl_draw_attributes_array (CoglVerticesMode mode,
|
_cogl_draw_attributes (CoglVerticesMode mode,
|
||||||
int first_vertex,
|
int first_vertex,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
CoglAttribute **attributes,
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes,
|
||||||
CoglDrawFlags flags)
|
CoglDrawFlags flags)
|
||||||
{
|
{
|
||||||
ValidateLayerState state;
|
ValidateLayerState state;
|
||||||
@ -1107,33 +1111,36 @@ _cogl_draw_attributes_array (CoglVerticesMode mode,
|
|||||||
|
|
||||||
flush_state (flags, &state);
|
flush_state (flags, &state);
|
||||||
|
|
||||||
source = enable_gl_state (flags, attributes, &state);
|
source = enable_gl_state (flags, attributes, n_attributes, &state);
|
||||||
|
|
||||||
GE (glDrawArrays ((GLenum)mode, first_vertex, n_vertices));
|
GE (glDrawArrays ((GLenum)mode, first_vertex, n_vertices));
|
||||||
|
|
||||||
/* FIXME: we shouldn't be disabling state after drawing we should
|
/* FIXME: we shouldn't be disabling state after drawing we should
|
||||||
* just disable the things not needed after enabling state. */
|
* just disable the things not needed after enabling state. */
|
||||||
disable_gl_state (attributes, source);
|
disable_gl_state (attributes, n_attributes, source);
|
||||||
|
|
||||||
#ifdef COGL_ENABLE_DEBUG
|
#ifdef COGL_ENABLE_DEBUG
|
||||||
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME)))
|
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME)))
|
||||||
draw_wireframe (mode, first_vertex, n_vertices, attributes, NULL);
|
draw_wireframe (mode, first_vertex, n_vertices,
|
||||||
|
attributes, n_attributes, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_draw_attributes_array (CoglVerticesMode mode,
|
cogl_draw_attributes (CoglVerticesMode mode,
|
||||||
int first_vertex,
|
int first_vertex,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
CoglAttribute **attributes)
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes)
|
||||||
{
|
{
|
||||||
_cogl_draw_attributes_array (mode, first_vertex,
|
_cogl_draw_attributes (mode, first_vertex,
|
||||||
n_vertices, attributes,
|
n_vertices,
|
||||||
|
attributes, n_attributes,
|
||||||
0 /* no flags */);
|
0 /* no flags */);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_draw_attributes (CoglVerticesMode mode,
|
cogl_vdraw_attributes (CoglVerticesMode mode,
|
||||||
int first_vertex,
|
int first_vertex,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
...)
|
...)
|
||||||
@ -1157,8 +1164,8 @@ cogl_draw_attributes (CoglVerticesMode mode,
|
|||||||
attributes[i] = attribute;
|
attributes[i] = attribute;
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
||||||
cogl_draw_attributes_array (mode, first_vertex, n_vertices,
|
cogl_draw_attributes (mode, first_vertex, n_vertices,
|
||||||
attributes);
|
attributes, i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
@ -1177,11 +1184,12 @@ sizeof_index_type (CoglIndicesType type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_draw_indexed_attributes_array (CoglVerticesMode mode,
|
_cogl_draw_indexed_attributes (CoglVerticesMode mode,
|
||||||
int first_vertex,
|
int first_vertex,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
CoglIndices *indices,
|
CoglIndices *indices,
|
||||||
CoglAttribute **attributes,
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes,
|
||||||
CoglDrawFlags flags)
|
CoglDrawFlags flags)
|
||||||
{
|
{
|
||||||
ValidateLayerState state;
|
ValidateLayerState state;
|
||||||
@ -1196,7 +1204,7 @@ _cogl_draw_indexed_attributes_array (CoglVerticesMode mode,
|
|||||||
|
|
||||||
flush_state (flags, &state);
|
flush_state (flags, &state);
|
||||||
|
|
||||||
source = enable_gl_state (flags, attributes, &state);
|
source = enable_gl_state (flags, attributes, n_attributes, &state);
|
||||||
|
|
||||||
buffer = COGL_BUFFER (cogl_indices_get_buffer (indices));
|
buffer = COGL_BUFFER (cogl_indices_get_buffer (indices));
|
||||||
base = _cogl_buffer_bind (buffer, COGL_BUFFER_BIND_TARGET_INDEX_BUFFER);
|
base = _cogl_buffer_bind (buffer, COGL_BUFFER_BIND_TARGET_INDEX_BUFFER);
|
||||||
@ -1225,28 +1233,31 @@ _cogl_draw_indexed_attributes_array (CoglVerticesMode mode,
|
|||||||
|
|
||||||
/* FIXME: we shouldn't be disabling state after drawing we should
|
/* FIXME: we shouldn't be disabling state after drawing we should
|
||||||
* just disable the things not needed after enabling state. */
|
* just disable the things not needed after enabling state. */
|
||||||
disable_gl_state (attributes, source);
|
disable_gl_state (attributes, n_attributes, source);
|
||||||
|
|
||||||
#ifdef COGL_ENABLE_DEBUG
|
#ifdef COGL_ENABLE_DEBUG
|
||||||
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME)))
|
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME)))
|
||||||
draw_wireframe (mode, first_vertex, n_vertices, attributes, indices);
|
draw_wireframe (mode, first_vertex, n_vertices,
|
||||||
|
attributes, n_attributes, indices);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_draw_indexed_attributes_array (CoglVerticesMode mode,
|
cogl_draw_indexed_attributes (CoglVerticesMode mode,
|
||||||
int first_vertex,
|
int first_vertex,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
CoglIndices *indices,
|
CoglIndices *indices,
|
||||||
CoglAttribute **attributes)
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes)
|
||||||
{
|
{
|
||||||
_cogl_draw_indexed_attributes_array (mode, first_vertex,
|
_cogl_draw_indexed_attributes (mode, first_vertex,
|
||||||
n_vertices, indices, attributes,
|
n_vertices, indices,
|
||||||
|
attributes, n_attributes,
|
||||||
0 /* no flags */);
|
0 /* no flags */);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_draw_indexed_attributes (CoglVerticesMode mode,
|
cogl_vdraw_indexed_attributes (CoglVerticesMode mode,
|
||||||
int first_vertex,
|
int first_vertex,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
CoglIndices *indices,
|
CoglIndices *indices,
|
||||||
@ -1271,11 +1282,12 @@ cogl_draw_indexed_attributes (CoglVerticesMode mode,
|
|||||||
attributes[i] = attribute;
|
attributes[i] = attribute;
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
||||||
cogl_draw_indexed_attributes_array (mode,
|
cogl_draw_indexed_attributes (mode,
|
||||||
first_vertex,
|
first_vertex,
|
||||||
n_vertices,
|
n_vertices,
|
||||||
indices,
|
indices,
|
||||||
attributes);
|
attributes,
|
||||||
|
n_attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -152,30 +152,32 @@ gboolean
|
|||||||
cogl_is_attribute (void *object);
|
cogl_is_attribute (void *object);
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_draw_attributes (CoglVerticesMode mode,
|
cogl_vdraw_attributes (CoglVerticesMode mode,
|
||||||
int first_vertex,
|
int first_vertex,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
...) G_GNUC_NULL_TERMINATED;
|
...) G_GNUC_NULL_TERMINATED;
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_draw_attributes_array (CoglVerticesMode mode,
|
cogl_draw_attributes (CoglVerticesMode mode,
|
||||||
int first_vertex,
|
int first_vertex,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
CoglAttribute **attributes);
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes);
|
||||||
|
|
||||||
|
void
|
||||||
|
cogl_vdraw_indexed_attributes (CoglVerticesMode mode,
|
||||||
|
int first_vertex,
|
||||||
|
int n_vertices,
|
||||||
|
CoglIndices *indices,
|
||||||
|
...) G_GNUC_NULL_TERMINATED;
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_draw_indexed_attributes (CoglVerticesMode mode,
|
cogl_draw_indexed_attributes (CoglVerticesMode mode,
|
||||||
int first_vertex,
|
int first_vertex,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
CoglIndices *indices,
|
CoglIndices *indices,
|
||||||
...) G_GNUC_NULL_TERMINATED;
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes);
|
||||||
void
|
|
||||||
cogl_draw_indexed_attributes_array (CoglVerticesMode mode,
|
|
||||||
int first_vertex,
|
|
||||||
int n_vertices,
|
|
||||||
CoglIndices *indices,
|
|
||||||
CoglAttribute **attributes);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -296,27 +296,30 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
|
|||||||
#ifdef HAVE_COGL_GL
|
#ifdef HAVE_COGL_GL
|
||||||
|
|
||||||
/* XXX: it's rather evil that we sneak in the GL_QUADS enum here... */
|
/* XXX: it's rather evil that we sneak in the GL_QUADS enum here... */
|
||||||
_cogl_draw_attributes_array (GL_QUADS,
|
_cogl_draw_attributes (GL_QUADS,
|
||||||
state->current_vertex, batch_len * 4,
|
state->current_vertex, batch_len * 4,
|
||||||
attributes,
|
attributes,
|
||||||
|
state->attributes->len,
|
||||||
draw_flags);
|
draw_flags);
|
||||||
|
|
||||||
#else /* HAVE_COGL_GL */
|
#else /* HAVE_COGL_GL */
|
||||||
if (batch_len > 1)
|
if (batch_len > 1)
|
||||||
{
|
{
|
||||||
_cogl_draw_indexed_attributes_array (COGL_VERTICES_MODE_TRIANGLES,
|
_cogl_draw_indexed_attributes (COGL_VERTICES_MODE_TRIANGLES,
|
||||||
state->current_vertex * 6 / 4,
|
state->current_vertex * 6 / 4,
|
||||||
batch_len * 6,
|
batch_len * 6,
|
||||||
state->indices,
|
state->indices,
|
||||||
attributes,
|
attributes,
|
||||||
|
state->attributes->len,
|
||||||
draw_flags);
|
draw_flags);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_cogl_draw_attributes_array (COGL_VERTICES_MODE_TRIANGLE_FAN,
|
_cogl_draw_attributes (COGL_VERTICES_MODE_TRIANGLE_FAN,
|
||||||
state->current_vertex, 4,
|
state->current_vertex, 4,
|
||||||
attributes,
|
attributes,
|
||||||
|
state->attributes->len,
|
||||||
draw_flags);
|
draw_flags);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -332,7 +335,7 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
|
|||||||
static CoglPipeline *outline = NULL;
|
static CoglPipeline *outline = NULL;
|
||||||
guint8 color_intensity;
|
guint8 color_intensity;
|
||||||
int i;
|
int i;
|
||||||
CoglAttribute *loop_attributes[2];
|
CoglAttribute *loop_attributes[1];
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctxt, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctxt, NO_RETVAL);
|
||||||
|
|
||||||
@ -358,11 +361,11 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
|
|||||||
cogl_set_source (outline);
|
cogl_set_source (outline);
|
||||||
|
|
||||||
loop_attributes[0] = attributes[0]; /* we just want the position */
|
loop_attributes[0] = attributes[0]; /* we just want the position */
|
||||||
loop_attributes[1] = NULL;
|
|
||||||
for (i = 0; i < batch_len; i++)
|
for (i = 0; i < batch_len; i++)
|
||||||
_cogl_draw_attributes_array (COGL_VERTICES_MODE_LINE_LOOP,
|
_cogl_draw_attributes (COGL_VERTICES_MODE_LINE_LOOP,
|
||||||
4 * i + state->current_vertex, 4,
|
4 * i + state->current_vertex, 4,
|
||||||
loop_attributes,
|
loop_attributes,
|
||||||
|
1,
|
||||||
draw_flags);
|
draw_flags);
|
||||||
|
|
||||||
/* Go to the next color */
|
/* Go to the next color */
|
||||||
|
@ -40,11 +40,11 @@ static void _cogl_primitive_free (CoglPrimitive *primitive);
|
|||||||
|
|
||||||
COGL_OBJECT_DEFINE (Primitive, primitive);
|
COGL_OBJECT_DEFINE (Primitive, primitive);
|
||||||
|
|
||||||
/* XXX: should we have an n_attributes arg instead of NULL terminating? */
|
|
||||||
CoglPrimitive *
|
CoglPrimitive *
|
||||||
cogl_primitive_new_with_attributes_array (CoglVerticesMode mode,
|
cogl_primitive_new_with_attributes (CoglVerticesMode mode,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
CoglAttribute **attributes)
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes)
|
||||||
{
|
{
|
||||||
CoglPrimitive *primitive = g_slice_new (CoglPrimitive);
|
CoglPrimitive *primitive = g_slice_new (CoglPrimitive);
|
||||||
int i;
|
int i;
|
||||||
@ -57,7 +57,7 @@ cogl_primitive_new_with_attributes_array (CoglVerticesMode mode,
|
|||||||
g_array_new (TRUE, FALSE, sizeof (CoglAttribute *));
|
g_array_new (TRUE, FALSE, sizeof (CoglAttribute *));
|
||||||
primitive->immutable_ref = 0;
|
primitive->immutable_ref = 0;
|
||||||
|
|
||||||
for (i = 0; attributes[i]; i++)
|
for (i = 0; i < n_attributes; i++)
|
||||||
{
|
{
|
||||||
CoglAttribute *attribute = attributes[i];
|
CoglAttribute *attribute = attributes[i];
|
||||||
cogl_object_ref (attribute);
|
cogl_object_ref (attribute);
|
||||||
@ -74,16 +74,18 @@ cogl_primitive_new_with_attributes_array (CoglVerticesMode mode,
|
|||||||
new_with_attributes that also unrefs the attributes. It is just
|
new_with_attributes that also unrefs the attributes. It is just
|
||||||
used for the builtin struct constructors */
|
used for the builtin struct constructors */
|
||||||
static CoglPrimitive *
|
static CoglPrimitive *
|
||||||
_cogl_primitive_new_with_attributes_array_unref (CoglVerticesMode mode,
|
_cogl_primitive_new_with_attributes_unref (CoglVerticesMode mode,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
CoglAttribute **attributes)
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes)
|
||||||
{
|
{
|
||||||
CoglPrimitive *primitive;
|
CoglPrimitive *primitive;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
primitive = cogl_primitive_new_with_attributes_array (mode,
|
primitive = cogl_primitive_new_with_attributes (mode,
|
||||||
n_vertices,
|
n_vertices,
|
||||||
attributes);
|
attributes,
|
||||||
|
n_attributes);
|
||||||
|
|
||||||
for (i = 0; attributes[i]; i++)
|
for (i = 0; attributes[i]; i++)
|
||||||
cogl_object_unref (attributes[i]);
|
cogl_object_unref (attributes[i]);
|
||||||
@ -115,8 +117,9 @@ cogl_primitive_new (CoglVerticesMode mode,
|
|||||||
attributes[i] = attribute;
|
attributes[i] = attribute;
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
||||||
return cogl_primitive_new_with_attributes_array (mode, n_vertices,
|
return cogl_primitive_new_with_attributes (mode, n_vertices,
|
||||||
attributes);
|
attributes,
|
||||||
|
i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglPrimitive *
|
CoglPrimitive *
|
||||||
@ -126,7 +129,7 @@ cogl_primitive_new_p2 (CoglVerticesMode mode,
|
|||||||
{
|
{
|
||||||
CoglAttributeBuffer *attribute_buffer =
|
CoglAttributeBuffer *attribute_buffer =
|
||||||
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP2), data);
|
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP2), data);
|
||||||
CoglAttribute *attributes[2];
|
CoglAttribute *attributes[1];
|
||||||
|
|
||||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||||
"cogl_position_in",
|
"cogl_position_in",
|
||||||
@ -134,12 +137,12 @@ cogl_primitive_new_p2 (CoglVerticesMode mode,
|
|||||||
offsetof (CoglVertexP2, x),
|
offsetof (CoglVertexP2, x),
|
||||||
2,
|
2,
|
||||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||||
attributes[1] = NULL;
|
|
||||||
|
|
||||||
cogl_object_unref (attribute_buffer);
|
cogl_object_unref (attribute_buffer);
|
||||||
|
|
||||||
return _cogl_primitive_new_with_attributes_array_unref (mode, n_vertices,
|
return _cogl_primitive_new_with_attributes_unref (mode, n_vertices,
|
||||||
attributes);
|
attributes,
|
||||||
|
1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglPrimitive *
|
CoglPrimitive *
|
||||||
@ -149,7 +152,7 @@ cogl_primitive_new_p3 (CoglVerticesMode mode,
|
|||||||
{
|
{
|
||||||
CoglAttributeBuffer *attribute_buffer =
|
CoglAttributeBuffer *attribute_buffer =
|
||||||
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP3), data);
|
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP3), data);
|
||||||
CoglAttribute *attributes[2];
|
CoglAttribute *attributes[1];
|
||||||
|
|
||||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||||
"cogl_position_in",
|
"cogl_position_in",
|
||||||
@ -157,12 +160,12 @@ cogl_primitive_new_p3 (CoglVerticesMode mode,
|
|||||||
offsetof (CoglVertexP3, x),
|
offsetof (CoglVertexP3, x),
|
||||||
3,
|
3,
|
||||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||||
attributes[1] = NULL;
|
|
||||||
|
|
||||||
cogl_object_unref (attribute_buffer);
|
cogl_object_unref (attribute_buffer);
|
||||||
|
|
||||||
return _cogl_primitive_new_with_attributes_array_unref (mode, n_vertices,
|
return _cogl_primitive_new_with_attributes_unref (mode, n_vertices,
|
||||||
attributes);
|
attributes,
|
||||||
|
1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglPrimitive *
|
CoglPrimitive *
|
||||||
@ -172,7 +175,7 @@ cogl_primitive_new_p2c4 (CoglVerticesMode mode,
|
|||||||
{
|
{
|
||||||
CoglAttributeBuffer *attribute_buffer =
|
CoglAttributeBuffer *attribute_buffer =
|
||||||
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP2C4), data);
|
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP2C4), data);
|
||||||
CoglAttribute *attributes[3];
|
CoglAttribute *attributes[2];
|
||||||
|
|
||||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||||
"cogl_position_in",
|
"cogl_position_in",
|
||||||
@ -186,12 +189,12 @@ cogl_primitive_new_p2c4 (CoglVerticesMode mode,
|
|||||||
offsetof (CoglVertexP2C4, r),
|
offsetof (CoglVertexP2C4, r),
|
||||||
4,
|
4,
|
||||||
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
|
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
|
||||||
attributes[2] = NULL;
|
|
||||||
|
|
||||||
cogl_object_unref (attribute_buffer);
|
cogl_object_unref (attribute_buffer);
|
||||||
|
|
||||||
return _cogl_primitive_new_with_attributes_array_unref (mode, n_vertices,
|
return _cogl_primitive_new_with_attributes_unref (mode, n_vertices,
|
||||||
attributes);
|
attributes,
|
||||||
|
2);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglPrimitive *
|
CoglPrimitive *
|
||||||
@ -201,7 +204,7 @@ cogl_primitive_new_p3c4 (CoglVerticesMode mode,
|
|||||||
{
|
{
|
||||||
CoglAttributeBuffer *attribute_buffer =
|
CoglAttributeBuffer *attribute_buffer =
|
||||||
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP3C4), data);
|
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP3C4), data);
|
||||||
CoglAttribute *attributes[3];
|
CoglAttribute *attributes[2];
|
||||||
|
|
||||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||||
"cogl_position_in",
|
"cogl_position_in",
|
||||||
@ -215,12 +218,12 @@ cogl_primitive_new_p3c4 (CoglVerticesMode mode,
|
|||||||
offsetof (CoglVertexP3C4, r),
|
offsetof (CoglVertexP3C4, r),
|
||||||
4,
|
4,
|
||||||
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
|
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
|
||||||
attributes[2] = NULL;
|
|
||||||
|
|
||||||
cogl_object_unref (attribute_buffer);
|
cogl_object_unref (attribute_buffer);
|
||||||
|
|
||||||
return _cogl_primitive_new_with_attributes_array_unref (mode, n_vertices,
|
return _cogl_primitive_new_with_attributes_unref (mode, n_vertices,
|
||||||
attributes);
|
attributes,
|
||||||
|
2);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglPrimitive *
|
CoglPrimitive *
|
||||||
@ -230,7 +233,7 @@ cogl_primitive_new_p2t2 (CoglVerticesMode mode,
|
|||||||
{
|
{
|
||||||
CoglAttributeBuffer *attribute_buffer =
|
CoglAttributeBuffer *attribute_buffer =
|
||||||
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP2T2), data);
|
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP2T2), data);
|
||||||
CoglAttribute *attributes[3];
|
CoglAttribute *attributes[2];
|
||||||
|
|
||||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||||
"cogl_position_in",
|
"cogl_position_in",
|
||||||
@ -244,12 +247,12 @@ cogl_primitive_new_p2t2 (CoglVerticesMode mode,
|
|||||||
offsetof (CoglVertexP2T2, s),
|
offsetof (CoglVertexP2T2, s),
|
||||||
2,
|
2,
|
||||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||||
attributes[2] = NULL;
|
|
||||||
|
|
||||||
cogl_object_unref (attribute_buffer);
|
cogl_object_unref (attribute_buffer);
|
||||||
|
|
||||||
return _cogl_primitive_new_with_attributes_array_unref (mode, n_vertices,
|
return _cogl_primitive_new_with_attributes_unref (mode, n_vertices,
|
||||||
attributes);
|
attributes,
|
||||||
|
2);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglPrimitive *
|
CoglPrimitive *
|
||||||
@ -259,7 +262,7 @@ cogl_primitive_new_p3t2 (CoglVerticesMode mode,
|
|||||||
{
|
{
|
||||||
CoglAttributeBuffer *attribute_buffer =
|
CoglAttributeBuffer *attribute_buffer =
|
||||||
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP3T2), data);
|
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP3T2), data);
|
||||||
CoglAttribute *attributes[3];
|
CoglAttribute *attributes[2];
|
||||||
|
|
||||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||||
"cogl_position_in",
|
"cogl_position_in",
|
||||||
@ -273,12 +276,12 @@ cogl_primitive_new_p3t2 (CoglVerticesMode mode,
|
|||||||
offsetof (CoglVertexP3T2, s),
|
offsetof (CoglVertexP3T2, s),
|
||||||
2,
|
2,
|
||||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||||
attributes[2] = NULL;
|
|
||||||
|
|
||||||
cogl_object_unref (attribute_buffer);
|
cogl_object_unref (attribute_buffer);
|
||||||
|
|
||||||
return _cogl_primitive_new_with_attributes_array_unref (mode, n_vertices,
|
return _cogl_primitive_new_with_attributes_unref (mode, n_vertices,
|
||||||
attributes);
|
attributes,
|
||||||
|
2);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglPrimitive *
|
CoglPrimitive *
|
||||||
@ -288,7 +291,7 @@ cogl_primitive_new_p2t2c4 (CoglVerticesMode mode,
|
|||||||
{
|
{
|
||||||
CoglAttributeBuffer *attribute_buffer =
|
CoglAttributeBuffer *attribute_buffer =
|
||||||
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP2T2C4), data);
|
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP2T2C4), data);
|
||||||
CoglAttribute *attributes[4];
|
CoglAttribute *attributes[3];
|
||||||
|
|
||||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||||
"cogl_position_in",
|
"cogl_position_in",
|
||||||
@ -308,12 +311,12 @@ cogl_primitive_new_p2t2c4 (CoglVerticesMode mode,
|
|||||||
offsetof (CoglVertexP2T2C4, r),
|
offsetof (CoglVertexP2T2C4, r),
|
||||||
4,
|
4,
|
||||||
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
|
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
|
||||||
attributes[3] = NULL;
|
|
||||||
|
|
||||||
cogl_object_unref (attribute_buffer);
|
cogl_object_unref (attribute_buffer);
|
||||||
|
|
||||||
return _cogl_primitive_new_with_attributes_array_unref (mode, n_vertices,
|
return _cogl_primitive_new_with_attributes_unref (mode, n_vertices,
|
||||||
attributes);
|
attributes,
|
||||||
|
3);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglPrimitive *
|
CoglPrimitive *
|
||||||
@ -323,7 +326,7 @@ cogl_primitive_new_p3t2c4 (CoglVerticesMode mode,
|
|||||||
{
|
{
|
||||||
CoglAttributeBuffer *attribute_buffer =
|
CoglAttributeBuffer *attribute_buffer =
|
||||||
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP3T2C4), data);
|
cogl_attribute_buffer_new (n_vertices * sizeof (CoglVertexP3T2C4), data);
|
||||||
CoglAttribute *attributes[4];
|
CoglAttribute *attributes[3];
|
||||||
|
|
||||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||||
"cogl_position_in",
|
"cogl_position_in",
|
||||||
@ -343,12 +346,12 @@ cogl_primitive_new_p3t2c4 (CoglVerticesMode mode,
|
|||||||
offsetof (CoglVertexP3T2C4, r),
|
offsetof (CoglVertexP3T2C4, r),
|
||||||
4,
|
4,
|
||||||
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
|
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
|
||||||
attributes[3] = NULL;
|
|
||||||
|
|
||||||
cogl_object_unref (attribute_buffer);
|
cogl_object_unref (attribute_buffer);
|
||||||
|
|
||||||
return _cogl_primitive_new_with_attributes_array_unref (mode, n_vertices,
|
return _cogl_primitive_new_with_attributes_unref (mode, n_vertices,
|
||||||
attributes);
|
attributes,
|
||||||
|
3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -389,7 +392,8 @@ warn_about_midscene_changes (void)
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_primitive_set_attributes (CoglPrimitive *primitive,
|
cogl_primitive_set_attributes (CoglPrimitive *primitive,
|
||||||
CoglAttribute **attributes)
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -404,7 +408,7 @@ cogl_primitive_set_attributes (CoglPrimitive *primitive,
|
|||||||
free_attributes_list (primitive);
|
free_attributes_list (primitive);
|
||||||
|
|
||||||
g_array_set_size (primitive->attributes, 0);
|
g_array_set_size (primitive->attributes, 0);
|
||||||
for (i = 0; attributes[i]; i++)
|
for (i = 0; i < n_attributes; i++)
|
||||||
{
|
{
|
||||||
cogl_object_ref (attributes[i]);
|
cogl_object_ref (attributes[i]);
|
||||||
g_return_if_fail (cogl_is_attribute (attributes[i]));
|
g_return_if_fail (cogl_is_attribute (attributes[i]));
|
||||||
@ -539,15 +543,17 @@ cogl_primitive_draw (CoglPrimitive *primitive)
|
|||||||
(CoglAttribute **)primitive->attributes->data;
|
(CoglAttribute **)primitive->attributes->data;
|
||||||
|
|
||||||
if (primitive->indices)
|
if (primitive->indices)
|
||||||
cogl_draw_indexed_attributes_array (primitive->mode,
|
cogl_draw_indexed_attributes (primitive->mode,
|
||||||
primitive->first_vertex,
|
primitive->first_vertex,
|
||||||
primitive->n_vertices,
|
primitive->n_vertices,
|
||||||
primitive->indices,
|
primitive->indices,
|
||||||
attributes);
|
attributes,
|
||||||
|
primitive->attributes->len);
|
||||||
else
|
else
|
||||||
cogl_draw_attributes_array (primitive->mode,
|
cogl_draw_attributes (primitive->mode,
|
||||||
primitive->first_vertex,
|
primitive->first_vertex,
|
||||||
primitive->n_vertices,
|
primitive->n_vertices,
|
||||||
attributes);
|
attributes,
|
||||||
|
primitive->attributes->len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,11 +231,11 @@ cogl_primitive_new (CoglVerticesMode mode,
|
|||||||
int n_vertices,
|
int n_vertices,
|
||||||
...);
|
...);
|
||||||
|
|
||||||
/* XXX: how about just: cogl_primitive_new_with_attributes () ? */
|
|
||||||
CoglPrimitive *
|
CoglPrimitive *
|
||||||
cogl_primitive_new_with_attributes_array (CoglVerticesMode mode,
|
cogl_primitive_new_with_attributes (CoglVerticesMode mode,
|
||||||
int n_vertices,
|
int n_vertices,
|
||||||
CoglAttribute **attributes);
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_primitive_new_p2:
|
* cogl_primitive_new_p2:
|
||||||
@ -634,7 +634,8 @@ cogl_primitive_set_mode (CoglPrimitive *primitive,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
cogl_primitive_set_attributes (CoglPrimitive *primitive,
|
cogl_primitive_set_attributes (CoglPrimitive *primitive,
|
||||||
CoglAttribute **attributes);
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -934,7 +934,7 @@ _cogl_rectangle_immediate (float x_1,
|
|||||||
x_2, y_2
|
x_2, y_2
|
||||||
};
|
};
|
||||||
CoglAttributeBuffer *attribute_buffer;
|
CoglAttributeBuffer *attribute_buffer;
|
||||||
CoglAttribute *attributes[2];
|
CoglAttribute *attributes[1];
|
||||||
|
|
||||||
attribute_buffer = cogl_attribute_buffer_new (sizeof (vertices), vertices);
|
attribute_buffer = cogl_attribute_buffer_new (sizeof (vertices), vertices);
|
||||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||||
@ -943,12 +943,12 @@ _cogl_rectangle_immediate (float x_1,
|
|||||||
0, /* offset */
|
0, /* offset */
|
||||||
2, /* n_components */
|
2, /* n_components */
|
||||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||||
attributes[1] = NULL;
|
|
||||||
|
|
||||||
_cogl_draw_attributes_array (COGL_VERTICES_MODE_TRIANGLE_STRIP,
|
_cogl_draw_attributes (COGL_VERTICES_MODE_TRIANGLE_STRIP,
|
||||||
0, /* first_index */
|
0, /* first_index */
|
||||||
4, /* n_vertices */
|
4, /* n_vertices */
|
||||||
attributes,
|
attributes,
|
||||||
|
1,
|
||||||
COGL_DRAW_SKIP_JOURNAL_FLUSH |
|
COGL_DRAW_SKIP_JOURNAL_FLUSH |
|
||||||
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
|
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
|
||||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
|
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
|
||||||
@ -1067,8 +1067,7 @@ cogl_polygon (const CoglTextureVertex *vertices,
|
|||||||
n_layers = cogl_pipeline_get_n_layers (pipeline);
|
n_layers = cogl_pipeline_get_n_layers (pipeline);
|
||||||
|
|
||||||
n_attributes = 1 + n_layers + (use_color ? 1 : 0);
|
n_attributes = 1 + n_layers + (use_color ? 1 : 0);
|
||||||
attributes = g_alloca (sizeof (CoglAttribute *) * (n_attributes + 1));
|
attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);
|
||||||
attributes[n_attributes] = NULL;
|
|
||||||
|
|
||||||
/* Our data is arranged like:
|
/* Our data is arranged like:
|
||||||
* [X, Y, Z, TX0, TY0, TX1, TY1..., R, G, B, A,...] */
|
* [X, Y, Z, TX0, TY0, TX1, TY1..., R, G, B, A,...] */
|
||||||
@ -1167,9 +1166,10 @@ cogl_polygon (const CoglTextureVertex *vertices,
|
|||||||
|
|
||||||
cogl_push_source (pipeline);
|
cogl_push_source (pipeline);
|
||||||
|
|
||||||
cogl_draw_attributes_array (COGL_VERTICES_MODE_TRIANGLE_FAN,
|
cogl_draw_attributes (COGL_VERTICES_MODE_TRIANGLE_FAN,
|
||||||
0, n_vertices,
|
0, n_vertices,
|
||||||
attributes);
|
attributes,
|
||||||
|
n_attributes);
|
||||||
|
|
||||||
cogl_pop_source ();
|
cogl_pop_source ();
|
||||||
|
|
||||||
|
@ -1165,7 +1165,7 @@ update_primitive_attributes (CoglVertexBuffer *buffer)
|
|||||||
|
|
||||||
g_return_if_fail (n_attributes > 0);
|
g_return_if_fail (n_attributes > 0);
|
||||||
|
|
||||||
attributes = g_alloca (sizeof (CoglAttribute *) * (n_attributes + 1));
|
attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (l = buffer->submitted_vbos; l; l = l->next)
|
for (l = buffer->submitted_vbos; l; l = l->next)
|
||||||
@ -1195,9 +1195,7 @@ update_primitive_attributes (CoglVertexBuffer *buffer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes[i] = NULL;
|
cogl_primitive_set_attributes (buffer->primitive, attributes, i);
|
||||||
|
|
||||||
cogl_primitive_set_attributes (buffer->primitive, attributes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -238,7 +238,7 @@ _cogl_path_stroke_nodes (CoglPath *path)
|
|||||||
{
|
{
|
||||||
node = &g_array_index (data->path_nodes, CoglPathNode, path_start);
|
node = &g_array_index (data->path_nodes, CoglPathNode, path_start);
|
||||||
|
|
||||||
cogl_draw_attributes (COGL_VERTICES_MODE_LINE_STRIP,
|
cogl_vdraw_attributes (COGL_VERTICES_MODE_LINE_STRIP,
|
||||||
0, node->path_size,
|
0, node->path_size,
|
||||||
data->stroke_attributes[path_num],
|
data->stroke_attributes[path_num],
|
||||||
NULL);
|
NULL);
|
||||||
@ -343,12 +343,12 @@ _cogl_path_fill_nodes (CoglPath *path)
|
|||||||
|
|
||||||
_cogl_path_build_fill_attribute_buffer (path);
|
_cogl_path_build_fill_attribute_buffer (path);
|
||||||
|
|
||||||
_cogl_draw_indexed_attributes_array
|
_cogl_draw_indexed_attributes (COGL_VERTICES_MODE_TRIANGLES,
|
||||||
(COGL_VERTICES_MODE_TRIANGLES,
|
|
||||||
0, /* first_vertex */
|
0, /* first_vertex */
|
||||||
path->data->fill_vbo_n_indices,
|
path->data->fill_vbo_n_indices,
|
||||||
path->data->fill_vbo_indices,
|
path->data->fill_vbo_indices,
|
||||||
path->data->fill_attributes,
|
path->data->fill_attributes,
|
||||||
|
COGL_PATH_N_ATTRIBUTES,
|
||||||
COGL_DRAW_SKIP_JOURNAL_FLUSH |
|
COGL_DRAW_SKIP_JOURNAL_FLUSH |
|
||||||
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
|
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
|
||||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
|
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
|
||||||
@ -1500,8 +1500,6 @@ _cogl_path_build_fill_attribute_buffer (CoglPath *path)
|
|||||||
G_STRUCT_OFFSET (CoglPathTesselatorVertex, s),
|
G_STRUCT_OFFSET (CoglPathTesselatorVertex, s),
|
||||||
2, /* n_components */
|
2, /* n_components */
|
||||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||||
/* NULL terminator */
|
|
||||||
data->fill_attributes[2] = NULL;
|
|
||||||
|
|
||||||
data->fill_vbo_indices = cogl_indices_new (tess.indices_type,
|
data->fill_vbo_indices = cogl_indices_new (tess.indices_type,
|
||||||
tess.indices->data,
|
tess.indices->data,
|
||||||
|
Loading…
Reference in New Issue
Block a user