HLSL: Fix #606: make layout() override register.

This commit is contained in:
John Kessenich 2017-12-06 08:17:21 -07:00
parent cc951f8183
commit 471bfed062
4 changed files with 119 additions and 2 deletions

View file

@ -5856,7 +5856,10 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
case 'c':
case 's':
case 'u':
qualifier.layoutBinding = regNumber + subComponent;
// if nothing else has set the binding, do so now
// (other mechanisms override this one)
if (!qualifier.hasBinding())
qualifier.layoutBinding = regNumber + subComponent;
// This handles per-register layout sets numbers. For the global mode which sets
// every symbol to the same value, see setLinkageLayoutSets().
@ -5890,7 +5893,9 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
return true;
};
if (spaceDesc) {
// if nothing else has set the set, do so now
// (other mechanisms override this one)
if (spaceDesc && !qualifier.hasSet()) {
if (! crackSpace()) {
error(loc, "expected spaceN", "register", "");
return;