Allow varying structs to match between stages.
We would always expand a struct name to always include its symbol
ID. This workaround fixed scoped structs with the same name. It
would also block any possiblity of linking the structs successfully.
Instead we can use the workaround only on inner-scoped structs, and
leave global structs, which are by definition uniquely named, as
they are.
This fixes several tests in dEQP's shader.linkage.varying.struct.
BUG=angle:910
Change-Id: I81b8dadc7ea493152aff0c44d607114eaaabb142
Reviewed-on: https://chromium-review.googlesource.com/247242
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index e2959d7..a26f4a4 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -2545,7 +2545,12 @@
TStructure* structure = new TStructure(structName, fieldList);
TType* structureType = new TType(structure);
- structure->setUniqueId(TSymbolTable::nextUniqueId());
+ // Check for global struct, and do not assign an ID if so, to prevent us from
+ // rewriting the struct name to avoid scoping conflicts.
+ if (!symbolTable.atGlobalLevel())
+ {
+ structure->setUniqueId(TSymbolTable::nextUniqueId());
+ }
if (!structName->empty())
{