Mesa (master): swrast: fix choose_depth_texture_level() to respect mipmap filtering state

Brian Paul brianp at kemper.freedesktop.org
Tue Oct 5 02:00:07 UTC 2010


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

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Oct  4 19:59:23 2010 -0600

swrast: fix choose_depth_texture_level() to respect mipmap filtering state

NOTE: this is a candidate for the 7.9 branch.

---

 src/mesa/swrast/s_texfilter.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index de694c3..e5ffe8f 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -2975,11 +2975,16 @@ choose_depth_texture_level(const struct gl_texture_object *tObj, GLfloat lambda)
 {
    GLint level;
 
-   lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod);
-
-   level = (GLint) lambda;
-
-   level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel);
+   if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
+      /* no mipmapping - use base level */
+      level = tObj->BaseLevel;
+   }
+   else {
+      /* choose mipmap level */
+      lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod);
+      level = (GLint) lambda;
+      level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel);
+   }
 
    return level;
 }




More information about the mesa-commit mailing list