mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
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:
parent
c5bb2e3f56
commit
148cba3270
@ -276,6 +276,7 @@ emit_vertex_buffer_geometry (CoglFramebuffer *fb,
|
|||||||
gboolean allocated = FALSE;
|
gboolean allocated = FALSE;
|
||||||
CoglAttribute *attributes[2];
|
CoglAttribute *attributes[2];
|
||||||
CoglPrimitive *prim;
|
CoglPrimitive *prim;
|
||||||
|
CoglIndices *indices;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
n_verts = node->d.texture.rectangles->len * 4;
|
n_verts = node->d.texture.rectangles->len * 4;
|
||||||
@ -354,22 +355,11 @@ emit_vertex_buffer_geometry (CoglFramebuffer *fb,
|
|||||||
attributes,
|
attributes,
|
||||||
2 /* n_attributes */);
|
2 /* n_attributes */);
|
||||||
|
|
||||||
#ifdef CLUTTER_COGL_HAS_GL
|
indices =
|
||||||
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUADS))
|
cogl_get_rectangle_indices (ctx, node->d.texture.rectangles->len);
|
||||||
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 */
|
|
||||||
|
|
||||||
CoglIndices *indices =
|
cogl_primitive_set_indices (prim, indices,
|
||||||
cogl_get_rectangle_indices (ctx, node->d.texture.rectangles->len);
|
node->d.texture.rectangles->len * 6);
|
||||||
|
|
||||||
cogl_primitive_set_indices (prim, indices,
|
|
||||||
node->d.texture.rectangles->len * 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
node->d.texture.primitive = prim;
|
node->d.texture.primitive = prim;
|
||||||
|
|
||||||
|
@ -304,46 +304,30 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
|
|||||||
if (!_cogl_pipeline_get_real_blend_enabled (state->pipeline))
|
if (!_cogl_pipeline_get_real_blend_enabled (state->pipeline))
|
||||||
draw_flags |= COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE;
|
draw_flags |= COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE;
|
||||||
|
|
||||||
#ifdef HAVE_COGL_GL
|
if (batch_len > 1)
|
||||||
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUADS))
|
{
|
||||||
|
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,
|
_cogl_framebuffer_draw_attributes (framebuffer,
|
||||||
state->pipeline,
|
state->pipeline,
|
||||||
GL_QUADS,
|
COGL_VERTICES_MODE_TRIANGLE_FAN,
|
||||||
state->current_vertex, batch_len * 4,
|
state->current_vertex, 4,
|
||||||
attributes,
|
attributes,
|
||||||
state->attributes->len,
|
state->attributes->len,
|
||||||
draw_flags);
|
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
|
/* DEBUGGING CODE XXX: This path will cause all rectangles to be
|
||||||
* drawn with a coloured outline. Each batch will be rendered with
|
* 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,
|
4,
|
||||||
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
|
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
|
/* We only create new Attributes when the stride within the
|
||||||
* AttributeBuffer changes. (due to a change in the number of pipeline
|
* AttributeBuffer changes. (due to a change in the number of pipeline
|
||||||
|
@ -54,7 +54,6 @@ typedef enum
|
|||||||
COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT,
|
COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT,
|
||||||
COGL_PRIVATE_FEATURE_ALPHA_TEST,
|
COGL_PRIVATE_FEATURE_ALPHA_TEST,
|
||||||
COGL_PRIVATE_FEATURE_FORMAT_CONVERSION,
|
COGL_PRIVATE_FEATURE_FORMAT_CONVERSION,
|
||||||
COGL_PRIVATE_FEATURE_QUADS,
|
|
||||||
COGL_PRIVATE_FEATURE_BLEND_CONSTANT,
|
COGL_PRIVATE_FEATURE_BLEND_CONSTANT,
|
||||||
COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS,
|
COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS,
|
||||||
COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM,
|
COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM,
|
||||||
|
@ -484,7 +484,6 @@ _cogl_driver_update_features (CoglContext *ctx,
|
|||||||
/* Features which are not available in GL 3 */
|
/* 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_GL_FIXED, TRUE);
|
||||||
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEST, 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_FLAGS_SET (private_features,
|
||||||
COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, TRUE);
|
COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, TRUE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user