Implemented glGetActiveAttrib
TRAC #11929
Signed-off-by: Shannon Woods
Signed-off-by: Daniel Koch
Author: Nicolas Capens
git-svn-id: https://angleproject.googlecode.com/svn/trunk@180 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Shader.cpp b/src/libGLESv2/Shader.cpp
index 8654c18..61c8e48 100644
--- a/src/libGLESv2/Shader.cpp
+++ b/src/libGLESv2/Shader.cpp
@@ -278,14 +278,11 @@
parseAttributes();
}
-const char *VertexShader::getAttributeName(unsigned int semanticIndex)
+const Attribute &VertexShader::getAttribute(unsigned int semanticIndex)
{
- if (semanticIndex < MAX_VERTEX_ATTRIBS + 1)
- {
- return mAttributeName[semanticIndex].c_str();
- }
+ ASSERT(semanticIndex < MAX_VERTEX_ATTRIBS + 1);
- return 0;
+ return mAttribute[semanticIndex];
}
int VertexShader::getSemanticIndex(const std::string &attributeName)
@@ -294,7 +291,7 @@
{
for (int semanticIndex = 0; semanticIndex < MAX_VERTEX_ATTRIBS; semanticIndex++)
{
- if (mAttributeName[semanticIndex] == attributeName)
+ if (mAttribute[semanticIndex].name == attributeName)
{
return semanticIndex;
}
@@ -312,16 +309,18 @@
for (int attributeIndex = 0; *input != '}'; input++)
{
+ char attributeType[100];
char attributeName[100];
int semanticIndex;
- int matches = sscanf(input, "_%s : TEXCOORD%d;", attributeName, &semanticIndex);
+ int matches = sscanf(input, "%s _%s : TEXCOORD%d;", attributeType, attributeName, &semanticIndex);
- if (matches == 2)
+ if (matches == 3)
{
if (semanticIndex < MAX_VERTEX_ATTRIBS + 1)
{
- mAttributeName[semanticIndex] = attributeName;
+ mAttribute[semanticIndex].type = attributeType;
+ mAttribute[semanticIndex].name = attributeName;
}
else
{