[mutter] cogl: Remove COGL_PRIVATE_FEATURE_QUADS
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cogl: Remove COGL_PRIVATE_FEATURE_QUADS
- Date: Mon, 21 Oct 2019 21:50:09 +0000 (UTC)
commit 148cba3270d33b1c0d1d77dfa6186185df8411e4
Author: Adam Jackson <ajax redhat com>
Date: Thu Oct 17 15:35:22 2019 -0400
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
cogl/cogl-pango/cogl-pango-display-list.c | 20 +++---------
cogl/cogl/cogl-journal.c | 53 +++++++++++--------------------
cogl/cogl/cogl-private.h | 1 -
cogl/cogl/driver/gl/gl/cogl-driver-gl.c | 1 -
4 files changed, 23 insertions(+), 52 deletions(-)
---
diff --git a/cogl/cogl-pango/cogl-pango-display-list.c b/cogl/cogl-pango/cogl-pango-display-list.c
index 72e381761..8615402b9 100644
--- a/cogl/cogl-pango/cogl-pango-display-list.c
+++ b/cogl/cogl-pango/cogl-pango-display-list.c
@@ -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;
diff --git a/cogl/cogl/cogl-journal.c b/cogl/cogl/cogl-journal.c
index e09fa2cf2..484696d31 100644
--- a/cogl/cogl/cogl-journal.c
+++ b/cogl/cogl/cogl-journal.c
@@ -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
diff --git a/cogl/cogl/cogl-private.h b/cogl/cogl/cogl-private.h
index c168fdf35..007f311ca 100644
--- a/cogl/cogl/cogl-private.h
+++ b/cogl/cogl/cogl-private.h
@@ -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,
diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
index f94b9d5e7..6765b4f90 100644
--- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]