diff options
author | Brian Paul <[email protected]> | 2010-01-06 18:18:04 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-01-06 18:20:17 -0700 |
commit | cb3cb96fbd3279bf3dd50439444c4c064ed6f748 (patch) | |
tree | d74fd15a811db634413c987b0aa09d9bc22198a5 | |
parent | 06970b2ccb6add0696710f01a07ebf9ec3922c80 (diff) |
meta: move destination vertex/projection setup out of _mesa_meta_GenerateMipmap
Based on a patch submitted by Pierre Willenbrock <[email protected]>
-rw-r--r-- | 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 adc986402c1..181fc035561 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); } |