Add support for querying vertex attributes in reflection API

This commit is contained in:
Thomas Perl 2016-05-17 13:59:13 +02:00
parent bedde872b6
commit d6e1a5b1f8
4 changed files with 42 additions and 1 deletions

View file

@ -93,7 +93,17 @@ public:
return badReflection;
}
// for mapping any name to its index (both block names and uniforms names)
// for mapping an attribute index to the attribute's description
int getNumAttributes() { return (int)indexToAttribute.size(); }
const TObjectReflection& getAttribute(int i) const
{
if (i >= 0 && i < (int)indexToAttribute.size())
return indexToAttribute[i];
else
return badReflection;
}
// for mapping any name to its index (block names, uniform names and attribute names)
int getIndex(const char* name) const
{
TNameToIndex::const_iterator it = nameToIndex.find(name);
@ -116,6 +126,7 @@ protected:
TNameToIndex nameToIndex; // maps names to indexes; can hold all types of data: uniform/buffer and which function names have been processed
TMapIndexToReflection indexToUniform;
TMapIndexToReflection indexToUniformBlock;
TMapIndexToReflection indexToAttribute;
};
} // end namespace glslang