fix up heights for i830/i915 texture compression
authorDave Airlie <airliedfreedesktop.org>
Thu, 15 Jul 2004 10:47:13 +0000 (10:47 +0000)
committerDave Airlie <airliedfreedesktop.org>
Thu, 15 Jul 2004 10:47:13 +0000 (10:47 +0000)
src/mesa/drivers/dri/i915/i830_texstate.c
src/mesa/drivers/dri/i915/i915_texstate.c

index 476ee1939173464bb54b83e801259afa8152cc93..39ba0b8ec31690a25b67a78eb2d892ffcbf41f35 100644 (file)
@@ -157,7 +157,15 @@ static GLboolean i830SetTexImages( i830ContextPtr i830,
       
       t->intel.image[0][i].offset = total_height * pitch;
       t->intel.image[0][i].internalFormat = baseImage->Format;
-      total_height += MAX2(2, t->intel.image[0][i].image->Height);
+      if (t->intel.image[0][i].image->IsCompressed)
+       {
+         if (t->intel.image[0][i].image->Height > 4)
+           total_height += t->intel.image[0][i].image->Height/4;
+         else
+           total_height += 1;
+       }
+      else
+       total_height += MAX2(2, t->intel.image[0][i].image->Height);
    }
 
    t->intel.Pitch = pitch;
index ec8f1fa2029789daac21fffe130ca4256e4eb5fc..60ba0629528a838f1e42e412223f1519c11e774d 100644 (file)
@@ -238,7 +238,15 @@ static void i915SetTexImages( i915ContextPtr i915,
         
         t->intel.image[0][i].offset = total_height * pitch;
         t->intel.image[0][i].internalFormat = baseImage->Format;
-        total_height += MAX2(2, t->intel.image[0][i].image->Height);
+        if (t->intel.image[0][i].image->IsCompressed)
+        {
+          if (t->intel.image[0][i].image->Height > 4)
+            total_height += t->intel.image[0][i].image->Height/4;
+          else
+            total_height += 1;
+        }
+        else
+          total_height += MAX2(2, t->intel.image[0][i].image->Height);
       }
       break;
    }