Reflection: Expand out block arrays to N different blocks.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24159 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-11-21 00:54:57 +00:00
parent 1d1132d9eb
commit 04884e42ed
4 changed files with 27 additions and 5 deletions

View file

@ -376,9 +376,19 @@ public:
const TString& blockName = anonymous ? base->getType().getTypeName() : base->getType().getTypeName();
TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(blockName);
if (it == reflection.nameToIndex.end()) {
blockIndex = reflection.indexToUniformBlock.size();
reflection.nameToIndex[blockName] = blockIndex;
reflection.indexToUniformBlock.push_back(TObjectReflection(blockName, offset, -1, getBlockSize(base->getType()), -1));
if (base->getType().isArray()) {
assert(! anonymous);
for (int e = 0; e < base->getType().getArraySize(); ++e) {
TString elementName = blockName + "[" + String(e) + "]";
blockIndex = reflection.indexToUniformBlock.size();
reflection.nameToIndex[elementName] = blockIndex;
reflection.indexToUniformBlock.push_back(TObjectReflection(elementName, offset, -1, getBlockSize(base->getType()), -1));
}
} else {
blockIndex = reflection.indexToUniformBlock.size();
reflection.nameToIndex[blockName] = blockIndex;
reflection.indexToUniformBlock.push_back(TObjectReflection(blockName, offset, -1, getBlockSize(base->getType()), -1));
}
} else
blockIndex = it->second;
offset = 0;