Add compiler support for shared memory
The patch adds handling of the 'shared' qualifier in the shader
compiler.
BUG=angleproject:1442
TEST=angle_unittests
Change-Id: Iaa288026af0faf2a30e40495faa6ea1f5ff02323
Reviewed-on: https://chromium-review.googlesource.com/413200
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 0b9da36..bb0affd 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -1099,6 +1099,21 @@
return true;
}
+void TParseContext::emptyDeclarationErrorCheck(const TPublicType &publicType,
+ const TSourceLoc &location)
+{
+ if (publicType.isUnsizedArray())
+ {
+ // ESSL3 spec section 4.1.9: Array declaration which leaves the size unspecified is an
+ // error. It is assumed that this applies to empty declarations as well.
+ error(location, "empty array declaration needs to specify a size", "");
+ }
+ if (publicType.qualifier == EvqShared && !publicType.layoutQualifier.isEmpty())
+ {
+ error(location, "Shared memory declarations cannot have layout specified", "layout");
+ }
+}
+
// These checks are common for all declarations starting a declarator list, and declarators that
// follow an empty declaration.
void TParseContext::singleDeclarationErrorCheck(const TPublicType &publicType,
@@ -1900,13 +1915,7 @@
if (emptyDeclaration)
{
- if (publicType.isUnsizedArray())
- {
- // ESSL3 spec section 4.1.9: Array declaration which leaves the size unspecified is an
- // error. It is assumed that this applies to empty declarations as well.
- error(identifierOrTypeLocation, "empty array declaration needs to specify a size",
- identifier.c_str());
- }
+ emptyDeclarationErrorCheck(publicType, identifierOrTypeLocation);
}
else
{