diff options
author | Brian Paul <[email protected]> | 2010-07-20 08:40:19 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-07-20 08:50:32 -0600 |
commit | bab484a59b21fff84579a492d079d46e27d486dd (patch) | |
tree | 537f55a743f40c82fa3c2392965ca2009f347023 /src/mesa/drivers/common/meta.c | |
parent | 895086467e03b15d376dcdff0d772408dda03f88 (diff) |
mesa: call ctx->Driver.ChooseTextureFormat() only when necessary.
When defining mipmap level 'L' and level L-1 exists and the new level's
internalFormat matches level L-1's internalFormat, then use the same hw
format. Otherwise, do the regular ctx->Driver.ChooseTextureFormat() call.
This avoids a problem where we end up choosing different hw formats for
different mipmap levels depending on how the levels are defined (glTexImage
vs. glCopyTexImage vs. glGenerateMipmap, etc).
The root problem is the ChooseTextureFormat() implementation in some
drivers uses the user's glTexImage format/type parameters in the choosing
heuristic. Later mipmap levels might be generated with different calls
(ex: glCopyTexImage()) so we don't always have format/type info and the
driver may choose a different format.
For more background info see the July 2010 mesa-dev thread "Bug in
_mesa_meta_GenerateMipmap"
Diffstat (limited to 'src/mesa/drivers/common/meta.c')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index c548e104203..dc6e7120c63 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2570,12 +2570,6 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, return; } - if (texImage->TexFormat == MESA_FORMAT_NONE) - texImage->TexFormat = ctx->Driver.ChooseTextureFormat(ctx, - internalFormat, - format, - type); - _mesa_unlock_texture(ctx, texObj); /* need to unlock first */ /* @@ -2604,6 +2598,9 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, postConvWidth, postConvHeight, 1, border, internalFormat); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, GL_NONE, GL_NONE); + /* * Store texture data (with pixel transfer ops) */ |