Mesa (master): meta: Expand the vertex structure for the CopyPixels paths

Eric Anholt anholt at kemper.freedesktop.org
Tue Feb 11 22:24:44 UTC 2014


Module: Mesa
Branch: master
Commit: 545fd9bc9b214d1bc8e7d7300c6d66f982b1ee93
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=545fd9bc9b214d1bc8e7d7300c6d66f982b1ee93

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Dec 13 19:32:08 2013 -0800

meta: Expand the vertex structure for the CopyPixels paths

Another step leading to some code sharing.  Note that the new CopyPixels
vertex structure is the same as the new BlitFramebuffer vertex
structure.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/drivers/common/meta.c |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 99163d6..ff87c84 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -2451,7 +2451,7 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
    struct copypix_state *copypix = &ctx->Meta->CopyPix;
    struct temp_texture *tex = get_temp_texture(ctx);
    struct vertex {
-      GLfloat x, y, z, s, t;
+      GLfloat x, y, z, tex[4];
    };
    struct vertex verts[4];
    GLboolean newTex;
@@ -2493,7 +2493,7 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
 
       /* setup vertex arrays */
       _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
-      _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s));
+      _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(tex));
       _mesa_EnableClientState(GL_VERTEX_ARRAY);
       _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
    }
@@ -2504,6 +2504,9 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
 
    newTex = alloc_texture(tex, width, height, intFormat);
 
+   /* Silence valgrind warnings about reading uninitialized stack. */
+   memset(verts, 0, sizeof(verts));
+
    /* vertex positions, texcoords (after texture allocation!) */
    {
       const GLfloat dstX0 = (GLfloat) dstX;
@@ -2515,23 +2518,23 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
       verts[0].x = dstX0;
       verts[0].y = dstY0;
       verts[0].z = z;
-      verts[0].s = 0.0F;
-      verts[0].t = 0.0F;
+      verts[0].tex[0] = 0.0F;
+      verts[0].tex[1] = 0.0F;
       verts[1].x = dstX1;
       verts[1].y = dstY0;
       verts[1].z = z;
-      verts[1].s = tex->Sright;
-      verts[1].t = 0.0F;
+      verts[1].tex[0] = tex->Sright;
+      verts[1].tex[1] = 0.0F;
       verts[2].x = dstX1;
       verts[2].y = dstY1;
       verts[2].z = z;
-      verts[2].s = tex->Sright;
-      verts[2].t = tex->Ttop;
+      verts[2].tex[0] = tex->Sright;
+      verts[2].tex[1] = tex->Ttop;
       verts[3].x = dstX0;
       verts[3].y = dstY1;
       verts[3].z = z;
-      verts[3].s = 0.0F;
-      verts[3].t = tex->Ttop;
+      verts[3].tex[0] = 0.0F;
+      verts[3].tex[1] = tex->Ttop;
 
       /* upload new vertex data */
       _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);




More information about the mesa-commit mailing list