1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/compiler/VariableInfo.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +// 1.5 +// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. 1.6 +// Use of this source code is governed by a BSD-style license that can be 1.7 +// found in the LICENSE file. 1.8 +// 1.9 + 1.10 +#ifndef COMPILER_VARIABLE_INFO_H_ 1.11 +#define COMPILER_VARIABLE_INFO_H_ 1.12 + 1.13 +#include "GLSLANG/ShaderLang.h" 1.14 +#include "compiler/intermediate.h" 1.15 + 1.16 +// Provides information about a variable. 1.17 +// It is currently being used to store info about active attribs and uniforms. 1.18 +struct TVariableInfo { 1.19 + TVariableInfo(ShDataType type, int size); 1.20 + TVariableInfo(); 1.21 + 1.22 + TPersistString name; 1.23 + TPersistString mappedName; 1.24 + ShDataType type; 1.25 + int size; 1.26 +}; 1.27 +typedef std::vector<TVariableInfo> TVariableInfoList; 1.28 + 1.29 +// Traverses intermediate tree to collect all attributes and uniforms. 1.30 +class CollectAttribsUniforms : public TIntermTraverser { 1.31 +public: 1.32 + CollectAttribsUniforms(TVariableInfoList& attribs, 1.33 + TVariableInfoList& uniforms, 1.34 + ShHashFunction64 hashFunction); 1.35 + 1.36 + virtual void visitSymbol(TIntermSymbol*); 1.37 + virtual void visitConstantUnion(TIntermConstantUnion*); 1.38 + virtual bool visitBinary(Visit, TIntermBinary*); 1.39 + virtual bool visitUnary(Visit, TIntermUnary*); 1.40 + virtual bool visitSelection(Visit, TIntermSelection*); 1.41 + virtual bool visitAggregate(Visit, TIntermAggregate*); 1.42 + virtual bool visitLoop(Visit, TIntermLoop*); 1.43 + virtual bool visitBranch(Visit, TIntermBranch*); 1.44 + 1.45 +private: 1.46 + TVariableInfoList& mAttribs; 1.47 + TVariableInfoList& mUniforms; 1.48 + 1.49 + ShHashFunction64 mHashFunction; 1.50 +}; 1.51 + 1.52 +#endif // COMPILER_VARIABLE_INFO_H_