Change the component type of STENCIL_INDEX8 to UNSIGNED_NORMALIZED

That way RenderbufferStorageMultisample accepts STENCIL_INDEX8 as
an internal format for a multisampled buffer (samples > 0) as it
isn't concerned by the restriction on integer component types anymore.
This is consistent with the component type returned by the NVIDIA driver.

BUG=angle:812

Change-Id: Ic03f502ffa082b1011e8127213a5c1df0617ef43
Reviewed-on: https://chromium-review.googlesource.com/227470
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Shannon Woods <shannonwoods@chromium.org>
diff --git a/src/libGLESv2/validationES3.cpp b/src/libGLESv2/validationES3.cpp
index 2d3a039..08f3225 100644
--- a/src/libGLESv2/validationES3.cpp
+++ b/src/libGLESv2/validationES3.cpp
@@ -1187,6 +1187,33 @@
     return true;
 }
 
+bool ValidateES3RenderbufferStorageParameters(gl::Context *context, GLenum target, GLsizei samples,
+                                              GLenum internalformat, GLsizei width, GLsizei height)
+{
+    if (!ValidateRenderbufferStorageParametersBase(context, target, samples, internalformat, width, height))
+    {
+        return false;
+    }
+
+    //The ES3 spec(section 4.4.2) states that the internal format must be sized and not an integer format if samples is greater than zero.
+    const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat);
+    if ((formatInfo.componentType == GL_UNSIGNED_INT || formatInfo.componentType == GL_INT) && samples > 0)
+    {
+        context->recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    // The behavior is different than the ANGLE version, which would generate a GL_OUT_OF_MEMORY.
+    const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
+    if (static_cast<GLuint>(samples) > formatCaps.getMaxSamples())
+    {
+        context->recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    return true;
+}
+
 bool ValidateInvalidateFramebufferParameters(Context *context, GLenum target, GLsizei numAttachments,
                                              const GLenum* attachments)
 {