mirror of
https://github.com/brl/mutter.git
synced 2025-08-05 16:14:51 +00:00
vertex-array: Adds data arg for _vertex_array_new()
This adds an optional data argument for cogl_vertex_array_new() since it seems that mostly every case where we use this API we follow up with a cogl_buffer_set_data() matching the size of the new array. This simplifies all those cases and whenever we want to delay uploading of data then NULL can simply be passed.
This commit is contained in:
@@ -38,7 +38,7 @@ static void _cogl_vertex_array_free (CoglVertexArray *array);
|
||||
COGL_BUFFER_DEFINE (VertexArray, vertex_array);
|
||||
|
||||
CoglVertexArray *
|
||||
cogl_vertex_array_new (gsize bytes)
|
||||
cogl_vertex_array_new (gsize bytes, const void *data)
|
||||
{
|
||||
CoglVertexArray *array = g_slice_new (CoglVertexArray);
|
||||
gboolean use_malloc;
|
||||
@@ -56,7 +56,14 @@ cogl_vertex_array_new (gsize bytes)
|
||||
COGL_BUFFER_USAGE_HINT_VERTEX_ARRAY,
|
||||
COGL_BUFFER_UPDATE_HINT_STATIC);
|
||||
|
||||
return _cogl_vertex_array_object_new (array);
|
||||
_cogl_vertex_array_object_new (array);
|
||||
|
||||
if (data)
|
||||
cogl_buffer_set_data (COGL_BUFFER (array),
|
||||
0,
|
||||
data,
|
||||
bytes);
|
||||
return array;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user