GenerateMipmaps should generate INVALID_OPERATION in ES 2.0 with EXT_sRGB
According to the OpenGL extension spec EXT_sRGB.txt, EXT_SRGB is based on
ES 2.0 and generateMipmap is not allowed if texture format is SRGB_EXT or
SRGB_ALPHA_EXT.
BUG=769989
TEST=SRGBTextureTest.SRGBValidation*
TEST=SRGBTextureTest.SRGBAValidation*
Change-Id: Ic51da224fcd318187865a44630af6fca5c3ad2de
Reviewed-on: https://chromium-review.googlesource.com/1137924
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Yizhou Jiang <yizhou.jiang@intel.com>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index 0e87fc4..21d58fe 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -6129,11 +6129,9 @@
return false;
}
- // ES3 and WebGL grant mipmap generation for sRGBA (with alpha) textures but GL_EXT_sRGB does
- // not. Differentiate the ES3 format from the extension format by checking if the format is
- // sized, GL_EXT_sRGB does not add any sized formats.
- bool supportsSRGBMipmapGeneration = context->getExtensions().webglCompatibility;
- if (!supportsSRGBMipmapGeneration && !format.sized && format.colorEncoding == GL_SRGB)
+ // According to the OpenGL extension spec EXT_sRGB.txt, EXT_SRGB is based on ES 2.0 and
+ // generateMipmap is not allowed if texture format is SRGB_EXT or SRGB_ALPHA_EXT.
+ if (context->getClientVersion() < Version(3, 0) && format.colorEncoding == GL_SRGB)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), GenerateMipmapNotAllowed);
return false;