HLSL: Fix #832: don't require terminating semicolon for cbuffer/tbuffer.
This commit is contained in:
parent
e9f18fd92c
commit
13075c612c
3 changed files with 19 additions and 15 deletions
|
|
@ -9,7 +9,7 @@ tbuffer {
|
||||||
cbuffer cbufName : register(b2, space10) {
|
cbuffer cbufName : register(b2, space10) {
|
||||||
float4 v3;
|
float4 v3;
|
||||||
int i3 : packoffset(c1.y);
|
int i3 : packoffset(c1.y);
|
||||||
};
|
} // no semicolon is okay
|
||||||
|
|
||||||
tbuffer tbufName : register(b8) {
|
tbuffer tbufName : register(b8) {
|
||||||
float4 v4 : packoffset(c1);
|
float4 v4 : packoffset(c1);
|
||||||
|
|
@ -24,7 +24,7 @@ tbuffer tbufName : register(b8) {
|
||||||
row_major float3x4 m2;
|
row_major float3x4 m2;
|
||||||
column_major float3x4 m3;
|
column_major float3x4 m3;
|
||||||
float3x4 m4;
|
float3x4 m4;
|
||||||
};
|
} // no semicolon is okay
|
||||||
|
|
||||||
float4 PixelShaderFunction(float4 input) : COLOR0
|
float4 PixelShaderFunction(float4 input) : COLOR0
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
// For the version, it uses the latest git tag followed by the number of commits.
|
// 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).
|
// For the date, it uses the current date (when then script is run).
|
||||||
|
|
||||||
#define GLSLANG_REVISION "Overload400-PrecQual.1985"
|
#define GLSLANG_REVISION "Overload400-PrecQual.1990"
|
||||||
#define GLSLANG_DATE "07-Apr-2017"
|
#define GLSLANG_DATE "11-Apr-2017"
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,7 @@ bool HlslGrammar::acceptSamplerDeclarationDX9(TType& /*type*/)
|
||||||
|
|
||||||
// declaration
|
// declaration
|
||||||
// : sampler_declaration_dx9 post_decls SEMICOLON
|
// : sampler_declaration_dx9 post_decls SEMICOLON
|
||||||
// | fully_specified_type declarator_list SEMICOLON
|
// | fully_specified_type declarator_list SEMICOLON(optional for cbuffer/tbuffer)
|
||||||
// | fully_specified_type identifier function_parameters post_decls compound_statement // function definition
|
// | fully_specified_type identifier function_parameters post_decls compound_statement // function definition
|
||||||
// | fully_specified_type identifier sampler_state post_decls compound_statement // sampler definition
|
// | fully_specified_type identifier sampler_state post_decls compound_statement // sampler definition
|
||||||
// | typedef declaration
|
// | typedef declaration
|
||||||
|
|
@ -509,18 +509,22 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
|
||||||
else
|
else
|
||||||
nodeList = initializers;
|
nodeList = initializers;
|
||||||
|
|
||||||
// SEMICOLON
|
// SEMICOLON(optional for cbuffer/tbuffer)
|
||||||
if (! acceptTokenClass(EHTokSemicolon)) {
|
if (! acceptTokenClass(EHTokSemicolon)) {
|
||||||
// This may have been a false detection of what appeared to be a declaration, but
|
if (peek() == EHTokAssign || peek() == EHTokLeftBracket || peek() == EHTokDot || peek() == EHTokComma) {
|
||||||
// was actually an assignment such as "float = 4", where "float" is an identifier.
|
// This may have been a false detection of what appeared to be a declaration, but
|
||||||
// We put the token back to let further parsing happen for cases where that may
|
// was actually an assignment such as "float = 4", where "float" is an identifier.
|
||||||
// happen. This errors on the side of caution, and mostly triggers the error.
|
// We put the token back to let further parsing happen for cases where that may
|
||||||
|
// happen. This errors on the side of caution, and mostly triggers the error.
|
||||||
if (peek() == EHTokAssign || peek() == EHTokLeftBracket || peek() == EHTokDot || peek() == EHTokComma)
|
|
||||||
recedeToken();
|
recedeToken();
|
||||||
else
|
return false;
|
||||||
|
} else if (declaredType.getBasicType() == EbtBlock) {
|
||||||
|
// cbuffer, et. al. (but not struct) don't have an ending semicolon
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
expected(";");
|
expected(";");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -601,7 +605,7 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList)
|
||||||
// the type was a block, which set some parts of the qualifier
|
// the type was a block, which set some parts of the qualifier
|
||||||
parseContext.mergeQualifiers(type.getQualifier(), qualifier);
|
parseContext.mergeQualifiers(type.getQualifier(), qualifier);
|
||||||
// further, it can create an anonymous instance of the block
|
// further, it can create an anonymous instance of the block
|
||||||
if (peekTokenClass(EHTokSemicolon))
|
if (peek() != EHTokIdentifier)
|
||||||
parseContext.declareBlock(loc, type);
|
parseContext.declareBlock(loc, type);
|
||||||
} else {
|
} else {
|
||||||
// Some qualifiers are set when parsing the type. Merge those with
|
// Some qualifiers are set when parsing the type. Merge those with
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue