mesa: Add draw time validation for advanced blending modes.
[mesa.git] / src / mesa / main / genmipmap.c
index 1a6ae9a5f3c26892c9b1c6105a6d68f29d0cc7d5..97d3c62b7bbc397f257aeeeeded0279657f99236 100644 (file)
@@ -85,12 +85,17 @@ _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(internalformat));
+              _mesa_is_es3_texture_filterable(ctx, internalformat));
    }
 
    return (!_mesa_is_enum_format_integer(internalformat) &&
@@ -139,7 +144,13 @@ _mesa_generate_texture_mipmap(struct gl_context *ctx,
                                                               srcImage->InternalFormat)) {
       _mesa_unlock_texture(ctx, texObj);
       _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glGenerate%sMipmap(invalid internal format)", suffix);
+                  "glGenerate%sMipmap(invalid internal format %s)", suffix,
+                  _mesa_enum_to_string(srcImage->InternalFormat));
+      return;
+   }
+
+   if (srcImage->Width == 0 || srcImage->Height == 0) {
+      _mesa_unlock_texture(ctx, texObj);
       return;
    }