HLSL: don't do a deepCopy() for typedef, as we still want to share the type graph.
authorJohn Kessenich <cepheus@frii.com>
Wed, 8 Feb 2017 20:59:30 +0000 (13:59 -0700)
committerJohn Kessenich <cepheus@frii.com>
Wed, 8 Feb 2017 20:59:30 +0000 (13:59 -0700)
This enables the IO type mapping to work transparently for typedefs.

Test/baseResults/hlsl.struct.split.array.geom.out
glslang/Include/revision.h
hlsl/hlslParseHelper.cpp
hlsl/hlslParseHelper.h

index ca040cc..7b58b39 100644 (file)
@@ -153,12 +153,12 @@ output primitive = triangle_strip
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 88
+// Id's are bound by 73
 
                               Capability Geometry
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Geometry 4  "main" 81
+                              EntryPoint Geometry 4  "main" 66
                               ExecutionMode 4 InputPoints
                               ExecutionMode 4 Invocations 1
                               ExecutionMode 4 OutputTriangleStrip
@@ -175,18 +175,13 @@ output primitive = triangle_strip
                               Name 21  "Out"
                               Name 30  "x"
                               Name 41  "y"
-                              Name 49  "PSInput"
-                              MemberName 49(PSInput) 0  "Pos"
-                              MemberName 49(PSInput) 1  "TexCoord"
-                              MemberName 49(PSInput) 2  "TerrainPos"
-                              MemberName 49(PSInput) 3  "VertexID"
-                              Name 55  "Verts"
-                              Name 79  "v"
-                              Name 81  "v"
-                              Name 83  "OutputStream"
-                              Name 84  "param"
-                              Name 86  "param"
-                              Decorate 81(v) Location 0
+                              Name 54  "Verts"
+                              Name 64  "v"
+                              Name 66  "v"
+                              Name 68  "OutputStream"
+                              Name 69  "param"
+                              Name 71  "param"
+                              Decorate 66(v) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 0
@@ -211,32 +206,25 @@ output primitive = triangle_strip
               31:     28(int) Constant 0
               38:     28(int) Constant 2
               39:             TypeBool
-     49(PSInput):             TypeStruct 11(fvec4) 12(fvec2) 13(fvec3) 6(int)
-              50:      6(int) Constant 3
-              51:             TypeArray 49(PSInput) 50
-              52:      6(int) Constant 2
-              53:             TypeArray 51 52
-              54:             TypePointer Function 53
-              59:             TypePointer Function 49(PSInput)
-              62:             TypePointer Function 11(fvec4)
-              65:     28(int) Constant 1
-              66:             TypePointer Function 12(fvec2)
-              69:             TypePointer Function 13(fvec3)
-              72:     28(int) Constant 3
-              73:             TypePointer Function 6(int)
-              80:             TypePointer Input 8
-           81(v):     80(ptr) Variable Input
+              49:      6(int) Constant 3
+              50:             TypeArray 14(PSInput) 49
+              51:      6(int) Constant 2
+              52:             TypeArray 50 51
+              53:             TypePointer Function 52
+              60:     28(int) Constant 1
+              65:             TypePointer Input 8
+           66(v):     65(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
-           79(v):      9(ptr) Variable Function
-83(OutputStream):     15(ptr) Variable Function
-       84(param):      9(ptr) Variable Function
-       86(param):     15(ptr) Variable Function
-              82:           8 Load 81(v)
-                              Store 79(v) 82
-              85:           8 Load 79(v)
-                              Store 84(param) 85
-              87:           2 FunctionCall 19(@main(u1[1];struct-PSInput-vf4-vf2-vf3-u11;) 84(param) 86(param)
+           64(v):      9(ptr) Variable Function
+68(OutputStream):     15(ptr) Variable Function
+       69(param):      9(ptr) Variable Function
+       71(param):     15(ptr) Variable Function
+              67:           8 Load 66(v)
+                              Store 64(v) 67
+              70:           8 Load 64(v)
+                              Store 69(param) 70
+              72:           2 FunctionCall 19(@main(u1[1];struct-PSInput-vf4-vf2-vf3-u11;) 69(param) 71(param)
                               Return
                               FunctionEnd
 19(@main(u1[1];struct-PSInput-vf4-vf2-vf3-u11;):           2 Function None 16
@@ -246,7 +234,7 @@ output primitive = triangle_strip
          21(Out):     15(ptr) Variable Function
            30(x):     29(ptr) Variable Function
            41(y):     29(ptr) Variable Function
-       55(Verts):     54(ptr) Variable Function
+       54(Verts):     53(ptr) Variable Function
                               Store 21(Out) 27
                               Store 30(x) 31
                               Branch 32
@@ -268,34 +256,23 @@ output primitive = triangle_strip
               48:    39(bool)   SLessThan 47 38
                                 BranchConditional 48 43 44
               43:                 Label
-              56:     28(int)     Load 30(x)
-              57:     28(int)     Load 41(y)
-              58: 14(PSInput)     Load 21(Out)
-              60:     59(ptr)     AccessChain 55(Verts) 56 57
-              61:   11(fvec4)     CompositeExtract 58 0
-              63:     62(ptr)     AccessChain 60 31
-                                  Store 63 61
-              64:   12(fvec2)     CompositeExtract 58 1
-              67:     66(ptr)     AccessChain 60 65
-                                  Store 67 64
-              68:   13(fvec3)     CompositeExtract 58 2
-              70:     69(ptr)     AccessChain 60 38
-                                  Store 70 68
-              71:      6(int)     CompositeExtract 58 3
-              74:     73(ptr)     AccessChain 60 72
-                                  Store 74 71
+              55:     28(int)     Load 30(x)
+              56:     28(int)     Load 41(y)
+              57: 14(PSInput)     Load 21(Out)
+              58:     15(ptr)     AccessChain 54(Verts) 55 56
+                                  Store 58 57
                                   Branch 45
               45:                 Label
-              75:     28(int)     Load 41(y)
-              76:     28(int)     IAdd 75 65
-                                  Store 41(y) 76
+              59:     28(int)     Load 41(y)
+              61:     28(int)     IAdd 59 60
+                                  Store 41(y) 61
                                   Branch 42
               44:               Label
                                 Branch 35
               35:               Label
-              77:     28(int)   Load 30(x)
-              78:     28(int)   IAdd 77 65
-                                Store 30(x) 78
+              62:     28(int)   Load 30(x)
+              63:     28(int)   IAdd 62 60
+                                Store 30(x) 63
                                 Branch 32
               34:             Label
                               Return
index e67629f..64cdea7 100644 (file)
@@ -2,5 +2,5 @@
 // For the version, it uses the latest git tag followed by the number of commits.
 // For the date, it uses the current date (when then script is run).
 
-#define GLSLANG_REVISION "Overload400-PrecQual.1792"
-#define GLSLANG_DATE "06-Feb-2017"
+#define GLSLANG_REVISION "Overload400-PrecQual.1817"
+#define GLSLANG_DATE "08-Feb-2017"
index 280ab93..1a4ae06 100755 (executable)
@@ -5336,12 +5336,9 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction
 // 'parseType' is the type part of the declaration (to the left)
 // 'arraySizes' is the arrayness tagged on the identifier (to the right)
 //
-void HlslParseContext::declareTypedef(const TSourceLoc& loc, TString& identifier, const TType& parseType, TArraySizes* /*arraySizes*/)
+void HlslParseContext::declareTypedef(const TSourceLoc& loc, TString& identifier, const TType& parseType)
 {
-    TType type;
-    type.deepCopy(parseType);
-
-    TVariable* typeSymbol = new TVariable(&identifier, type, true);
+    TVariable* typeSymbol = new TVariable(&identifier, parseType, true);
     if (! symbolTable.insert(*typeSymbol))
         error(loc, "name already defined", "typedef", identifier.c_str());
 }
index 4caa73c..6aec72b 100755 (executable)
@@ -130,7 +130,7 @@ public:
     void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&);
 
     const TFunction* findFunction(const TSourceLoc& loc, TFunction& call, bool& builtIn, TIntermTyped*& args);
-    void declareTypedef(const TSourceLoc&, TString& identifier, const TType&, TArraySizes* typeArray = 0);
+    void declareTypedef(const TSourceLoc&, TString& identifier, const TType&);
     void declareStruct(const TSourceLoc&, TString& structName, TType&);
     TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, TType&, TIntermTyped* initializer = 0);
     void lengthenList(const TSourceLoc&, TIntermSequence& list, int size);