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/util.h b/src/compiler/translator/util.h
index 2c16a1d..6a39d56 100644
--- a/src/compiler/translator/util.h
+++ b/src/compiler/translator/util.h
@@ -36,31 +36,23 @@
BlockLayoutType GetBlockLayoutType(TLayoutBlockStorage blockStorage);
TString ArrayString(const TType &type);
-template <typename VarT>
class GetVariableTraverser
{
public:
- GetVariableTraverser(std::vector<VarT> *output);
- void traverse(const TType &type, const TString &name);
+ GetVariableTraverser() {}
+
+ template <typename VarT>
+ void traverse(const TType &type, const TString &name, std::vector<VarT> *output);
protected:
// May be overloaded
- virtual void visitVariable(VarT *newVar) {}
+ virtual void visitVariable(ShaderVariable *newVar) {}
private:
- std::stack<std::vector<VarT> *> mOutputStack;
+ DISALLOW_COPY_AND_ASSIGN(GetVariableTraverser);
};
-struct GetInterfaceBlockFieldTraverser : public GetVariableTraverser<InterfaceBlockField>
-{
- public:
- GetInterfaceBlockFieldTraverser(std::vector<InterfaceBlockField> *output, bool isRowMajorMatrix);
-
- private:
- virtual void visitVariable(InterfaceBlockField *newField);
-
- bool mIsRowMajorMatrix;
-};
+void GetInterfaceBlockFields(const TInterfaceBlock &interfaceBlock, std::vector<InterfaceBlockField> *fieldsOut);
}