[Mesa-dev] [PATCH 05/13] meta: Use same vertex coordinates for GLSL and FF clears

Ian Romanick idr at freedesktop.org
Mon Jun 19 02:07:44 UTC 2017


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

   text	   data	    bss	    dec	    hex	filename
7155058	 256860	  37332	7449250	 71aaa2	32-bit i965_dri.so before
7154994	 256860	  37332	7449186	 71aa62	32-bit i965_dri.so after
6788611	 328056	  50704	7167371	 6d5d8b	64-bit i965_dri.so before
6788475	 328056	  50704	7167235	 6d5d03	64-bit i965_dri.so after

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

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 85e766a..79dbab7 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1633,7 +1633,6 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)
    GLbitfield metaSave;
    const GLuint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
    struct gl_framebuffer *fb = ctx->DrawBuffer;
-   float x0, y0, x1, y1, z;
    struct vertex verts[4];
    int i;
 
@@ -1669,21 +1668,12 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)
    assert(!fb->_IntegerBuffers);
    if (glsl) {
       meta_glsl_clear_init(ctx, clear);
-
-      x0 = ((float) fb->_Xmin / fb->Width)  * 2.0f - 1.0f;
-      y0 = ((float) fb->_Ymin / fb->Height) * 2.0f - 1.0f;
-      x1 = ((float) fb->_Xmax / fb->Width)  * 2.0f - 1.0f;
-      y1 = ((float) fb->_Ymax / fb->Height) * 2.0f - 1.0f;
-      z = -invert_z(ctx->Depth.Clear);
    } else {
       _mesa_meta_setup_vertex_objects(ctx, &clear->VAO, &clear->buf_obj, false,
                                       3, 0, 4);
 
-      x0 = (float) fb->_Xmin;
-      y0 = (float) fb->_Ymin;
-      x1 = (float) fb->_Xmax;
-      y1 = (float) fb->_Ymax;
-      z = invert_z(ctx->Depth.Clear);
+      /* setup projection matrix */
+      _mesa_load_identity_matrix(ctx, &ctx->ProjectionMatrixStack);
    }
 
    if (glsl) {
@@ -1730,6 +1720,12 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)
    }
 
    /* vertex positions */
+   const float x0 = ((float) fb->_Xmin / fb->Width)  * 2.0f - 1.0f;
+   const float y0 = ((float) fb->_Ymin / fb->Height) * 2.0f - 1.0f;
+   const float x1 = ((float) fb->_Xmax / fb->Width)  * 2.0f - 1.0f;
+   const float y1 = ((float) fb->_Ymax / fb->Height) * 2.0f - 1.0f;
+   const float z = -invert_z(ctx->Depth.Clear);
+
    verts[0].x = x0;
    verts[0].y = y0;
    verts[0].z = z;
-- 
2.9.4



More information about the mesa-dev mailing list