Refactor ShaderVariables to store fields in the base.
Instead of only storing structure information in Varyings, Uniforms
and Interface Block Fields, store it in the base class. Also only
store base variable information for struct fields, instead of fully
typed information. This works because stuff like interpolation type,
invariance, and other properties are for the entire variable, not
individual fields.
Also add new fields for interface block instance name, varying
invariance and structure name for all struct types.
BUG=angle:466
Change-Id: If03fc071e6becb7aad6dea5093989bba7daee69e
Reviewed-on: https://chromium-review.googlesource.com/213501
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index e0a90ec..defb34a 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -2922,29 +2922,12 @@
return constUnion;
}
-class DeclareVaryingTraverser : public GetVariableTraverser<Varying>
-{
- public:
- DeclareVaryingTraverser(std::vector<Varying> *output,
- InterpolationType interpolation)
- : GetVariableTraverser(output),
- mInterpolation(interpolation)
- {}
-
- private:
- void visitVariable(Varying *varying)
- {
- varying->interpolation = mInterpolation;
- }
-
- InterpolationType mInterpolation;
-};
-
void OutputHLSL::declareVaryingToList(const TType &type, TQualifier baseTypeQualifier,
const TString &name, std::vector<Varying> &fieldsOut)
{
- DeclareVaryingTraverser traverser(&fieldsOut, GetInterpolationType(baseTypeQualifier));
- traverser.traverse(type, name);
+ GetVariableTraverser traverser;
+ traverser.traverse(type, name, &fieldsOut);
+ fieldsOut.back().interpolation = GetInterpolationType(baseTypeQualifier);
}
}