[Mesa-dev] [PATCH 2/2] intel: Use core mesa support for determining lastLevel.

Eric Anholt eric at anholt.net
Tue Nov 13 13:04:41 PST 2012


We had similar issues with using depth in determining the lastLevel of array
textures.
---
 src/mesa/drivers/dri/intel/intel_tex_image.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 7b9638f..8e623f0 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -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);
       }
    }
 
-- 
1.7.10.4



More information about the mesa-dev mailing list