blob: 261c862d4f681f18f1ff03084db94dbd32d4c50c [file] [log] [blame]
alokp@chromium.org07620a52010-09-23 17:53:56 +00001//
zmo@google.comfd747b82011-04-23 01:30:07 +00002// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
alokp@chromium.org07620a52010-09-23 17:53:56 +00003// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
zmo@google.comfd747b82011-04-23 01:30:07 +00007#ifndef COMPILER_VARIABLE_INFO_H_
8#define COMPILER_VARIABLE_INFO_H_
9
alokp@chromium.org07620a52010-09-23 17:53:56 +000010#include "GLSLANG/ShaderLang.h"
11#include "compiler/intermediate.h"
12
13// Provides information about a variable.
14// It is currently being used to store info about active attribs and uniforms.
15struct TVariableInfo {
16 TPersistString name;
zmo@google.comfd747b82011-04-23 01:30:07 +000017 TPersistString mappedName;
alokp@chromium.org4888ceb2010-10-01 21:13:12 +000018 ShDataType type;
alokp@chromium.org07620a52010-09-23 17:53:56 +000019 int size;
20};
21typedef std::vector<TVariableInfo> TVariableInfoList;
22
23// Traverses intermediate tree to collect all attributes and uniforms.
24class CollectAttribsUniforms : public TIntermTraverser {
25public:
26 CollectAttribsUniforms(TVariableInfoList& attribs,
27 TVariableInfoList& uniforms);
28
29 virtual void visitSymbol(TIntermSymbol*);
30 virtual void visitConstantUnion(TIntermConstantUnion*);
alokp@chromium.orgee76f6a2010-09-27 19:28:55 +000031 virtual bool visitBinary(Visit, TIntermBinary*);
32 virtual bool visitUnary(Visit, TIntermUnary*);
33 virtual bool visitSelection(Visit, TIntermSelection*);
34 virtual bool visitAggregate(Visit, TIntermAggregate*);
35 virtual bool visitLoop(Visit, TIntermLoop*);
36 virtual bool visitBranch(Visit, TIntermBranch*);
alokp@chromium.org07620a52010-09-23 17:53:56 +000037
38private:
39 TVariableInfoList& mAttribs;
40 TVariableInfoList& mUniforms;
41};
42
zmo@google.comfd747b82011-04-23 01:30:07 +000043#endif // COMPILER_VARIABLE_INFO_H_