st/gl: Fix mip gen for compressed textures
authorJakob Bornecrantz <jakob@vmware.com>
Wed, 13 May 2009 20:35:06 +0000 (22:35 +0200)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 2 Jun 2009 01:40:12 +0000 (18:40 -0700)
src/mesa/state_tracker/st_cb_texture.c

index b182106fd56e32df9a47cb8af6102376604c5340..aaed155925d49b80bcaf02336e49e7896a9c3e91 100644 (file)
@@ -673,7 +673,7 @@ st_TexImage(GLcontext * ctx,
                                    PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
       if (compress_with_blit(ctx, target, level, 0, 0, 0, width, height, depth,
                              format, type, pixels, unpack, texImage)) {
-         return;
+         goto done;
       }
    }
 
@@ -750,6 +750,7 @@ st_TexImage(GLcontext * ctx,
 
    _mesa_unmap_teximage_pbo(ctx, unpack);
 
+done:
    if (stImage->pt && texImage->Data) {
       st_texture_image_unmap(ctx->st, stImage);
       texImage->Data = NULL;
@@ -1061,7 +1062,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
                              xoffset, yoffset, zoffset,
                              width, height, depth,
                              format, type, pixels, packing, texImage)) {
-         return;
+         goto done;
       }
    }
 
@@ -1110,16 +1111,17 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
       }
    }
 
-   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      ctx->Driver.GenerateMipmap(ctx, target, texObj);
-   }
-
    _mesa_unmap_teximage_pbo(ctx, packing);
 
+done:
    if (stImage->pt) {
       st_texture_image_unmap(ctx->st, stImage);
       texImage->Data = NULL;
    }
+
+   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+      ctx->Driver.GenerateMipmap(ctx, target, texObj);
+   }
 }