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/validationES.cpp b/src/libANGLE/validationES.cpp
index 8019422..1896138 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -1407,7 +1407,8 @@
const VertexArray *vao = state.getVertexArray();
const auto &vertexAttribs = vao->getVertexAttributes();
const int *semanticIndexes = program->getSemanticIndexes();
- for (size_t attributeIndex = 0; attributeIndex < vertexAttribs.size(); ++attributeIndex)
+ unsigned int maxEnabledAttrib = vao->getMaxEnabledAttribute();
+ for (size_t attributeIndex = 0; attributeIndex < maxEnabledAttrib; ++attributeIndex)
{
const VertexAttribute &attrib = vertexAttribs[attributeIndex];
bool attribActive = (semanticIndexes[attributeIndex] != -1);