Commit a295edfc by Jamie Madill Committed by Shannon Woods

Add parsing (but not full support) for global default layout qualifiers for…

Add parsing (but not full support) for global default layout qualifiers for block storage and matrix packing. TRAC #23268 Signed-off-by: Geoff Lang Signed-off-by: Nicolas Capens Authored-by: Jamie Madill
parent a5efff99
...@@ -164,6 +164,11 @@ struct TLayoutQualifier ...@@ -164,6 +164,11 @@ struct TLayoutQualifier
return layoutQualifier; return layoutQualifier;
} }
bool isEmpty() const
{
return location == -1 && matrixPacking == EmpUnspecified && blockStorage == EbsUnspecified;
}
}; };
// //
......
...@@ -1308,6 +1308,34 @@ TIntermAggregate* TParseContext::parseSingleInitDeclaration(TPublicType &publicT ...@@ -1308,6 +1308,34 @@ TIntermAggregate* TParseContext::parseSingleInitDeclaration(TPublicType &publicT
} }
} }
void TParseContext::parseGlobalLayoutQualifier(const TPublicType &typeQualifier)
{
if (typeQualifier.qualifier != EvqUniform)
{
error(typeQualifier.line, "invalid qualifier:", getQualifierString(typeQualifier.qualifier), "global layout must be uniform");
recover();
return;
}
const TLayoutQualifier layoutQualifier = typeQualifier.layoutQualifier;
ASSERT(!layoutQualifier.isEmpty());
if (shaderVersion < 300)
{
error(typeQualifier.line, "layout qualifiers supported in GLSL ES 3.00 only", "layout");
recover();
return;
}
if (layoutLocationErrorCheck(typeQualifier.line, typeQualifier.layoutQualifier))
{
recover();
return;
}
// TODO: global matrix packing and block storage
}
TFunction *TParseContext::addConstructorFunc(TPublicType publicType) TFunction *TParseContext::addConstructorFunc(TPublicType publicType)
{ {
TOperator op = EOpNull; TOperator op = EOpNull;
......
...@@ -122,6 +122,7 @@ struct TParseContext { ...@@ -122,6 +122,7 @@ struct TParseContext {
TIntermAggregate* parseSingleDeclaration(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier); TIntermAggregate* parseSingleDeclaration(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier);
TIntermAggregate* parseSingleArrayDeclaration(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier, TSourceLoc indexLocation, TIntermTyped *indexExpression); TIntermAggregate* parseSingleArrayDeclaration(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier, TSourceLoc indexLocation, TIntermTyped *indexExpression);
TIntermAggregate* parseSingleInitDeclaration(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier, TSourceLoc initLocation, TIntermTyped *initializer); TIntermAggregate* parseSingleInitDeclaration(TPublicType &publicType, TSourceLoc identifierLocation, const TString &identifier, TSourceLoc initLocation, TIntermTyped *initializer);
void parseGlobalLayoutQualifier(const TPublicType &typeQualifier);
TFunction *addConstructorFunc(TPublicType publicType); TFunction *addConstructorFunc(TPublicType publicType);
TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, TSourceLoc); TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, TSourceLoc);
TIntermTyped* foldConstConstructor(TIntermAggregate* aggrNode, const TType& type); TIntermTyped* foldConstConstructor(TIntermAggregate* aggrNode, const TType& type);
......
...@@ -813,6 +813,10 @@ declaration ...@@ -813,6 +813,10 @@ declaration
ES3_ONLY(getQualifierString($1.qualifier), $1.line, "interface blocks"); ES3_ONLY(getQualifierString($1.qualifier), $1.line, "interface blocks");
$$ = context->addInterfaceBlock($1, $2.line, *$2.string, $3, *$5.string, $5.line, $7, $6.line); $$ = context->addInterfaceBlock($1, $2.line, *$2.string, $3, *$5.string, $5.line, $7, $6.line);
} }
| type_qualifier SEMICOLON {
context->parseGlobalLayoutQualifier($1);
$$ = 0;
}
; ;
function_prototype function_prototype
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment