Revert "Move shader attributes into Program shared data."
Once again a signed/unsigned mismatch warning in 32-bit.
src\libangle\renderer\gl\programgl.cpp(190) : warning C4018: '<' : signed/unsigned mismatch
BUG=angleproject:1123
This reverts commit 2d7731838722a53102e5086dba445e37f6e98d7e.
Change-Id: Icd26906ead1eaa06b4bd3ff7fc2b10bef4f46022
Reviewed-on: https://chromium-review.googlesource.com/295241
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/gl/ProgramGL.cpp b/src/libANGLE/renderer/gl/ProgramGL.cpp
index 1a070b6..56fed09 100644
--- a/src/libANGLE/renderer/gl/ProgramGL.cpp
+++ b/src/libANGLE/renderer/gl/ProgramGL.cpp
@@ -169,33 +169,34 @@
}
}
- for (const sh::Attribute &attribute : mData.getAttributes())
+ // Query the attribute information
+ GLint activeAttributeMaxLength = 0;
+ mFunctions->getProgramiv(mProgramID, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &activeAttributeMaxLength);
+
+ std::vector<GLchar> attributeNameBuffer(activeAttributeMaxLength);
+
+ GLint attributeCount = 0;
+ mFunctions->getProgramiv(mProgramID, GL_ACTIVE_ATTRIBUTES, &attributeCount);
+ for (GLint i = 0; i < attributeCount; i++)
{
- if (!attribute.staticUse)
- continue;
+ GLsizei attributeNameLength = 0;
+ GLint attributeSize = 0;
+ GLenum attributeType = GL_NONE;
+ mFunctions->getActiveAttrib(mProgramID, i, static_cast<GLsizei>(attributeNameBuffer.size()),
+ &attributeNameLength, &attributeSize, &attributeType,
+ &attributeNameBuffer[0]);
- GLint realLocation = mFunctions->getAttribLocation(mProgramID, attribute.name.c_str());
+ std::string attributeName(&attributeNameBuffer[0], attributeNameLength);
- // Some drivers optimize attributes more aggressively.
- if (realLocation == -1)
+ GLint location = mFunctions->getAttribLocation(mProgramID, attributeName.c_str());
+
+ // TODO: determine attribute precision
+ setShaderAttribute(static_cast<size_t>(i), attributeType, GL_NONE, attributeName, attributeSize, location);
+
+ int attributeRegisterCount = gl::VariableRegisterCount(attributeType);
+ for (int offset = 0; offset < attributeRegisterCount; offset++)
{
- continue;
- }
-
- // TODO(jmadill): Fix this
- ASSERT(attribute.location == realLocation);
-
- int registerCount = gl::VariableRegisterCount(attribute.type);
-
- if (mAttributeRealLocations.size() < attribute.location + registerCount + 1)
- {
- mAttributeRealLocations.resize(attribute.location + registerCount + 1, -1);
- }
-
- for (int offset = 0; offset < registerCount; ++offset)
- {
- mActiveAttributesMask.set(attribute.location + offset);
- mAttributeRealLocations[attribute.location + offset] = realLocation + offset;
+ mActiveAttributesMask.set(location + offset);
}
}
@@ -377,7 +378,6 @@
mSamplerUniformMap.clear();
mSamplerBindings.clear();
mActiveAttributesMask.reset();
- mAttributeRealLocations.clear();
}
GLuint ProgramGL::getProgramID() const