HLSL: Add 'class' keyword as (so far) synonym for 'struct'.

This commit is contained in:
John Kessenich 2017-03-03 17:01:01 -07:00
parent c18cae2145
commit 27ffb29908
5 changed files with 11 additions and 6 deletions

View File

@ -12,7 +12,7 @@ struct myS {
myS s1;
static struct {
static class {
float4 i;
} s2;
@ -32,7 +32,7 @@ float ff6 : packoffset(c102.y) : register(s3[5]);
float4 PixelShaderFunction(float4 input, IN_S s) : COLOR0
{
struct FS {
class FS {
bool3 b3;
} s3;

View File

@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.1871"
#define GLSLANG_DATE "02-Mar-2017"
#define GLSLANG_REVISION "Overload400-PrecQual.1874"
#define GLSLANG_DATE "03-Mar-2017"

View File

@ -1259,6 +1259,7 @@ bool HlslGrammar::acceptType(TType& type)
return acceptStructBufferType(type);
break;
case EHTokClass:
case EHTokStruct:
case EHTokCBuffer:
case EHTokTBuffer:
@ -1732,6 +1733,7 @@ bool HlslGrammar::acceptType(TType& type)
//
// struct_type
// : STRUCT
// | CLASS
// | CBUFFER
// | TBUFFER
//
@ -1747,8 +1749,9 @@ bool HlslGrammar::acceptStruct(TType& type)
// TBUFFER
else if (acceptTokenClass(EHTokTBuffer))
storageQualifier = EvqBuffer;
// CLASS
// STRUCT
else if (! acceptTokenClass(EHTokStruct))
else if (! acceptTokenClass(EHTokClass) && ! acceptTokenClass(EHTokStruct))
return false;
// IDENTIFIER

View File

@ -327,6 +327,7 @@ void HlslScanContext::fillInKeywordMap()
(*KeywordMap)["RWStructuredBuffer"] = EHTokRWStructuredBuffer;
(*KeywordMap)["StructuredBuffer"] = EHTokStructuredBuffer;
(*KeywordMap)["class"] = EHTokClass;
(*KeywordMap)["struct"] = EHTokStruct;
(*KeywordMap)["cbuffer"] = EHTokCBuffer;
(*KeywordMap)["tbuffer"] = EHTokTBuffer;
@ -354,7 +355,6 @@ void HlslScanContext::fillInKeywordMap()
ReservedSet->insert("auto");
ReservedSet->insert("catch");
ReservedSet->insert("char");
ReservedSet->insert("class");
ReservedSet->insert("const_cast");
ReservedSet->insert("enum");
ReservedSet->insert("explicit");
@ -740,6 +740,7 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier()
return keyword;
// variable, user type, ...
case EHTokClass:
case EHTokStruct:
case EHTokTypedef:
case EHTokCBuffer:

View File

@ -268,6 +268,7 @@ enum EHlslTokenClass {
// variable, user type, ...
EHTokIdentifier,
EHTokTypeName,
EHTokClass,
EHTokStruct,
EHTokCBuffer,
EHTokTBuffer,