[mutter] cogl: Upload clipping rectangles in parallel
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cogl: Upload clipping rectangles in parallel
- Date: Wed, 18 Dec 2019 13:58:18 +0000 (UTC)
commit 4aab814c379326b5c434846024838c7d499e57ac
Author: Daniel van Vugt <daniel van vugt canonical com>
Date: Fri Dec 13 16:00:35 2019 +0800
cogl: Upload clipping rectangles in parallel
That is as a single array in a single GL operation. Instead of doing
each one as a separate upload.
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/971
https://gitlab.gnome.org/GNOME/mutter/merge_requests/969
cogl/cogl/driver/gl/cogl-clip-stack-gl.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/cogl/cogl/driver/gl/cogl-clip-stack-gl.c b/cogl/cogl/driver/gl/cogl-clip-stack-gl.c
index a13b26de1..3bd9ab873 100644
--- a/cogl/cogl/driver/gl/cogl-clip-stack-gl.c
+++ b/cogl/cogl/driver/gl/cogl-clip-stack-gl.c
@@ -124,6 +124,7 @@ add_stencil_clip_region (CoglFramebuffer *framebuffer,
CoglMatrix matrix;
int num_rectangles = cairo_region_num_rectangles (region);
int i;
+ CoglVertexP2 *vertices;
/* NB: This can be called while flushing the journal so we need
* to be very conservative with what state we change.
@@ -167,11 +168,14 @@ add_stencil_clip_region (CoglFramebuffer *framebuffer,
GE( ctx, glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE) );
}
+ vertices = g_alloca (sizeof (CoglVertexP2) * num_rectangles * 6);
+
for (i = 0; i < num_rectangles; i++)
{
cairo_rectangle_int_t rect;
float x1, y1, z1, w1;
float x2, y2, z2, w2;
+ CoglVertexP2 *v = vertices + i * 6;
cairo_region_get_rectangle (region, i, &rect);
@@ -188,11 +192,26 @@ add_stencil_clip_region (CoglFramebuffer *framebuffer,
cogl_matrix_transform_point (&matrix, &x1, &y1, &z1, &w1);
cogl_matrix_transform_point (&matrix, &x2, &y2, &z2, &w2);
- _cogl_rectangle_immediate (framebuffer,
- ctx->stencil_pipeline,
- x1, y1, x2, y2);
+ v[0].x = x1;
+ v[0].y = y1;
+ v[1].x = x1;
+ v[1].y = y2;
+ v[2].x = x2;
+ v[2].y = y1;
+ v[3].x = x1;
+ v[3].y = y2;
+ v[4].x = x2;
+ v[4].y = y2;
+ v[5].x = x2;
+ v[5].y = y1;
}
+ cogl_2d_primitives_immediate (framebuffer,
+ ctx->stencil_pipeline,
+ COGL_VERTICES_MODE_TRIANGLES,
+ vertices,
+ 6 * num_rectangles);
+
if (merge)
{
/* Subtract one from all pixels in the stencil buffer so that
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]