Optimizing updatecachedInputLayout to not update inactive vertex attribs
BUG=angleproject:1158 part a
We only need to iterate and update the active attributes in a program.
This can further be optimized by updating the cache more intelligently,
possibly by marking attributes as "need update" when necessary
Change-Id: I41e9c033116582c82a56b8d20ea245f06e8fa3d1
Reviewed-on: https://chromium-review.googlesource.com/299758
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tryjob-Request: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/ProgramD3D.cpp b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
index 1ece8ca..6cb5c14 100644
--- a/src/libANGLE/renderer/d3d/ProgramD3D.cpp
+++ b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
@@ -8,6 +8,7 @@
#include "libANGLE/renderer/d3d/ProgramD3D.h"
+#include "common/BitSetIterator.h"
#include "common/utilities.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/FramebufferAttachment.h"
@@ -1970,7 +1971,7 @@
mCachedInputLayout.clear();
const auto &vertexAttributes = state.getVertexArray()->getVertexAttributes();
- for (unsigned int attributeIndex = 0; attributeIndex < vertexAttributes.size(); attributeIndex++)
+ for (unsigned int attributeIndex : angle::IterateBitSet(mData.getActiveAttribLocationsMask()))
{
int semanticIndex = mSemanticIndexes[attributeIndex];