st/mesa: fix non-mipmap lastLevel calculation.
authorCooper Yuan <cooperyuan@gmail.com>
Thu, 1 Oct 2009 09:54:27 +0000 (17:54 +0800)
committerCooper Yuan <cooperyuan@gmail.com>
Thu, 1 Oct 2009 09:54:27 +0000 (17:54 +0800)
reviewed by Brian Paul.

src/mesa/state_tracker/st_cb_texture.c

index 771a0e2bbdfc18f4c517fb659cf1c22f0fcdf807..9a634bb9302f0033d28ea61896f7cb50f3d1067f 100644 (file)
@@ -1766,7 +1766,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]);