Implement scoped structure declarations

TRAC# 12110 Signed-off-by: Shannon Woods Singed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@310 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 8026c677
...@@ -27,8 +27,8 @@ class OutputHLSL : public TIntermTraverser ...@@ -27,8 +27,8 @@ class OutputHLSL : public TIntermTraverser
TInfoSinkBase &getBodyStream(); TInfoSinkBase &getBodyStream();
TString typeString(const TType &type);
static TString qualifierString(TQualifier qualifier); static TString qualifierString(TQualifier qualifier);
static TString typeString(const TType &type);
static TString arrayString(const TType &type); static TString arrayString(const TType &type);
static TString initializer(const TType &type); static TString initializer(const TType &type);
static TString decorate(const TString &string); // Prepend an underscore to avoid naming clashes static TString decorate(const TString &string); // Prepend an underscore to avoid naming clashes
...@@ -55,6 +55,10 @@ class OutputHLSL : public TIntermTraverser ...@@ -55,6 +55,10 @@ class OutputHLSL : public TIntermTraverser
void addConstructor(const TType &type, const TString &name, const TIntermSequence *parameters); void addConstructor(const TType &type, const TString &name, const TIntermSequence *parameters);
const ConstantUnion *writeConstantUnion(const TType &type, const ConstantUnion *constUnion); const ConstantUnion *writeConstantUnion(const TType &type, const ConstantUnion *constUnion);
TString scopeString(unsigned int depthLimit);
TString scopedStruct(const TString &typeName);
TString structLookup(const TString &typeName);
TParseContext &mContext; TParseContext &mContext;
UnfoldSelect *mUnfoldSelect; UnfoldSelect *mUnfoldSelect;
bool mInsideFunction; bool mInsideFunction;
...@@ -103,25 +107,18 @@ class OutputHLSL : public TIntermTraverser ...@@ -103,25 +107,18 @@ class OutputHLSL : public TIntermTraverser
bool mUsesEqualBVec4; bool mUsesEqualBVec4;
bool mUsesAtan2; bool mUsesAtan2;
struct Constructor // Describes a constructor signature typedef std::set<TString> Constructors;
{ Constructors mConstructors;
TType type;
TString name;
typedef std::vector<TType> ParameterArray;
ParameterArray parameters;
};
struct CompareConstructor typedef std::set<TString> StructNames;
{ StructNames mStructNames;
bool operator()(const Constructor &x, const Constructor &y) const;
};
typedef std::set<Constructor, CompareConstructor> ConstructorSet; typedef std::list<TString> StructDeclarations;
ConstructorSet mConstructors; StructDeclarations mStructDeclarations;
typedef std::list<TType> StructureArray; typedef std::vector<int> ScopeBracket;
StructureArray mStructures; ScopeBracket mScopeBracket;
unsigned int mScopeDepth;
int mArgumentIndex; // For creating unique argument names int mArgumentIndex; // For creating unique argument names
}; };
......
...@@ -32,7 +32,7 @@ bool UnfoldSelect::visitSelection(Visit visit, TIntermSelection *node) ...@@ -32,7 +32,7 @@ bool UnfoldSelect::visitSelection(Visit visit, TIntermSelection *node)
{ {
int i = mTemporaryIndex++; int i = mTemporaryIndex++;
out << OutputHLSL::typeString(node->getType()) << " t" << i << ";\n"; out << mOutputHLSL->typeString(node->getType()) << " t" << i << ";\n";
node->getCondition()->traverse(this); node->getCondition()->traverse(this);
out << "if("; out << "if(";
......
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