Commit 9b82084f by Jamie Madill

Fix HLSL varying struct linking.

We would always expand a struct name to always include its symbol ID. This fixes the workaround to only affect scoped structs. We can leave global structs, which are by definition uniquely named, without decorating them with a symbol ID. This fixes several tests in dEQP's shader.linkage.varying.struct. Re-land with GLSL translator bug fixed. BUG=angle:910 Change-Id: I23a932bd1dadea5e9aafabde697e6a2af9a43f2b Reviewed-on: https://chromium-review.googlesource.com/249134Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent b69a0923
......@@ -2545,7 +2545,10 @@ TPublicType TParseContext::addStructure(const TSourceLoc& structLine, const TSou
TStructure* structure = new TStructure(structName, fieldList);
TType* structureType = new TType(structure);
// Store a bool in the struct if we're at global scope, to allow us to
// skip the local struct scoping workaround in HLSL.
structure->setUniqueId(TSymbolTable::nextUniqueId());
structure->setAtGlobalScope(symbolTable.atGlobalLevel());
if (!structName->empty())
{
......
......@@ -113,7 +113,8 @@ class TStructure : public TFieldListCollection
TStructure(const TString *name, TFieldList *fields)
: TFieldListCollection(name, fields),
mDeepestNesting(0),
mUniqueId(0)
mUniqueId(0),
mAtGlobalScope(false)
{
}
......@@ -138,6 +139,16 @@ class TStructure : public TFieldListCollection
return mUniqueId;
}
void setAtGlobalScope(bool atGlobalScope)
{
mAtGlobalScope = atGlobalScope;
}
bool atGlobalScope() const
{
return mAtGlobalScope;
}
private:
DISALLOW_COPY_AND_ASSIGN(TStructure);
......@@ -159,6 +170,7 @@ class TStructure : public TFieldListCollection
mutable int mDeepestNesting;
int mUniqueId;
bool mAtGlobalScope;
};
class TInterfaceBlock : public TFieldListCollection
......
......@@ -175,6 +175,13 @@ TString StructNameString(const TStructure &structure)
return "";
}
// For structures at global scope we use a consistent
// translation so that we can link between shader stages.
if (structure.atGlobalScope())
{
return Decorate(structure.name());
}
return "ss" + str(structure.uniqueId()) + "_" + structure.name();
}
......
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