Merge pull request #991 from LoopDawg/resource-set-binding-fix
HLSL: Fix crash with --resource-set-binding [n] (global form, not per-register form)
This commit is contained in:
@@ -5411,7 +5411,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();
|
||||
const std::vector<std::string>& resourceInfo = intermediate.getResourceSetBinding();
|
||||
switch (std::tolower(desc[0])) {
|
||||
case 'b':
|
||||
case 't':
|
||||
@@ -5419,11 +5419,17 @@ 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;
|
||||
|
||||
// This handles per-register layout sets numbers. For the global mode which sets
|
||||
// every symbol to the same value, see setLinkageLayoutSets().
|
||||
if ((resourceInfo.size() % 3) == 0) {
|
||||
// Apply per-symbol resource set and binding.
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user