intel/blorp: Properly handle color compression in blorp_copy
[mesa.git] / src / mesa / main / genmipmap.c
index 5e780c97ca8fb1c9f41b9e8d717c62e468fdbcf6..6021c026f53915c95a0859cb176fc98cd98a1fee 100644 (file)
@@ -65,8 +65,7 @@ _mesa_is_valid_generate_texture_mipmap_target(struct gl_context *ctx,
          || !ctx->Extensions.EXT_texture_array;
       break;
    case GL_TEXTURE_CUBE_MAP_ARRAY:
-      error = _mesa_is_gles(ctx) ||
-              !ctx->Extensions.ARB_texture_cube_map_array;
+      error = !_mesa_has_texture_cube_map_array(ctx);
       break;
    default:
       error = true;
@@ -85,10 +84,15 @@ _mesa_is_valid_generate_texture_mipmap_internalformat(struct gl_context *ctx,
        *  not specified with an unsized internal format from table 8.3 or a
        *  sized internal format that is both color-renderable and
        *  texture-filterable according to table 8.10."
+       *
+       * GL_EXT_texture_format_BGRA8888 adds a GL_BGRA_EXT unsized internal
+       * format, and includes it in a very similar looking table.  So we
+       * include it here as well.
        */
       return internalformat == GL_RGBA || internalformat == GL_RGB ||
              internalformat == GL_LUMINANCE_ALPHA ||
              internalformat == GL_LUMINANCE || internalformat == GL_ALPHA ||
+             internalformat == GL_BGRA_EXT ||
              (_mesa_is_es3_color_renderable(internalformat) &&
               _mesa_is_es3_texture_filterable(ctx, internalformat));
    }
@@ -144,6 +148,11 @@ _mesa_generate_texture_mipmap(struct gl_context *ctx,
       return;
    }
 
+   if (srcImage->Width == 0 || srcImage->Height == 0) {
+      _mesa_unlock_texture(ctx, texObj);
+      return;
+   }
+
    if (target == GL_TEXTURE_CUBE_MAP) {
       GLuint face;
       for (face = 0; face < 6; face++) {