summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/compiler/translator/StructureHLSL.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/compiler/translator/StructureHLSL.h')
-rw-r--r--src/3rdparty/angle/src/compiler/translator/StructureHLSL.h41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/3rdparty/angle/src/compiler/translator/StructureHLSL.h b/src/3rdparty/angle/src/compiler/translator/StructureHLSL.h
index cffe2a41ae..daced8f8d1 100644
--- a/src/3rdparty/angle/src/compiler/translator/StructureHLSL.h
+++ b/src/3rdparty/angle/src/compiler/translator/StructureHLSL.h
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
// StructureHLSL.h:
-// Interfaces of methods for HLSL translation of GLSL structures.
+// HLSL translation of GLSL constructors and structures.
//
#ifndef COMPILER_TRANSLATOR_STRUCTUREHLSL_H_
@@ -49,11 +49,14 @@ class StructureHLSL : angle::NonCopyable
public:
StructureHLSL();
- void addConstructor(const TType &type, const TString &name, const TIntermSequence *parameters);
- std::string structsHeader() const;
+ // Returns the name of the constructor function.
+ TString addStructConstructor(const TStructure &structure);
+ TString addBuiltInConstructor(const TType &type, const TIntermSequence *parameters);
- TString defineQualified(const TStructure &structure, bool useHLSLRowMajorPacking, bool useStd140Packing);
static TString defineNameless(const TStructure &structure);
+ void ensureStructDefined(const TStructure &structure);
+
+ std::string structsHeader() const;
Std140PaddingHelper getPaddingHelper();
@@ -62,20 +65,34 @@ class StructureHLSL : angle::NonCopyable
std::map<TString, int> mStd140StructElementIndexes;
- typedef std::set<TString> StructNames;
- StructNames mStructNames;
+ struct TStructProperties : public angle::NonCopyable
+ {
+ POOL_ALLOCATOR_NEW_DELETE();
+
+ TStructProperties() {}
- typedef std::set<TString> Constructors;
- Constructors mConstructors;
+ // Constructor is an empty string in case the struct doesn't have a constructor yet.
+ TString constructor;
+ };
+ // Map from struct name to struct properties.
+ typedef std::map<TString, TStructProperties *> DefinedStructs;
+ DefinedStructs mDefinedStructs;
+
+ // Struct declarations need to be kept in a vector instead of having them inside mDefinedStructs
+ // since maintaining the original order is necessary for nested structs.
typedef std::vector<TString> StructDeclarations;
StructDeclarations mStructDeclarations;
+ typedef std::set<TString> BuiltInConstructors;
+ BuiltInConstructors mBuiltInConstructors;
+
void storeStd140ElementIndex(const TStructure &structure, bool useHLSLRowMajorPacking);
- static TString define(const TStructure &structure, bool useHLSLRowMajorPacking,
- bool useStd140Packing, Std140PaddingHelper *padHelper);
+ TString defineQualified(const TStructure &structure,
+ bool useHLSLRowMajorPacking,
+ bool useStd140Packing);
+ DefinedStructs::iterator defineVariants(const TStructure &structure, const TString &name);
};
-
}
-#endif // COMPILER_TRANSLATOR_STRUCTUREHLSL_H_
+#endif // COMPILER_TRANSLATOR_STRUCTUREHLSL_H_