Add support for passing nested structs in standard layout by value.

We add support for this by using global scratch values as storage for the structs in
uniform blocks. Any structs in std140 layouts that are referenced by value are initialized
in the shader scope, without any packing, so the type of the structs are equivalent with what
a GLSL program would expect.

TRAC #23327

Signed-off-by: Geoff Lang
Signed-off-by: Shannon Woods
Authored-by: Jamie Madill
diff --git a/src/compiler/OutputHLSL.h b/src/compiler/OutputHLSL.h
index b097410..d578d93 100644
--- a/src/compiler/OutputHLSL.h
+++ b/src/compiler/OutputHLSL.h
@@ -199,6 +199,7 @@
     TString interfaceBlockString(const TType &interfaceBlockType, unsigned int registerIndex, unsigned int arrayIndex);
     TString std140PrePaddingString(const TType &type, int *elementIndex);
     TString std140PostPaddingString(const TType &type, bool useHLSLRowMajorPacking);
+    TString structInitializerString(int indent, const TTypeList &structMembers, const TString &structName);
     
     static GLenum glVariableType(const TType &type);
     static GLenum glVariablePrecision(const TType &type);
@@ -211,6 +212,10 @@
     ActiveShaderVariables mActiveOutputVariables;
     ActiveShaderVariables mActiveAttributes;
     std::map<TString, int> mStd140StructElementIndexes;
+    std::map<TIntermTyped*, TString> mFlaggedStructMappedNames;
+    std::map<TIntermTyped*, TString> mFlaggedStructOriginalNames;
+
+    void makeFlaggedStructMaps(const std::vector<TIntermTyped *> &flaggedStructs);
 };
 }