Mesa (master): meta: Use common routine to configure fixed-function TNL state
Eric Anholt
anholt at kemper.freedesktop.org
Wed Feb 12 00:00:24 UTC 2014
Module: Mesa
Branch: master
Commit: 5e5d87ff329530664772a2c3ea4377c146591622
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e5d87ff329530664772a2c3ea4377c146591622
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Sat Dec 14 11:36:32 2013 -0800
meta: Use common routine to configure fixed-function TNL state
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.
v2: Rename setup_ff_TNL_for_blit() to setup_ff_tnl_for_blit(). Seems
silly to capitalize one out of two to three acronyms in the name
(change by anholt, acked by idr).
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Brian Paul <brianp at vmware.com> (v1)
Reviewed-by: Eric Anholt <eric at anholt.net>
---
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 5dbeaeb..eb75e58 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1543,15 +1543,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 *VAO, GLuint *VBO, unsigned texcoord_size)
{
- setup_vertex_objects(&blit->VAO, &blit->VBO, false, 2, 2, 0);
+ setup_vertex_objects(VAO, 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
@@ -1723,7 +1721,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.VAO,
+ &ctx->Meta->Blit.VBO,
+ 2);
}
_mesa_GenSamplers(1, &sampler);
@@ -1902,7 +1902,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
_mesa_UseProgram(blit->RectShaderProg);
}
else {
- setup_ff_blit_framebuffer(blit);
+ setup_ff_tnl_for_blit(&blit->VAO, &blit->VBO, 2);
}
/* Silence valgrind warnings about reading uninitialized stack. */
@@ -3346,19 +3346,6 @@ setup_texture_coords(GLenum faceTarget,
}
}
-
-static void
-setup_ff_generate_mipmap(struct gen_mipmap_state *mipmap)
-{
- setup_vertex_objects(&mipmap->VAO, &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)
{
@@ -3573,7 +3560,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->VAO, &mipmap->VBO, 3);
_mesa_set_enable(ctx, target, GL_TRUE);
}
@@ -4004,7 +3991,7 @@ decompress_texture_image(struct gl_context *ctx,
decompress->Height = height;
}
- setup_vertex_objects(&decompress->VAO, &decompress->VBO, false, 2, 3, 0);
+ setup_ff_tnl_for_blit(&decompress->VAO, &decompress->VBO, 3);
if (!decompress->Sampler) {
_mesa_GenSamplers(1, &decompress->Sampler);
@@ -4041,8 +4028,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 */
More information about the mesa-commit
mailing list