[Mesa-dev] [PATCH 08/12] meta: Coalesce the GLSL and FF paths in meta_clear

Ian Romanick idr at freedesktop.org
Mon Jun 26 23:22:41 UTC 2017


From: Ian Romanick <ian.d.romanick at intel.com>

   text	   data	    bss	    dec	    hex	filename
7154994	 256860	  37332	7449186	 71aa62	32-bit i965_dri.so before
7154994	 256860	  37332	7449186	 71aa62	32-bit i965_dri.so after
6788475	 328056	  50704	7167235	 6d5d03	64-bit i965_dri.so before
6788451	 328056	  50704	7167211	 6d5ceb	64-bit i965_dri.so after

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/common/meta.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 4ace12b..5dc81bc 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1634,7 +1634,6 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)
    const GLuint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
    struct gl_framebuffer *fb = ctx->DrawBuffer;
    struct vertex verts[4];
-   int i;
 
    metaSave = (MESA_META_ALPHA_TEST |
                MESA_META_BLEND |
@@ -1668,17 +1667,22 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)
    assert(!fb->_IntegerBuffers);
    if (glsl) {
       meta_glsl_clear_init(ctx, clear);
+
+      _mesa_meta_use_program(ctx, clear->ShaderProg);
+      _mesa_Uniform4fv(0, 1, ctx->Color.ClearColor.f);
    } else {
       _mesa_meta_setup_vertex_objects(ctx, &clear->VAO, &clear->buf_obj, false,
                                       3, 0, 4);
 
       /* setup projection matrix */
       _mesa_load_identity_matrix(ctx, &ctx->ProjectionMatrixStack);
-   }
 
-   if (glsl) {
-      _mesa_meta_use_program(ctx, clear->ShaderProg);
-      _mesa_Uniform4fv(0, 1, ctx->Color.ClearColor.f);
+      for (int i = 0; i < 4; i++) {
+         verts[i].r = ctx->Color.ClearColor.f[0];
+         verts[i].g = ctx->Color.ClearColor.f[1];
+         verts[i].b = ctx->Color.ClearColor.f[2];
+         verts[i].a = ctx->Color.ClearColor.f[3];
+      }
    }
 
    /* GL_COLOR_BUFFER_BIT */
@@ -1739,15 +1743,6 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)
    verts[3].y = y1;
    verts[3].z = z;
 
-   if (!glsl) {
-      for (i = 0; i < 4; i++) {
-         verts[i].r = ctx->Color.ClearColor.f[0];
-         verts[i].g = ctx->Color.ClearColor.f[1];
-         verts[i].b = ctx->Color.ClearColor.f[2];
-         verts[i].a = ctx->Color.ClearColor.f[3];
-      }
-   }
-
    /* upload new vertex data */
    _mesa_buffer_data(ctx, clear->buf_obj, GL_NONE, sizeof(verts), verts,
                      GL_DYNAMIC_DRAW, __func__);
-- 
2.9.4



More information about the mesa-dev mailing list