Merge pull request #874 from xlpiao/DescriptorSet-and-Binding

HLSL: Manually configure descriptor set and binding number for resources
This commit is contained in:
John Kessenich
2017-05-10 11:10:53 -06:00
committed by GitHub
10 changed files with 291 additions and 1 deletions

View File

@@ -4821,6 +4821,7 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
}
// TODO: learn what all these really mean and how they interact with regNumber and subComponent
std::vector<std::string> resourceInfo = intermediate.getResourceSetBinding();
switch (std::tolower(desc[0])) {
case 'b':
case 't':
@@ -4828,6 +4829,13 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
case 's':
case 'u':
qualifier.layoutBinding = regNumber + subComponent;
for (auto it = resourceInfo.cbegin(); it != resourceInfo.cend(); it = it + 3) {
if (strcmp(desc.c_str(), it[0].c_str()) == 0) {
qualifier.layoutSet = atoi(it[1].c_str());
qualifier.layoutBinding = atoi(it[2].c_str()) + subComponent;
break;
}
}
break;
default:
warn(loc, "ignoring unrecognized register type", "register", "%c", desc[0]);