blob: 15a5c572eaf0841e1a2409b76c46dcc5066d9582 [file] [log] [blame]
alokp@chromium.org07620a52010-09-23 17:53:56 +00001//
2// Copyright (c) 2002-2010 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#include "GLSLANG/ShaderLang.h"
8#include "compiler/intermediate.h"
9
10// Provides information about a variable.
11// It is currently being used to store info about active attribs and uniforms.
12struct TVariableInfo {
13 TPersistString name;
alokp@chromium.org4888ceb2010-10-01 21:13:12 +000014 ShDataType type;
alokp@chromium.org07620a52010-09-23 17:53:56 +000015 int size;
16};
17typedef std::vector<TVariableInfo> TVariableInfoList;
18
19// Traverses intermediate tree to collect all attributes and uniforms.
20class CollectAttribsUniforms : public TIntermTraverser {
21public:
22 CollectAttribsUniforms(TVariableInfoList& attribs,
23 TVariableInfoList& uniforms);
24
25 virtual void visitSymbol(TIntermSymbol*);
26 virtual void visitConstantUnion(TIntermConstantUnion*);
alokp@chromium.orgee76f6a2010-09-27 19:28:55 +000027 virtual bool visitBinary(Visit, TIntermBinary*);
28 virtual bool visitUnary(Visit, TIntermUnary*);
29 virtual bool visitSelection(Visit, TIntermSelection*);
30 virtual bool visitAggregate(Visit, TIntermAggregate*);
31 virtual bool visitLoop(Visit, TIntermLoop*);
32 virtual bool visitBranch(Visit, TIntermBranch*);
alokp@chromium.org07620a52010-09-23 17:53:56 +000033
34private:
35 TVariableInfoList& mAttribs;
36 TVariableInfoList& mUniforms;
37};
38