2 // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
7 #ifndef COMPILER_VARIABLE_INFO_H_
8 #define COMPILER_VARIABLE_INFO_H_
10 #include <GLSLANG/ShaderLang.h>
12 #include "compiler/translator/IntermNode.h"
19 // Traverses intermediate tree to collect all attributes, uniforms, varyings.
20 class CollectVariables : public TIntermTraverser
23 CollectVariables(std::vector<Attribute> *attribs,
24 std::vector<Attribute> *outputVariables,
25 std::vector<Uniform> *uniforms,
26 std::vector<Varying> *varyings,
27 std::vector<InterfaceBlock> *interfaceBlocks,
28 ShHashFunction64 hashFunction,
29 const TSymbolTable &symbolTable);
31 virtual void visitSymbol(TIntermSymbol *symbol);
32 virtual bool visitAggregate(Visit, TIntermAggregate *node);
33 virtual bool visitBinary(Visit visit, TIntermBinary *binaryNode);
36 template <typename VarT>
37 void visitVariable(const TIntermSymbol *variable, std::vector<VarT> *infoList) const;
39 template <typename VarT>
40 void visitInfoList(const TIntermSequence &sequence, std::vector<VarT> *infoList) const;
42 std::vector<Attribute> *mAttribs;
43 std::vector<Attribute> *mOutputVariables;
44 std::vector<Uniform> *mUniforms;
45 std::vector<Varying> *mVaryings;
46 std::vector<InterfaceBlock> *mInterfaceBlocks;
48 std::map<std::string, InterfaceBlockField *> mInterfaceBlockFields;
50 bool mPointCoordAdded;
51 bool mFrontFacingAdded;
57 ShHashFunction64 mHashFunction;
59 const TSymbolTable &mSymbolTable;
62 // Expand struct uniforms to flattened lists of split variables
63 void ExpandUniforms(const std::vector<Uniform> &compact,
64 std::vector<ShaderVariable> *expanded);
68 #endif // COMPILER_VARIABLE_INFO_H_