Micro-optimize ValidateDrawBase.
This speeds up our draw call benchmark.
BUG=angleproject:959
Change-Id: I9a916a6c344493cc96873ae5f4ec337c181dc487
Reviewed-on: https://chromium-review.googlesource.com/266026
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 3f59e21..b1685c7 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -1401,10 +1401,12 @@
// Buffer validations
const VertexArray *vao = state.getVertexArray();
- for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
+ const auto &vertexAttribs = vao->getVertexAttributes();
+ const int *semanticIndexes = program->getSemanticIndexes();
+ for (size_t attributeIndex = 0; attributeIndex < vertexAttribs.size(); ++attributeIndex)
{
- const VertexAttribute &attrib = vao->getVertexAttribute(attributeIndex);
- bool attribActive = (program->getSemanticIndex(attributeIndex) != -1);
+ const VertexAttribute &attrib = vertexAttribs[attributeIndex];
+ bool attribActive = (semanticIndexes[attributeIndex] != -1);
if (attribActive && attrib.enabled)
{
gl::Buffer *buffer = attrib.buffer.get();