michael@0: // michael@0: // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: #ifndef COMPILER_VARIABLE_INFO_H_ michael@0: #define COMPILER_VARIABLE_INFO_H_ michael@0: michael@0: #include "GLSLANG/ShaderLang.h" michael@0: #include "compiler/intermediate.h" michael@0: michael@0: // Provides information about a variable. michael@0: // It is currently being used to store info about active attribs and uniforms. michael@0: struct TVariableInfo { michael@0: TVariableInfo(ShDataType type, int size); michael@0: TVariableInfo(); michael@0: michael@0: TPersistString name; michael@0: TPersistString mappedName; michael@0: ShDataType type; michael@0: int size; michael@0: }; michael@0: typedef std::vector TVariableInfoList; michael@0: michael@0: // Traverses intermediate tree to collect all attributes and uniforms. michael@0: class CollectAttribsUniforms : public TIntermTraverser { michael@0: public: michael@0: CollectAttribsUniforms(TVariableInfoList& attribs, michael@0: TVariableInfoList& uniforms, michael@0: ShHashFunction64 hashFunction); michael@0: michael@0: virtual void visitSymbol(TIntermSymbol*); michael@0: virtual void visitConstantUnion(TIntermConstantUnion*); michael@0: virtual bool visitBinary(Visit, TIntermBinary*); michael@0: virtual bool visitUnary(Visit, TIntermUnary*); michael@0: virtual bool visitSelection(Visit, TIntermSelection*); michael@0: virtual bool visitAggregate(Visit, TIntermAggregate*); michael@0: virtual bool visitLoop(Visit, TIntermLoop*); michael@0: virtual bool visitBranch(Visit, TIntermBranch*); michael@0: michael@0: private: michael@0: TVariableInfoList& mAttribs; michael@0: TVariableInfoList& mUniforms; michael@0: michael@0: ShHashFunction64 mHashFunction; michael@0: }; michael@0: michael@0: #endif // COMPILER_VARIABLE_INFO_H_