intel_finalize_mipmap_tree: Add more conditions for rebuilding mipmap trees.
authorMichel Dänzer <michel@tungstengraphics.com>
Thu, 14 Dec 2006 09:56:10 +0000 (10:56 +0100)
committerMichel Dänzer <michel@tungstengraphics.com>
Thu, 14 Dec 2006 10:04:10 +0000 (11:04 +0100)
These are taken from the i965 driver and fix corruption of some mipmap levels
under some circumsances with 945 chipsets at least.

Also flush the batchbuffer after copying data between trees, or some apps fail
an assertion elsewhere.

src/mesa/drivers/dri/i915tex/intel_tex_validate.c

index 5f82dfa19e6395f8212b121856ee59b4d9f1b2d7..e73c9c2f2188ea7d2b61828af9522a95933eb478 100644 (file)
@@ -2,6 +2,7 @@
 #include "macros.h"
 
 #include "intel_context.h"
+#include "intel_batchbuffer.h"
 #include "intel_mipmap_tree.h"
 #include "intel_tex.h"
 
@@ -155,9 +156,15 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
     * leaving the tree alone.
     */
    if (intelObj->mt &&
-       ((intelObj->mt->first_level > intelObj->firstLevel) ||
-        (intelObj->mt->last_level < intelObj->lastLevel) ||
-        (intelObj->mt->internal_format != firstImage->base.InternalFormat))) {
+       (intelObj->mt->target != intelObj->base.Target ||
+       intelObj->mt->internal_format != firstImage->base.InternalFormat ||
+       intelObj->mt->first_level != intelObj->firstLevel ||
+       intelObj->mt->last_level != intelObj->lastLevel ||
+       intelObj->mt->width0 != firstImage->base.Width ||
+       intelObj->mt->height0 != firstImage->base.Height ||
+       intelObj->mt->depth0 != firstImage->base.Depth ||
+       intelObj->mt->cpp != firstImage->base.TexFormat->TexelBytes ||
+       intelObj->mt->compressed != firstImage->base.IsCompressed)) {
       intel_miptree_release(intel, &intelObj->mt);
    }
 
@@ -198,6 +205,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
       }
    }
 
+   intel_batchbuffer_flush(intel->batch);
+
    return GL_TRUE;
 }