diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
commit | 6630937e63ae5797487b86743a7733c8ae5cc42c (patch) | |
tree | 3d53dacf6430f9099e1fb20835881205de674961 /src/3rdparty/angle/src/compiler/translator/StructureHLSL.h | |
parent | 37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff) | |
parent | c7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff) |
Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
Diffstat (limited to 'src/3rdparty/angle/src/compiler/translator/StructureHLSL.h')
-rw-r--r-- | src/3rdparty/angle/src/compiler/translator/StructureHLSL.h | 41 |
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_ |