intel: Use core mesa support for determining lastLevel.
authorEric Anholt <eric@anholt.net>
Tue, 13 Nov 2012 20:45:35 +0000 (12:45 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 17 Nov 2012 20:55:54 +0000 (12:55 -0800)
We had similar issues with using depth in determining the lastLevel of array
textures.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/dri/intel/intel_tex_image.c

index 7b9638f666a8f90062b61e08a9bb5e274159030f..8e623f05b5a2fefa6f38df6a973770cebc40bdc6 100644 (file)
@@ -84,10 +84,10 @@ intel_miptree_create_for_teximage(struct intel_context *intel,
          intelImage->base.Base.Level == firstLevel &&
          (intel->gen < 4 || firstLevel == 0)) {
         lastLevel = firstLevel;
-      } else if (intelObj->base.Target == GL_TEXTURE_EXTERNAL_OES) {
-        lastLevel = firstLevel;
       } else {
-        lastLevel = firstLevel + _mesa_logbase2(MAX2(MAX2(width, height), depth));
+        lastLevel = (firstLevel +
+                      _mesa_get_tex_max_num_levels(intelObj->base.Target,
+                                                   width, height, depth) - 1);
       }
    }