Home | History | Annotate | Download | only in translator
      1 //
      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.
      5 //
      6 
      7 #ifndef COMPILER_VARIABLE_INFO_H_
      8 #define COMPILER_VARIABLE_INFO_H_
      9 
     10 #include "compiler/translator/intermediate.h"
     11 
     12 // Provides information about a variable.
     13 // It is currently being used to store info about active attribs and uniforms.
     14 struct TVariableInfo {
     15     TVariableInfo(ShDataType type, int size);
     16     TVariableInfo();
     17 
     18     TPersistString name;
     19     TPersistString mappedName;
     20     ShDataType type;
     21     int size;
     22     bool isArray;
     23     TPrecision precision;
     24     bool staticUse;
     25 };
     26 typedef std::vector<TVariableInfo> TVariableInfoList;
     27 
     28 // Traverses intermediate tree to collect all attributes, uniforms, varyings.
     29 class CollectVariables : public TIntermTraverser {
     30 public:
     31     CollectVariables(TVariableInfoList& attribs,
     32                      TVariableInfoList& uniforms,
     33                      TVariableInfoList& varyings,
     34                      ShHashFunction64 hashFunction);
     35 
     36     virtual void visitSymbol(TIntermSymbol*);
     37     virtual bool visitAggregate(Visit, TIntermAggregate*);
     38 
     39 private:
     40     TVariableInfoList& mAttribs;
     41     TVariableInfoList& mUniforms;
     42     TVariableInfoList& mVaryings;
     43 
     44     bool mPointCoordAdded;
     45     bool mFrontFacingAdded;
     46     bool mFragCoordAdded;
     47 
     48     ShHashFunction64 mHashFunction;
     49 };
     50 
     51 #endif  // COMPILER_VARIABLE_INFO_H_
     52