Fix #1759: Check for specialization constants when literals required.

This commit is contained in:
John Kessenich
2019-05-03 08:40:35 -06:00
parent 86c72c9486
commit 5cb2fa2ad2
7 changed files with 93 additions and 5 deletions

View File

@@ -1899,13 +1899,16 @@ void HlslParseContext::transferTypeAttributes(const TSourceLoc& loc, const TAttr
// location
if (it->getInt(value))
type.getQualifier().layoutLocation = value;
else
error(loc, "needs a literal integer", "location", "");
break;
case EatBinding:
// binding
if (it->getInt(value)) {
type.getQualifier().layoutBinding = value;
type.getQualifier().layoutSet = 0;
}
} else
error(loc, "needs a literal integer", "binding", "");
// set
if (it->getInt(value, 1))
type.getQualifier().layoutSet = value;
@@ -1914,7 +1917,9 @@ void HlslParseContext::transferTypeAttributes(const TSourceLoc& loc, const TAttr
// global cbuffer binding
if (it->getInt(value))
globalUniformBinding = value;
// global cbuffer binding
else
error(loc, "needs a literal integer", "global binding", "");
// global cbuffer set
if (it->getInt(value, 1))
globalUniformSet = value;
break;
@@ -1922,6 +1927,8 @@ void HlslParseContext::transferTypeAttributes(const TSourceLoc& loc, const TAttr
// input attachment
if (it->getInt(value))
type.getQualifier().layoutAttachment = value;
else
error(loc, "needs a literal integer", "input attachment", "");
break;
case EatBuiltIn:
// PointSize built-in