Simplify formatutils.h by exposing the info structures.

Removed all the separate query functions and simply expose the internal
info structures.  This reduces the number of std::map/std::set operations
that were hidden behind the API.

Moved the validation tables for ES3 format combinations and effective
internal formats into validationES3.cpp so that formatutils.h only has
generic GL format queries.

BUG=angle:658

Change-Id: Ieb60d42b8eafcdb4f21dcbec130b39478ce5f7c5
Reviewed-on: https://chromium-review.googlesource.com/206835
Reviewed-by: Nicolas Capens <capn@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/Framebuffer.cpp b/src/libGLESv2/Framebuffer.cpp
index f808175..30b042e 100644
--- a/src/libGLESv2/Framebuffer.cpp
+++ b/src/libGLESv2/Framebuffer.cpp
@@ -364,6 +364,7 @@
             GLenum internalformat = colorbuffer->getInternalFormat();
             // TODO(geofflang): use context's texture caps
             const TextureCaps &formatCaps = mRenderer->getRendererTextureCaps().get(internalformat);
+            const InternalFormat &formatInfo = GetInternalFormatInfo(internalformat);
             if (colorbuffer->isTexture())
             {
                 if (!formatCaps.renderable)
@@ -371,14 +372,14 @@
                     return GL_FRAMEBUFFER_UNSUPPORTED;
                 }
 
-                if (gl::GetDepthBits(internalformat) > 0 || gl::GetStencilBits(internalformat) > 0)
+                if (formatInfo.depthBits > 0 || formatInfo.stencilBits > 0)
                 {
                     return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
                 }
             }
             else
             {
-                if (!formatCaps.renderable || gl::GetDepthBits(internalformat) > 0 || gl::GetStencilBits(internalformat) > 0)
+                if (!formatCaps.renderable || formatInfo.depthBits > 0 || formatInfo.stencilBits > 0)
                 {
                     return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
                 }
@@ -403,7 +404,7 @@
                 // in GLES 3.0, there is no such restriction
                 if (clientVersion < 3)
                 {
-                    if (gl::GetPixelBytes(colorbuffer->getInternalFormat()) != colorbufferSize)
+                    if (formatInfo.pixelBytes != colorbufferSize)
                     {
                         return GL_FRAMEBUFFER_UNSUPPORTED;
                     }
@@ -427,7 +428,7 @@
                 width = colorbuffer->getWidth();
                 height = colorbuffer->getHeight();
                 samples = colorbuffer->getSamples();
-                colorbufferSize = gl::GetPixelBytes(colorbuffer->getInternalFormat());
+                colorbufferSize = formatInfo.pixelBytes;
                 missingAttachment = false;
             }
         }
@@ -443,10 +444,9 @@
         GLenum internalformat = mDepthbuffer->getInternalFormat();
         // TODO(geofflang): use context's texture caps
         const TextureCaps &formatCaps = mRenderer->getRendererTextureCaps().get(internalformat);
+        const InternalFormat &formatInfo = GetInternalFormatInfo(internalformat);
         if (mDepthbuffer->isTexture())
         {
-            GLenum internalformat = mDepthbuffer->getInternalFormat();
-
             // depth texture attachments require OES/ANGLE_depth_texture
             // TODO(geofflang): use context's extensions
             if (!mRenderer->getRendererExtensions().depthTextures)
@@ -459,14 +459,14 @@
                 return GL_FRAMEBUFFER_UNSUPPORTED;
             }
 
-            if (gl::GetDepthBits(internalformat) == 0)
+            if (formatInfo.depthBits == 0)
             {
                 return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
             }
         }
         else
         {
-            if (!formatCaps.renderable || gl::GetDepthBits(internalformat) == 0)
+            if (!formatCaps.renderable || formatInfo.depthBits == 0)
             {
                 return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
             }
@@ -499,10 +499,9 @@
         GLenum internalformat = mStencilbuffer->getInternalFormat();
         // TODO(geofflang): use context's texture caps
         const TextureCaps &formatCaps = mRenderer->getRendererTextureCaps().get(internalformat);
+        const InternalFormat &formatInfo = GetInternalFormatInfo(internalformat);
         if (mStencilbuffer->isTexture())
         {
-            GLenum internalformat = mStencilbuffer->getInternalFormat();
-
             // texture stencil attachments come along as part
             // of OES_packed_depth_stencil + OES/ANGLE_depth_texture
             // TODO(geofflang): use context's extensions
@@ -516,14 +515,14 @@
                 return GL_FRAMEBUFFER_UNSUPPORTED;
             }
 
-            if (gl::GetStencilBits(internalformat) == 0)
+            if (formatInfo.stencilBits == 0)
             {
                 return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
             }
         }
         else
         {
-            if (!formatCaps.renderable || gl::GetStencilBits(internalformat) == 0)
+            if (!formatCaps.renderable || formatInfo.stencilBits == 0)
             {
                 return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
             }