Add a helper method to return the number of components in a texture format.

TRAC #23841

Signed-off-by: Geoff Lang
Signed-off-by: Shannon Woods
diff --git a/src/libGLESv2/formatutils.cpp b/src/libGLESv2/formatutils.cpp
index 341c560..0526af4 100644
--- a/src/libGLESv2/formatutils.cpp
+++ b/src/libGLESv2/formatutils.cpp
@@ -1344,6 +1344,20 @@
     }
 }
 
+GLuint GetComponentCount(GLint internalFormat, GLuint clientVersion)
+{
+    InternalFormatInfo internalFormatInfo;
+    if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+    {
+        return internalFormatInfo.mComponentCount;
+    }
+    else
+    {
+        UNREACHABLE();
+        return false;
+    }
+}
+
 GLenum GetColorEncoding(GLint internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;