Mesa (mesa_7_7_branch): meta: move destination vertex/ projection setup out of _mesa_meta_GenerateMipmap

Brian Paul brianp at kemper.freedesktop.org
Thu Jan 7 01:20:30 UTC 2010


Module: Mesa
Branch: mesa_7_7_branch
Commit: cb3cb96fbd3279bf3dd50439444c4c064ed6f748
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb3cb96fbd3279bf3dd50439444c4c064ed6f748

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jan  6 18:18:04 2010 -0700

meta: move destination vertex/projection setup out of _mesa_meta_GenerateMipmap

Based on a patch submitted by Pierre Willenbrock <pierre at pirsoft.de>

---

 src/mesa/drivers/common/meta.c |   40 +++++++++++++++++++++-------------------
 1 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index adc9864..181fc03 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -2289,6 +2289,26 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
 
    _mesa_set_enable(ctx, target, GL_TRUE);
 
+   /* setup vertex positions */
+   {
+      verts[0].x = 0.0F;
+      verts[0].y = 0.0F;
+      verts[1].x = 1.0F;
+      verts[1].y = 0.0F;
+      verts[2].x = 1.0F;
+      verts[2].y = 1.0F;
+      verts[3].x = 0.0F;
+      verts[3].y = 1.0F;
+      
+      /* upload new vertex data */
+      _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
+   }
+
+   /* setup projection matrix */
+   _mesa_MatrixMode(GL_PROJECTION);
+   _mesa_LoadIdentity();
+   _mesa_Ortho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
+
    /* texture is already locked, unlock now */
    _mesa_unlock_texture(ctx, texObj);
 
@@ -2355,21 +2375,6 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
          }
       }
 
-      /* setup vertex positions */
-      {
-         verts[0].x = 0.0F;
-         verts[0].y = 0.0F;
-         verts[1].x = (GLfloat) dstWidth;
-         verts[1].y = 0.0F;
-         verts[2].x = (GLfloat) dstWidth;
-         verts[2].y = (GLfloat) dstHeight;
-         verts[3].x = 0.0F;
-         verts[3].y = (GLfloat) dstHeight;
-
-         /* upload new vertex data */
-         _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
-      }
-
       /* limit sampling to src level */
       _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel);
       _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel);
@@ -2411,11 +2416,8 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
       assert(dstWidth == ctx->DrawBuffer->Width);
       assert(dstHeight == ctx->DrawBuffer->Height);
 
-      /* setup viewport and matching projection matrix */
+      /* setup viewport */
       _mesa_set_viewport(ctx, 0, 0, dstWidth, dstHeight);
-      _mesa_MatrixMode(GL_PROJECTION);
-      _mesa_LoadIdentity();
-      _mesa_Ortho(0.0F, dstWidth, 0.0F, dstHeight, -1.0F, 1.0F);
 
       _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
    }




More information about the mesa-commit mailing list