intel: fix broken sw generate mipmap path
authorBrian Paul <brianp@vmware.com>
Tue, 13 Oct 2009 16:37:39 +0000 (10:37 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 13 Oct 2009 16:38:34 +0000 (10:38 -0600)
Need to restore code that fixed up the intel_texture_image state.

src/mesa/drivers/dri/intel/intel_tex.c

index 3cbc379dbd32a0cb31b3741887907fb93e6fac97..215a534a5c53105a61b2d0e579c5ec79f458088f 100644 (file)
@@ -177,6 +177,28 @@ intelGenerateMipmap(GLcontext *ctx, GLenum target,
       intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel);
       _mesa_generate_mipmap(ctx, target, texObj);
       intel_tex_unmap_level_images(intel, intelObj, texObj->BaseLevel);
+
+      {
+         GLuint nr_faces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+         GLuint face, i;
+         /* Update the level information in our private data in the new images,
+          * since it didn't get set as part of a normal TexImage path.
+          */
+         for (face = 0; face < nr_faces; face++) {
+            for (i = texObj->BaseLevel + 1; i < texObj->MaxLevel; i++) {
+               struct intel_texture_image *intelImage =
+                  intel_texture_image(texObj->Image[face][i]);
+               if (!intelImage)
+                  break;
+               intelImage->level = i;
+               intelImage->face = face;
+               /* Unreference the miptree to signal that the new Data is a
+                * bare pointer from mesa.
+                */
+               intel_miptree_release(intel, &intelImage->mt);
+            }
+         }
+      }
    }
    else {
       _mesa_meta_GenerateMipmap(ctx, target, texObj);