Commit a2fbb840 by Jamie Madill

Move CollectVariables to sh namespace.

BUG=angle:466 Change-Id: I903ea840e333dfeb44f242a1759aed39974d0510 Reviewed-on: https://chromium-review.googlesource.com/213505Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Reviewed-by: 's avatarNicolas Capens <capn@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 54ad4f81
...@@ -502,18 +502,18 @@ bool TCompiler::enforceVertexShaderTimingRestrictions(TIntermNode* root) ...@@ -502,18 +502,18 @@ bool TCompiler::enforceVertexShaderTimingRestrictions(TIntermNode* root)
void TCompiler::collectVariables(TIntermNode* root) void TCompiler::collectVariables(TIntermNode* root)
{ {
CollectVariables collect(&attributes, sh::CollectVariables collect(&attributes,
&outputVariables, &outputVariables,
&uniforms, &uniforms,
&varyings, &varyings,
&interfaceBlocks, &interfaceBlocks,
hashFunction); hashFunction);
root->traverse(&collect); root->traverse(&collect);
// For backwards compatiblity with ShGetVariableInfo, expand struct // For backwards compatiblity with ShGetVariableInfo, expand struct
// uniforms and varyings into separate variables for each field. // uniforms and varyings into separate variables for each field.
ExpandVariables(uniforms, &expandedUniforms); sh::ExpandVariables(uniforms, &expandedUniforms);
ExpandVariables(varyings, &expandedVaryings); sh::ExpandVariables(varyings, &expandedVaryings);
} }
bool TCompiler::enforcePackingRestrictions() bool TCompiler::enforcePackingRestrictions()
......
...@@ -11,15 +11,18 @@ ...@@ -11,15 +11,18 @@
#include "compiler/translator/IntermNode.h" #include "compiler/translator/IntermNode.h"
namespace sh
{
// Traverses intermediate tree to collect all attributes, uniforms, varyings. // Traverses intermediate tree to collect all attributes, uniforms, varyings.
class CollectVariables : public TIntermTraverser class CollectVariables : public TIntermTraverser
{ {
public: public:
CollectVariables(std::vector<sh::Attribute> *attribs, CollectVariables(std::vector<Attribute> *attribs,
std::vector<sh::Attribute> *outputVariables, std::vector<Attribute> *outputVariables,
std::vector<sh::Uniform> *uniforms, std::vector<Uniform> *uniforms,
std::vector<sh::Varying> *varyings, std::vector<Varying> *varyings,
std::vector<sh::InterfaceBlock> *interfaceBlocks, std::vector<InterfaceBlock> *interfaceBlocks,
ShHashFunction64 hashFunction); ShHashFunction64 hashFunction);
virtual void visitSymbol(TIntermSymbol *symbol); virtual void visitSymbol(TIntermSymbol *symbol);
...@@ -33,13 +36,13 @@ class CollectVariables : public TIntermTraverser ...@@ -33,13 +36,13 @@ class CollectVariables : public TIntermTraverser
template <typename VarT> template <typename VarT>
void visitInfoList(const TIntermSequence &sequence, std::vector<VarT> *infoList) const; void visitInfoList(const TIntermSequence &sequence, std::vector<VarT> *infoList) const;
std::vector<sh::Attribute> *mAttribs; std::vector<Attribute> *mAttribs;
std::vector<sh::Attribute> *mOutputVariables; std::vector<Attribute> *mOutputVariables;
std::vector<sh::Uniform> *mUniforms; std::vector<Uniform> *mUniforms;
std::vector<sh::Varying> *mVaryings; std::vector<Varying> *mVaryings;
std::vector<sh::InterfaceBlock> *mInterfaceBlocks; std::vector<InterfaceBlock> *mInterfaceBlocks;
std::map<std::string, sh::InterfaceBlockField *> mInterfaceBlockFields; std::map<std::string, InterfaceBlockField *> mInterfaceBlockFields;
bool mPointCoordAdded; bool mPointCoordAdded;
bool mFrontFacingAdded; bool mFrontFacingAdded;
...@@ -51,6 +54,8 @@ class CollectVariables : public TIntermTraverser ...@@ -51,6 +54,8 @@ class CollectVariables : public TIntermTraverser
// Expand struct variables to flattened lists of split variables // Expand struct variables to flattened lists of split variables
template <typename VarT> template <typename VarT>
void ExpandVariables(const std::vector<VarT> &compact, void ExpandVariables(const std::vector<VarT> &compact,
std::vector<sh::ShaderVariable> *expanded); std::vector<ShaderVariable> *expanded);
}
#endif // COMPILER_VARIABLE_INFO_H_ #endif // COMPILER_VARIABLE_INFO_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment