Refactor the staticUse checks for attribute and output
Remove these needless checks as GetActiveShaderVariables in Shader.cpp has
filtered them already.
BUG=angleproject:1920
Change-Id: Ife85614a8f636768dd585a827bca81e2f15009c8
Reviewed-on: https://chromium-review.googlesource.com/454129
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index c1c5605..4770a8d 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -1140,7 +1140,7 @@
{
for (const sh::Attribute &attribute : mState.mAttributes)
{
- if (attribute.name == name && attribute.staticUse)
+ if (attribute.name == name)
{
return attribute.location;
}
@@ -1174,23 +1174,8 @@
return;
}
- size_t attributeIndex = 0;
-
- for (const sh::Attribute &attribute : mState.mAttributes)
- {
- // Skip over inactive attributes
- if (attribute.staticUse)
- {
- if (static_cast<size_t>(index) == attributeIndex)
- {
- break;
- }
- attributeIndex++;
- }
- }
-
- ASSERT(index == attributeIndex && attributeIndex < mState.mAttributes.size());
- const sh::Attribute &attrib = mState.mAttributes[attributeIndex];
+ ASSERT(index < mState.mAttributes.size());
+ const sh::Attribute &attrib = mState.mAttributes[index];
if (bufsize > 0)
{
@@ -1217,14 +1202,7 @@
return 0;
}
- GLint count = 0;
-
- for (const sh::Attribute &attrib : mState.mAttributes)
- {
- count += (attrib.staticUse ? 1 : 0);
- }
-
- return count;
+ return static_cast<GLint>(mState.mAttributes.size());
}
GLint Program::getActiveAttributeMaxLength() const
@@ -1238,10 +1216,7 @@
for (const sh::Attribute &attrib : mState.mAttributes)
{
- if (attrib.staticUse)
- {
- maxLength = std::max(attrib.name.length() + 1, maxLength);
- }
+ maxLength = std::max(attrib.name.length() + 1, maxLength);
}
return static_cast<GLint>(maxLength);
@@ -1983,9 +1958,6 @@
// Link attributes that have a binding location
for (sh::Attribute &attribute : mState.mAttributes)
{
- // TODO(jmadill): do staticUse filtering step here, or not at all
- ASSERT(attribute.staticUse);
-
int bindingLocation = mAttributeBindings.getBinding(attribute.name);
if (attribute.location == -1 && bindingLocation != -1)
{
@@ -2035,8 +2007,6 @@
// Link attributes that don't have a binding location
for (sh::Attribute &attribute : mState.mAttributes)
{
- ASSERT(attribute.staticUse);
-
// Not set by glBindAttribLocation or by location layout qualifier
if (attribute.location == -1)
{
@@ -2055,7 +2025,6 @@
for (const sh::Attribute &attribute : mState.mAttributes)
{
- ASSERT(attribute.staticUse);
ASSERT(attribute.location != -1);
int regs = VariableRegisterCount(attribute.type);
@@ -2552,8 +2521,6 @@
// Since multiple output locations must be specified, use 0 for non-specified locations.
int baseLocation = (outputVariable.location == -1 ? 0 : outputVariable.location);
- ASSERT(outputVariable.staticUse);
-
for (unsigned int elementIndex = 0; elementIndex < outputVariable.elementCount();
elementIndex++)
{