[Mesa-dev] [PATCH 19/35] meta: Use common routine to configure fixed-function TNL state
Ian Romanick
idr at freedesktop.org
Wed Jan 29 13:53:10 PST 2014
From: Ian Romanick <ian.d.romanick at intel.com>
Also... glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0) *is* the identity
matrix, so drop the unnecessary call to _mesa_Ortho.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/drivers/common/meta.c | 31 ++++++++-----------------------
1 file changed, 8 insertions(+), 23 deletions(-)
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index e03267e..d4987ca 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1544,15 +1544,13 @@ init_blit_depth_pixels(struct gl_context *ctx)
}
static void
-setup_ff_blit_framebuffer(struct blit_state *blit)
+setup_ff_TNL_for_blit(GLuint *ArrayObj, GLuint *VBO, unsigned texcoord_size)
{
- setup_vertex_objects(&blit->ArrayObj, &blit->VBO, false, 2, 2, 0);
+ setup_vertex_objects(ArrayObj, VBO, false, 2, texcoord_size, 0);
/* setup projection matrix */
_mesa_MatrixMode(GL_PROJECTION);
_mesa_LoadIdentity();
- _mesa_Ortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
-
}
static void
@@ -1724,7 +1722,9 @@ blitframebuffer_texture(struct gl_context *ctx,
_mesa_UseProgram(blit->RectShaderProg);
}
else {
- setup_ff_blit_framebuffer(&ctx->Meta->Blit);
+ setup_ff_TNL_for_blit(&ctx->Meta->Blit.ArrayObj,
+ &ctx->Meta->Blit.VBO,
+ 2);
}
_mesa_GenSamplers(1, &sampler);
@@ -1903,7 +1903,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
_mesa_UseProgram(blit->RectShaderProg);
}
else {
- setup_ff_blit_framebuffer(blit);
+ setup_ff_TNL_for_blit(&blit->ArrayObj, &blit->VBO, 2);
}
/* Silence valgrind warnings about reading uninitialized stack. */
@@ -3350,19 +3350,6 @@ setup_texture_coords(GLenum faceTarget,
}
}
-
-static void
-setup_ff_generate_mipmap(struct gen_mipmap_state *mipmap)
-{
- setup_vertex_objects(&mipmap->ArrayObj, &mipmap->VBO, false, 2, 3, 0);
-
- /* setup projection matrix */
- _mesa_MatrixMode(GL_PROJECTION);
- _mesa_LoadIdentity();
- _mesa_Ortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
-}
-
-
static struct glsl_sampler *
setup_texture_sampler(GLenum target, struct gen_mipmap_state *mipmap)
{
@@ -3577,7 +3564,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_UseProgram(mipmap->ShaderProg);
}
else {
- setup_ff_generate_mipmap(mipmap);
+ setup_ff_TNL_for_blit(&mipmap->ArrayObj, &mipmap->VBO, 3);
_mesa_set_enable(ctx, target, GL_TRUE);
}
@@ -4002,7 +3989,7 @@ decompress_texture_image(struct gl_context *ctx,
decompress->Height = height;
}
- setup_vertex_objects(&decompress->ArrayObj, &decompress->VBO, false, 2, 3, 0);
+ setup_ff_TNL_for_blit(&decompress->ArrayObj, &decompress->VBO, 3);
if (!decompress->Sampler) {
_mesa_GenSamplers(1, &decompress->Sampler);
@@ -4039,8 +4026,6 @@ decompress_texture_image(struct gl_context *ctx,
verts[3].x = -1.0F;
verts[3].y = 1.0F;
- _mesa_MatrixMode(GL_PROJECTION);
- _mesa_LoadIdentity();
_mesa_set_viewport(ctx, 0, 0, 0, width, height);
/* upload new vertex data */
--
1.8.1.4
More information about the mesa-dev
mailing list