[i915] fix texture size exceed limit case when running celestia
authorZou Nan hai <nanhai.zou@intel.com>
Tue, 26 Feb 2008 09:20:12 +0000 (17:20 +0800)
committerZou Nan hai <nanhai.zou@intel.com>
Tue, 26 Feb 2008 09:20:12 +0000 (17:20 +0800)
src/mesa/drivers/dri/intel/intel_mipmap_tree.c

index 941f7a697c3407c3fc58516e848a7e8913117e3e..3209545adcb37f5e1340dd229fbebd124712fb1c 100644 (file)
@@ -180,6 +180,7 @@ int intel_miptree_pitch_align (struct intel_context *intel,
                               struct intel_mipmap_tree *mt,
                               int pitch)
 {
+   GLcontext *ctx = &intel->ctx;
    if (!mt->compressed) {
       int pitch_align;
 
@@ -201,7 +202,8 @@ int intel_miptree_pitch_align (struct intel_context *intel,
        * of 1024 and sometimes 512 bytes - performance can drop by several
        * times. Go to the next multiple of the required alignment for now.
        */
-      if (!(pitch & 511))
+      if (!(pitch & 511) && 
+        (pitch + pitch_align) < (1 << ctx->Const.MaxTextureLevels))
         pitch += pitch_align;
 #endif