Cache maximum enabled vertex attribute.

This can give us much faster draw call validation, by saving us from
checking buffer sizes for non-enabled attribs. Also for checking if
vertex buffers are mapped. Gives >100% increase in the benchmark.

BUG=angleproject:959

Change-Id: I211c310385bdee46ed06f68ecd9c98385e1f8db9
Reviewed-on: https://chromium-review.googlesource.com/267751
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
diff --git a/src/libANGLE/State.cpp b/src/libANGLE/State.cpp
index e5eb018..e1ef393 100644
--- a/src/libANGLE/State.cpp
+++ b/src/libANGLE/State.cpp
@@ -1418,7 +1418,8 @@
     {
         const VertexArray *vao = getVertexArray();
         const auto &vertexAttribs = vao->getVertexAttributes();
-        for (size_t attribIndex = 0; attribIndex < vertexAttribs.size(); attribIndex++)
+        unsigned int maxEnabledAttrib = vao->getMaxEnabledAttribute();
+        for (size_t attribIndex = 0; attribIndex < maxEnabledAttrib; attribIndex++)
         {
             const gl::VertexAttribute &vertexAttrib = vertexAttribs[attribIndex];
             gl::Buffer *boundBuffer = vertexAttrib.buffer.get();