cogl: Drop no longer used Indices.new_for_buffer
And drop the offset field with it as nothing sets it anymore. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4184>
This commit is contained in:
parent
aad237a04a
commit
07fa87907e
@ -41,7 +41,6 @@ struct _CoglIndices
|
||||
GObject parent_instance;
|
||||
|
||||
CoglIndexBuffer *buffer;
|
||||
size_t offset;
|
||||
|
||||
CoglIndicesType type;
|
||||
|
||||
|
@ -82,21 +82,6 @@ cogl_indices_type_get_size (CoglIndicesType type)
|
||||
g_return_val_if_reached (0);
|
||||
}
|
||||
|
||||
CoglIndices *
|
||||
cogl_indices_new_for_buffer (CoglIndicesType type,
|
||||
CoglIndexBuffer *buffer,
|
||||
size_t offset)
|
||||
{
|
||||
CoglIndices *indices = g_object_new (COGL_TYPE_INDICES, NULL);
|
||||
|
||||
indices->buffer = g_object_ref (buffer);
|
||||
indices->offset = offset;
|
||||
|
||||
indices->type = type;
|
||||
|
||||
return indices;
|
||||
}
|
||||
|
||||
CoglIndices *
|
||||
cogl_indices_new (CoglContext *context,
|
||||
CoglIndicesType type,
|
||||
@ -104,21 +89,19 @@ cogl_indices_new (CoglContext *context,
|
||||
int n_indices)
|
||||
{
|
||||
size_t buffer_bytes = cogl_indices_type_get_size (type) * n_indices;
|
||||
CoglIndexBuffer *index_buffer = cogl_index_buffer_new (context, buffer_bytes);
|
||||
CoglBuffer *buffer = COGL_BUFFER (index_buffer);
|
||||
g_autoptr (CoglIndexBuffer) index_buffer =
|
||||
cogl_index_buffer_new (context, buffer_bytes);
|
||||
CoglIndices *indices;
|
||||
|
||||
if (!cogl_buffer_set_data (buffer,
|
||||
if (!cogl_buffer_set_data (COGL_BUFFER (index_buffer),
|
||||
0,
|
||||
indices_data,
|
||||
buffer_bytes))
|
||||
{
|
||||
g_object_unref (index_buffer);
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
indices = cogl_indices_new_for_buffer (type, index_buffer, 0);
|
||||
g_object_unref (index_buffer);
|
||||
indices = g_object_new (COGL_TYPE_INDICES, NULL);
|
||||
indices->buffer = g_steal_pointer (&index_buffer);
|
||||
indices->type = type;
|
||||
|
||||
return indices;
|
||||
}
|
||||
@ -137,14 +120,6 @@ cogl_indices_get_indices_type (CoglIndices *indices)
|
||||
return indices->type;
|
||||
}
|
||||
|
||||
size_t
|
||||
cogl_indices_get_offset (CoglIndices *indices)
|
||||
{
|
||||
g_return_val_if_fail (COGL_IS_INDICES (indices), 0);
|
||||
|
||||
return indices->offset;
|
||||
}
|
||||
|
||||
CoglIndices *
|
||||
cogl_context_get_rectangle_indices (CoglContext *ctx,
|
||||
int n_rectangles)
|
||||
|
@ -114,11 +114,6 @@ cogl_indices_new (CoglContext *context,
|
||||
const void *indices_data,
|
||||
int n_indices);
|
||||
|
||||
COGL_EXPORT CoglIndices *
|
||||
cogl_indices_new_for_buffer (CoglIndicesType type,
|
||||
CoglIndexBuffer *buffer,
|
||||
size_t offset);
|
||||
|
||||
/**
|
||||
* cogl_indices_get_buffer:
|
||||
*
|
||||
@ -130,8 +125,4 @@ cogl_indices_get_buffer (CoglIndices *indices);
|
||||
COGL_EXPORT CoglIndicesType
|
||||
cogl_indices_get_indices_type (CoglIndices *indices);
|
||||
|
||||
COGL_EXPORT size_t
|
||||
cogl_indices_get_offset (CoglIndices *indices);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -348,7 +348,6 @@ cogl_gl_framebuffer_draw_indexed_attributes (CoglFramebufferDriver *driver,
|
||||
cogl_framebuffer_driver_get_framebuffer (driver);
|
||||
CoglBuffer *buffer;
|
||||
uint8_t *base;
|
||||
size_t buffer_offset;
|
||||
size_t index_size;
|
||||
GLenum indices_gl_type = 0;
|
||||
|
||||
@ -364,7 +363,6 @@ cogl_gl_framebuffer_draw_indexed_attributes (CoglFramebufferDriver *driver,
|
||||
*/
|
||||
base = _cogl_buffer_gl_bind (buffer,
|
||||
COGL_BUFFER_BIND_TARGET_INDEX_BUFFER, NULL);
|
||||
buffer_offset = cogl_indices_get_offset (indices);
|
||||
index_size = cogl_indices_type_get_size (cogl_indices_get_indices_type (indices));
|
||||
|
||||
switch (cogl_indices_get_indices_type (indices))
|
||||
@ -384,7 +382,7 @@ cogl_gl_framebuffer_draw_indexed_attributes (CoglFramebufferDriver *driver,
|
||||
glDrawElements ((GLenum)mode,
|
||||
n_vertices,
|
||||
indices_gl_type,
|
||||
base + buffer_offset + index_size * first_vertex));
|
||||
base + index_size * first_vertex));
|
||||
|
||||
_cogl_buffer_gl_unbind (buffer);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user