WIP: HLSL: add refection queries for structuredbuffer counter blocks

This adds TProgram::getUniformBlockCounterIndex(int index), which returns the
index the block of the counter buffer associated with the block of the passed in
index, if any, or -1 if none.
This commit is contained in:
steve-lunarg 2017-04-15 08:18:16 -06:00
parent 12bc9aa9ce
commit 350b94856a
6 changed files with 32 additions and 6 deletions

View file

@ -707,6 +707,19 @@ void TReflection::buildAttributeReflection(EShLanguage stage, const TIntermediat
}
}
// build counter block index associations for buffers
void TReflection::buildCounterIndices()
{
// search for ones that have counters
for (int i = 0; i < int(indexToUniformBlock.size()); ++i) {
const TString counterName(indexToUniformBlock[i].name + "@count");
const int index = getIndex(counterName);
if (index >= 0)
indexToUniformBlock[i].counterIndex = index;
}
}
// Merge live symbols from 'intermediate' into the existing reflection database.
//
// Returns false if the input is too malformed to do this.
@ -729,6 +742,8 @@ bool TReflection::addStage(EShLanguage stage, const TIntermediate& intermediate)
function->traverse(&it);
}
buildCounterIndices();
return true;
}