st/mesa: fix non-mipmap lastLevel calculation.
authorBrian Paul <brianp@vmware.com>
Thu, 1 Oct 2009 19:34:49 +0000 (13:34 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 1 Oct 2009 19:34:49 +0000 (13:34 -0600)
reviewed by Brian Paul.
(cherry picked from master, commit ae2daacbac7242938cffe0e2409071e030e00863)

src/mesa/state_tracker/st_cb_texture.c

index b13e3774c8e32f1c8d4e64fc891b85d6d6ab4fae..50675b58962b1e016ab41bac45863050c0362f54 100644 (file)
@@ -1775,7 +1775,11 @@ st_finalize_texture(GLcontext *ctx,
        * incomplete.  In that case, we'll have set stObj->lastLevel before
        * we get here.
        */
-      stObj->lastLevel = stObj->base._MaxLevel - stObj->base.BaseLevel;
+      if (stObj->base.MinFilter == GL_LINEAR ||
+          stObj->base.MinFilter == GL_NEAREST)
+         stObj->lastLevel = stObj->base.BaseLevel;
+      else
+         stObj->lastLevel = stObj->base._MaxLevel - stObj->base.BaseLevel;
    }
 
    firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]);