Optimize Vertex Shader Attribute Type Validition
Improves ValidateVertexShaderAttributeTypeMatch by storing vertex
attributes types into masks for quick comparisons when needed. This shows
2% improvement to glDrawElements for the aquarium workload.
BUG=angleproject:2202
Change-Id: I87fa3d30c3d8cdba6dfd936cd1a41fd27b1c6b77
Reviewed-on: https://chromium-review.googlesource.com/814795
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/State.cpp b/src/libANGLE/State.cpp
index 93953c7..d4085c4 100644
--- a/src/libANGLE/State.cpp
+++ b/src/libANGLE/State.cpp
@@ -142,6 +142,12 @@
mVertexAttribCurrentValues.resize(caps.maxVertexAttributes);
+ // Set all indexes in state attributes type mask to float (default)
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ mCurrentValuesTypeMask.setIndex(GL_FLOAT, i);
+ }
+
mUniformBuffers.resize(caps.maxUniformBufferBindings);
mSamplerTextures[GL_TEXTURE_2D].resize(caps.maxCombinedTextureImageUnits);
@@ -1371,6 +1377,7 @@
mVertexAttribCurrentValues[index].setFloatValues(values);
mDirtyBits.set(DIRTY_BIT_CURRENT_VALUES);
mDirtyCurrentValues.set(index);
+ mCurrentValuesTypeMask.setIndex(GL_FLOAT, index);
}
void State::setVertexAttribu(GLuint index, const GLuint values[4])
@@ -1379,6 +1386,7 @@
mVertexAttribCurrentValues[index].setUnsignedIntValues(values);
mDirtyBits.set(DIRTY_BIT_CURRENT_VALUES);
mDirtyCurrentValues.set(index);
+ mCurrentValuesTypeMask.setIndex(GL_UNSIGNED_INT, index);
}
void State::setVertexAttribi(GLuint index, const GLint values[4])
@@ -1387,6 +1395,7 @@
mVertexAttribCurrentValues[index].setIntValues(values);
mDirtyBits.set(DIRTY_BIT_CURRENT_VALUES);
mDirtyCurrentValues.set(index);
+ mCurrentValuesTypeMask.setIndex(GL_INT, index);
}
void State::setVertexAttribPointer(const Context *context,