intel: Make the intel_miptree_match_image format check more specific.
authorEric Anholt <eric@anholt.net>
Thu, 9 Jun 2011 17:00:59 +0000 (10:00 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 14 Jun 2011 18:17:38 +0000 (11:17 -0700)
We don't care just about the internalFormat/cpp/compressed, but about
the specific format chosen.  We have no support for format
translations as part of texture validation, and furthermore it has
restrictions in the GL specification.  However, we should be making
consistent decisions for this check anyway.

src/mesa/drivers/dri/intel/intel_mipmap_tree.c
src/mesa/drivers/dri/intel/intel_tex_validate.c

index c8ad1a7d34d1eec39097a438edbc2611cd165e78..c190f0fb789ba42e2967f52286f8a4a0ef563c3f 100644 (file)
@@ -227,7 +227,6 @@ GLboolean
 intel_miptree_match_image(struct intel_mipmap_tree *mt,
                           struct gl_texture_image *image)
 {
-   GLboolean isCompressed = _mesa_is_format_compressed(image->TexFormat);
    struct intel_texture_image *intelImage = intel_texture_image(image);
    GLuint level = intelImage->level;
 
@@ -235,13 +234,7 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt,
    if (image->Border)
       return GL_FALSE;
 
-   if (image->InternalFormat != mt->internal_format ||
-       isCompressed != mt->compressed)
-      return GL_FALSE;
-
-   if (!isCompressed &&
-       !mt->compressed &&
-       _mesa_get_format_bytes(image->TexFormat) != mt->cpp)
+   if (image->TexFormat != mt->format)
       return GL_FALSE;
 
    /* Test image dimensions against the base level image adjusted for
index fea61621dd0cf961a81b2e37cc4d41df17458618..e833c15af5c5bbdf74a50301c4f70b8308c4b728 100644 (file)
@@ -118,14 +118,12 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
     */
    if (intelObj->mt &&
        (intelObj->mt->target != intelObj->base.Target ||
-       intelObj->mt->internal_format != firstImage->base.InternalFormat ||
+       intelObj->mt->format != firstImage->base.TexFormat ||
        intelObj->mt->first_level != tObj->BaseLevel ||
        intelObj->mt->last_level < intelObj->_MaxLevel ||
        intelObj->mt->width0 != firstImage->base.Width ||
        intelObj->mt->height0 != firstImage->base.Height ||
-       intelObj->mt->depth0 != firstImage->base.Depth ||
-       intelObj->mt->cpp != cpp ||
-       intelObj->mt->compressed != _mesa_is_format_compressed(firstImage->base.TexFormat))) {
+       intelObj->mt->depth0 != firstImage->base.Depth)) {
       intel_miptree_release(intel, &intelObj->mt);
    }