Merge remote-tracking branch 'origin/master' into pipe-video
[mesa.git] / src / mesa / drivers / dri / radeon / radeon_texture.c
index 8b1e34fe7669cdb122359654fc1d579e8545225d..ce0df32bfe43b69757f01ddc877f66f3ca051d56 100644 (file)
@@ -33,7 +33,9 @@
 #include "main/imports.h"
 #include "main/context.h"
 #include "main/enums.h"
+#include "main/mfeatures.h"
 #include "main/mipmap.h"
+#include "main/pbo.h"
 #include "main/texcompress.h"
 #include "main/texstore.h"
 #include "main/teximage.h"
@@ -247,6 +249,7 @@ static void radeon_generate_mipmap(struct gl_context *ctx, GLenum target,
        radeonTexObj* t = radeon_tex_obj(texObj);
        GLuint nr_faces = (t->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
        int i, face;
+       struct gl_texture_image *first_image;
 
        radeon_print(RADEON_TEXTURE, RADEON_VERBOSE,
                        "%s(%p, tex %p) Target type %s.\n",
@@ -255,6 +258,13 @@ static void radeon_generate_mipmap(struct gl_context *ctx, GLenum target,
 
        _mesa_generate_mipmap(ctx, target, texObj);
 
+       /* For the compressed case, we don't need to do the
+        * non-TexImage recovery path below.
+        */
+       first_image = texObj->Image[0][texObj->BaseLevel];
+       if (_mesa_is_format_compressed(first_image->TexFormat))
+               return;
+
        for (face = 0; face < nr_faces; face++) {
                for (i = texObj->BaseLevel + 1; i < texObj->MaxLevel; i++) {
                        radeon_texture_image *image;