Optimize ShaderVariable::isBuiltIn.
This makes the check a bit faster, by inlining the prefix check.
Also some cleanups to ValidateVertexShaderAttributeTypeMatch.
BUG=angleproject:2202
Change-Id: Ifeab4cd85a91a1639a461f44776a68ac98c5bd79
Reviewed-on: https://chromium-review.googlesource.com/761240
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index a4e1a3a..5b9e41b 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -539,10 +539,13 @@
bool ValidateVertexShaderAttributeTypeMatch(ValidationContext *context)
{
+ const auto &glState = context->getGLState();
const Program *program = context->getGLState().getProgram();
const VertexArray *vao = context->getGLState().getVertexArray();
+ const auto &vertexAttribs = vao->getVertexAttributes();
+ const auto ¤tValues = glState.getVertexAttribCurrentValues();
- for (const auto &shaderAttribute : program->getAttributes())
+ for (const sh::Attribute &shaderAttribute : program->getAttributes())
{
// gl_VertexID and gl_InstanceID are active attributes but don't have a bound attribute.
if (shaderAttribute.isBuiltIn())
@@ -552,10 +555,9 @@
GLenum shaderInputType = VariableComponentType(shaderAttribute.type);
- const auto &attrib = vao->getVertexAttribute(shaderAttribute.location);
- const auto ¤tValue =
- context->getGLState().getVertexAttribCurrentValue(shaderAttribute.location);
- GLenum vertexType = attrib.enabled ? GetVertexAttributeBaseType(attrib) : currentValue.Type;
+ const auto &attrib = vertexAttribs[shaderAttribute.location];
+ GLenum vertexType = attrib.enabled ? GetVertexAttributeBaseType(attrib)
+ : currentValues[shaderAttribute.location].Type;
if (shaderInputType != GL_NONE && vertexType != GL_NONE && shaderInputType != vertexType)
{