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/tests/angle_tests/FramebufferFormatsTest.cpp b/tests/angle_tests/FramebufferFormatsTest.cpp
index 53eaaba..8391752 100644
--- a/tests/angle_tests/FramebufferFormatsTest.cpp
+++ b/tests/angle_tests/FramebufferFormatsTest.cpp
@@ -1,7 +1,7 @@
 #include "ANGLETest.h"
 
 // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
-ANGLE_TYPED_TEST_CASE(FramebufferFormatsTest, ES2_D3D9, ES2_D3D11);
+ANGLE_TYPED_TEST_CASE(FramebufferFormatsTest, ES2_D3D9, ES2_D3D11, ES3_D3D11);
 
 template<typename T>
 class FramebufferFormatsTest : public ANGLETest
@@ -64,6 +64,56 @@
         glDeleteFramebuffers(1, &fbo);
     }
 
+    void testRenderbufferMultisampleFormat(int minESVersion, GLenum attachmentType, GLenum internalFormat)
+    {
+        if (T::GetGlesMajorVersion() < minESVersion)
+        {
+            return;
+        }
+
+        // Check that multisample is supported with at least two samples (minimum required is 1)
+        bool supports2Samples = false;
+
+        if (T::GetGlesMajorVersion() == 2)
+        {
+            if (extensionEnabled("ANGLE_framebuffer_multisample"))
+            {
+                int maxSamples;
+                glGetIntegerv(GL_MAX_SAMPLES_ANGLE, &maxSamples);
+                supports2Samples = maxSamples >= 2;
+            }
+        }
+        else
+        {
+            assert(T::GetGlesMajorVersion() >= 3);
+            int maxSamples;
+            glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
+            supports2Samples = maxSamples >= 2;
+        }
+
+        if (!supports2Samples)
+        {
+            return;
+        }
+
+        GLuint framebufferID;
+        glGenFramebuffers(1, &framebufferID);
+        glBindFramebuffer(GL_FRAMEBUFFER, framebufferID);
+
+        GLuint renderbufferID;
+        glGenRenderbuffers(1, &renderbufferID);
+        glBindRenderbuffer(GL_RENDERBUFFER, renderbufferID);
+
+        EXPECT_GL_NO_ERROR();
+        glRenderbufferStorageMultisampleANGLE(GL_RENDERBUFFER, 2, internalFormat, 128, 128);
+        EXPECT_GL_NO_ERROR();
+        glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachmentType, GL_RENDERBUFFER, renderbufferID);
+        EXPECT_GL_NO_ERROR();
+
+        glDeleteRenderbuffers(1, &renderbufferID);
+        glDeleteFramebuffers(1, &framebufferID);
+    }
+
     virtual void SetUp()
     {
         ANGLETest::SetUp();
@@ -100,3 +150,32 @@
     testTextureFormat(GL_RGBA8_OES, 8, 8, 8, 8);
 }
 
+TYPED_TEST(FramebufferFormatsTest, RenderbufferMultisample_DEPTH16)
+{
+    testRenderbufferMultisampleFormat(2, GL_DEPTH_ATTACHMENT, GL_DEPTH_COMPONENT16);
+}
+
+TYPED_TEST(FramebufferFormatsTest, RenderbufferMultisample_DEPTH24)
+{
+    testRenderbufferMultisampleFormat(3, GL_DEPTH_ATTACHMENT, GL_DEPTH_COMPONENT24);
+}
+
+TYPED_TEST(FramebufferFormatsTest, RenderbufferMultisample_DEPTH32F)
+{
+    testRenderbufferMultisampleFormat(3, GL_DEPTH_ATTACHMENT, GL_DEPTH_COMPONENT32F);
+}
+
+TYPED_TEST(FramebufferFormatsTest, RenderbufferMultisample_DEPTH24_STENCIL8)
+{
+    testRenderbufferMultisampleFormat(3, GL_DEPTH_STENCIL_ATTACHMENT, GL_DEPTH24_STENCIL8);
+}
+
+TYPED_TEST(FramebufferFormatsTest, RenderbufferMultisample_DEPTH32F_STENCIL8)
+{
+    testRenderbufferMultisampleFormat(3, GL_DEPTH_STENCIL_ATTACHMENT, GL_DEPTH32F_STENCIL8);
+}
+
+TYPED_TEST(FramebufferFormatsTest, RenderbufferMultisample_STENCIL_INDEX8)
+{
+    testRenderbufferMultisampleFormat(2, GL_STENCIL_ATTACHMENT, GL_STENCIL_INDEX8);
+}