Small optimization to VertexDataManager.
Avoid calling a getter repeatedly in a loop, when we can instead
store a local reference to an array.
BUG=angleproject:959
Change-Id: I507ad1a6cf3bb6183dd3499df024dfec6950a6c8
Reviewed-on: https://chromium-review.googlesource.com/277285
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
index d4f8c82..bf49c20 100644
--- a/src/libANGLE/renderer/d3d/VertexDataManager.cpp
+++ b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
@@ -130,6 +130,7 @@
// Compute active enabled and active disable attributes, for speed.
// TODO(jmadill): don't recompute if there was no state change
const gl::VertexArray *vertexArray = state.getVertexArray();
+ const int *semanticIndexes = state.getProgram()->getSemanticIndexes();
const std::vector<gl::VertexAttribute> &vertexAttributes = vertexArray->getVertexAttributes();
mActiveEnabledAttributes.clear();
@@ -137,7 +138,7 @@
for (size_t attribIndex = 0; attribIndex < vertexAttributes.size(); ++attribIndex)
{
- translated[attribIndex].active = (state.getProgram()->getSemanticIndex(attribIndex) != -1);
+ translated[attribIndex].active = (semanticIndexes[attribIndex] != -1);
if (translated[attribIndex].active)
{
// Record the attribute now