Merge pull request #1156 from LoopDawg/snorm-uav

HLSL: Accept unorm and snorm on types
This commit is contained in:
John Kessenich
2017-11-15 15:30:59 -07:00
committed by GitHub
4 changed files with 250 additions and 0 deletions

View File

@@ -1378,6 +1378,23 @@ bool HlslGrammar::acceptType(TType& type, TIntermNode*& nodeList)
}
}
bool isUnorm = false;
bool isSnorm = false;
// Accept snorm and unorm. Presently, this is ignored, save for an error check below.
switch (peek()) {
case EHTokUnorm:
isUnorm = true;
advanceToken(); // eat the token
break;
case EHTokSNorm:
isSnorm = true;
advanceToken(); // eat the token
break;
default:
break;
}
switch (peek()) {
case EHTokVector:
return acceptVectorTemplateType(type);
@@ -1972,6 +1989,11 @@ bool HlslGrammar::acceptType(TType& type, TIntermNode*& nodeList)
advanceToken();
if ((isUnorm || isSnorm) && !type.isFloatingDomain()) {
parseContext.error(token.loc, "unorm and snorm only valid in floating point domain", "", "");
return false;
}
return true;
}