Allow glGenerateMipmaps on sRGB textures in WebGL.
The generated mipmaps are still not correct on all ANGLE backends.
TEST=conformance/extensions/ext-sRGB
BUG=angleproject:2009
Change-Id: I6299dcb93c71f48e61ec660347b4747366ecfb71
Reviewed-on: https://chromium-review.googlesource.com/491367
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index b4fdb1e..1d73ae1 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -5554,10 +5554,13 @@
return false;
}
- // GL_EXT_sRGB does not support mipmap generation on sRGB textures
- if (context->getClientMajorVersion() == 2 && format.info->colorEncoding == GL_SRGB)
+ // ES3 and WebGL grant mipmap generation for sRGB textures but GL_EXT_sRGB does not.
+ bool supportsSRGBMipmapGeneration =
+ context->getClientVersion() >= ES_3_0 || context->getExtensions().webglCompatibility;
+ if (!supportsSRGBMipmapGeneration && format.info->colorEncoding == GL_SRGB)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(
+ Error(GL_INVALID_OPERATION, "Mipmap generation of sRGB textures is not allowed."));
return false;
}