The 'format' of unsized SRGB internal formats should be SRGB too.

EXT_sRGB requires calling TexImage with SRGB as the 'format' parameter.
This was causing issues when we would take an InternalFormat struct
representing an unsized sRGB format and be unable to use it's format
member to make GL calls without transforming it.

BUG=693090

Change-Id: I8b9baf2591a998a0088e5275f42ffc568e37100d
Reviewed-on: https://chromium-review.googlesource.com/984965
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index d211970..364de0c 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -6139,10 +6139,10 @@
     }
 
     // ES3 and WebGL grant mipmap generation for sRGBA (with alpha) textures but GL_EXT_sRGB does
-    // not.
-    bool supportsSRGBMipmapGeneration =
-        context->getClientVersion() >= ES_3_0 || context->getExtensions().webglCompatibility;
-    if (!supportsSRGBMipmapGeneration && format.colorEncoding == GL_SRGB)
+    // 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)
     {
         ANGLE_VALIDATION_ERR(context, InvalidOperation(), GenerateMipmapNotAllowed);
         return false;