Mesa (7.8): i915: Clamp minimum lod to maximum texture level too.

Eric Anholt anholt at kemper.freedesktop.org
Tue Jun 15 22:55:57 UTC 2010


Module: Mesa
Branch: 7.8
Commit: 226e612631260db22de274d46cdff034bfdd8ca4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=226e612631260db22de274d46cdff034bfdd8ca4

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Jun  4 13:27:05 2010 -0700

i915: Clamp minimum lod to maximum texture level too.

Otherwise, we'd run into minlod > maxlod, and the sampler would give
us the undefined we asked for.

Bug #24846.  Fixes OGLC texlod.c.
(cherry picked from commit b80a728f8a86cbd1efce9611d822ab73b5baeab9)

---

 src/mesa/drivers/dri/i915/i915_texstate.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c
index a1ab8f8..815074c 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -281,6 +281,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
       GLenum ws = tObj->WrapS;
       GLenum wt = tObj->WrapT;
       GLenum wr = tObj->WrapR;
+      float minlod;
 
       /* We program 1D textures as 2D textures, so the 2D texcoord could
        * result in sampling border values if we don't set the T wrap to
@@ -321,8 +322,9 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
           (translate_wrap_mode(wt) << SS3_TCY_ADDR_MODE_SHIFT) |
           (translate_wrap_mode(wr) << SS3_TCZ_ADDR_MODE_SHIFT));
 
+      minlod = MIN2(tObj->MinLod, tObj->_MaxLevel - tObj->BaseLevel);
       state[I915_TEXREG_SS3] |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT);
-      state[I915_TEXREG_SS3] |= (U_FIXED(CLAMP(tObj->MinLod, 0.0, 11.0), 4) <<
+      state[I915_TEXREG_SS3] |= (U_FIXED(CLAMP(minlod, 0.0, 11.0), 4) <<
 				 SS3_MIN_LOD_SHIFT);
 
    }




More information about the mesa-commit mailing list