cogl: Remove COGL_PRIVATE_FEATURE_QUADS

There's no real performance benefit to this, it's just a difference
between GL and GLES for no reason.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
This commit is contained in:
Adam Jackson 2019-10-17 15:35:22 -04:00 committed by Georges Basile Stavracas Neto
parent c5bb2e3f56
commit 148cba3270
4 changed files with 23 additions and 52 deletions

View File

@ -276,6 +276,7 @@ emit_vertex_buffer_geometry (CoglFramebuffer *fb,
gboolean allocated = FALSE;
CoglAttribute *attributes[2];
CoglPrimitive *prim;
CoglIndices *indices;
int i;
n_verts = node->d.texture.rectangles->len * 4;
@ -354,22 +355,11 @@ emit_vertex_buffer_geometry (CoglFramebuffer *fb,
attributes,
2 /* n_attributes */);
#ifdef CLUTTER_COGL_HAS_GL
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUADS))
cogl_primitive_set_mode (prim, GL_QUADS);
else
#endif
{
/* GLES doesn't support GL_QUADS so instead we use a VBO
with indexed vertices to generate GL_TRIANGLES from the
quads */
indices =
cogl_get_rectangle_indices (ctx, node->d.texture.rectangles->len);
CoglIndices *indices =
cogl_get_rectangle_indices (ctx, node->d.texture.rectangles->len);
cogl_primitive_set_indices (prim, indices,
node->d.texture.rectangles->len * 6);
}
cogl_primitive_set_indices (prim, indices,
node->d.texture.rectangles->len * 6);
node->d.texture.primitive = prim;

View File

@ -304,46 +304,30 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
if (!_cogl_pipeline_get_real_blend_enabled (state->pipeline))
draw_flags |= COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE;
#ifdef HAVE_COGL_GL
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUADS))
if (batch_len > 1)
{
CoglVerticesMode mode = COGL_VERTICES_MODE_TRIANGLES;
int first_vertex = state->current_vertex * 6 / 4;
_cogl_framebuffer_draw_indexed_attributes (framebuffer,
state->pipeline,
mode,
first_vertex,
batch_len * 6,
state->indices,
attributes,
state->attributes->len,
draw_flags);
}
else
{
/* XXX: it's rather evil that we sneak in the GL_QUADS enum here... */
_cogl_framebuffer_draw_attributes (framebuffer,
state->pipeline,
GL_QUADS,
state->current_vertex, batch_len * 4,
COGL_VERTICES_MODE_TRIANGLE_FAN,
state->current_vertex, 4,
attributes,
state->attributes->len,
draw_flags);
}
else
#endif /* HAVE_COGL_GL */
{
if (batch_len > 1)
{
CoglVerticesMode mode = COGL_VERTICES_MODE_TRIANGLES;
int first_vertex = state->current_vertex * 6 / 4;
_cogl_framebuffer_draw_indexed_attributes (framebuffer,
state->pipeline,
mode,
first_vertex,
batch_len * 6,
state->indices,
attributes,
state->attributes->len,
draw_flags);
}
else
{
_cogl_framebuffer_draw_attributes (framebuffer,
state->pipeline,
COGL_VERTICES_MODE_TRIANGLE_FAN,
state->current_vertex, 4,
attributes,
state->attributes->len,
draw_flags);
}
}
/* DEBUGGING CODE XXX: This path will cause all rectangles to be
* drawn with a coloured outline. Each batch will be rendered with
@ -636,8 +620,7 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
4,
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUADS))
state->indices = cogl_get_rectangle_indices (ctx, batch_len);
state->indices = cogl_get_rectangle_indices (ctx, batch_len);
/* We only create new Attributes when the stride within the
* AttributeBuffer changes. (due to a change in the number of pipeline

View File

@ -54,7 +54,6 @@ typedef enum
COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT,
COGL_PRIVATE_FEATURE_ALPHA_TEST,
COGL_PRIVATE_FEATURE_FORMAT_CONVERSION,
COGL_PRIVATE_FEATURE_QUADS,
COGL_PRIVATE_FEATURE_BLEND_CONSTANT,
COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS,
COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM,

View File

@ -484,7 +484,6 @@ _cogl_driver_update_features (CoglContext *ctx,
/* Features which are not available in GL 3 */
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_GL_FIXED, TRUE);
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEST, TRUE);
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_QUADS, TRUE);
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, TRUE);