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.
7
#ifndef COMPILER_TRANSLATOR_VARIABLEINFO_H_
8
#define COMPILER_TRANSLATOR_VARIABLEINFO_H_
10
#include <GLSLANG/ShaderLang.h>
12
#include "compiler/translator/IntermNode.h"
19
// Traverses intermediate tree to collect all attributes, uniforms, varyings.
20
class CollectVariables : public TIntermTraverser
23
CollectVariables(std::vector<Attribute> *attribs,
24
std::vector<OutputVariable> *outputVariables,
25
std::vector<Uniform> *uniforms,
26
std::vector<Varying> *varyings,
27
std::vector<InterfaceBlock> *interfaceBlocks,
28
ShHashFunction64 hashFunction,
29
const TSymbolTable &symbolTable);
31
void visitSymbol(TIntermSymbol *symbol) override;
32
bool visitAggregate(Visit, TIntermAggregate *node) override;
33
bool visitBinary(Visit visit, TIntermBinary *binaryNode) override;
36
template <typename VarT>
37
void visitVariable(const TIntermSymbol *variable, std::vector<VarT> *infoList) const;
39
template <typename VarT>
40
void visitInfoList(const TIntermSequence &sequence, std::vector<VarT> *infoList) const;
42
std::vector<Attribute> *mAttribs;
43
std::vector<OutputVariable> *mOutputVariables;
44
std::vector<Uniform> *mUniforms;
45
std::vector<Varying> *mVaryings;
46
std::vector<InterfaceBlock> *mInterfaceBlocks;
48
std::map<std::string, InterfaceBlockField *> mInterfaceBlockFields;
50
bool mDepthRangeAdded;
51
bool mPointCoordAdded;
52
bool mFrontFacingAdded;
55
bool mInstanceIDAdded;
58
bool mLastFragDataAdded;
61
bool mFragDepthEXTAdded;
63
bool mSecondaryFragColorEXTAdded;
64
bool mSecondaryFragDataEXTAdded;
66
ShHashFunction64 mHashFunction;
68
const TSymbolTable &mSymbolTable;
71
// Expand struct uniforms to flattened lists of split variables
72
void ExpandUniforms(const std::vector<Uniform> &compact,
73
std::vector<ShaderVariable> *expanded);
77
#endif // COMPILER_TRANSLATOR_VARIABLEINFO_H_