Fix #944: Convert argument type to match formal parameter type.
authorJohn Kessenich <cepheus@frii.com>
Fri, 4 May 2018 17:43:03 +0000 (11:43 -0600)
committerJohn Kessenich <cepheus@frii.com>
Fri, 4 May 2018 17:43:03 +0000 (11:43 -0600)
SPIRV/GlslangToSpv.cpp
SPIRV/spvIR.h
Test/baseResults/spv.debugInfo.1.1.frag.out
Test/baseResults/spv.debugInfo.frag.out
Test/baseResults/spv.multiStructFuncall.frag.out

index d2b2dee..d417e46 100755 (executable)
@@ -170,7 +170,7 @@ protected:
     void declareUseOfStructMember(const glslang::TTypeList& members, int glslangMember);
 
     bool isShaderEntryPoint(const glslang::TIntermAggregate* node);
-    bool writableParam(glslang::TStorageQualifier);
+    bool writableParam(glslang::TStorageQualifier) const;
     bool originalParam(glslang::TStorageQualifier, const glslang::TType&, bool implicitThisParam);
     void makeFunctions(const glslang::TIntermSequence&);
     void makeGlobalInitializers(const glslang::TIntermSequence&);
@@ -3241,7 +3241,7 @@ bool TGlslangToSpvTraverser::isShaderEntryPoint(const glslang::TIntermAggregate*
 // Does parameter need a place to keep writes, separate from the original?
 // Assumes called after originalParam(), which filters out block/buffer/opaque-based
 // qualifiers such that we should have only in/out/inout/constreadonly here.
-bool TGlslangToSpvTraverser::writableParam(glslang::TStorageQualifier qualifier)
+bool TGlslangToSpvTraverser::writableParam(glslang::TStorageQualifier qualifier) const
 {
     assert(qualifier == glslang::EvqIn ||
            qualifier == glslang::EvqOut ||
@@ -3954,18 +3954,17 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
     // 3. Make the call
     // 4. Copy back the results
 
-    // 1. Evaluate the arguments
+    // 1. Evaluate the arguments and their types
     std::vector<spv::Builder::AccessChain> lValues;
     std::vector<spv::Id> rValues;
     std::vector<const glslang::TType*> argTypes;
     for (int a = 0; a < (int)glslangArgs.size(); ++a) {
-        const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType();
+        argTypes.push_back(&glslangArgs[a]->getAsTyped()->getType());
         // build l-value
         builder.clearAccessChain();
         glslangArgs[a]->traverse(this);
-        argTypes.push_back(&paramType);
         // keep outputs and pass-by-originals as l-values, evaluate others as r-values
-        if (originalParam(qualifiers[a], paramType, function->hasImplicitThis() && a == 0) ||
+        if (originalParam(qualifiers[a], *argTypes[a], function->hasImplicitThis() && a == 0) ||
             writableParam(qualifiers[a])) {
             // save l-value
             lValues.push_back(builder.getAccessChain());
@@ -3983,26 +3982,33 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
     int rValueCount = 0;
     std::vector<spv::Id> spvArgs;
     for (int a = 0; a < (int)glslangArgs.size(); ++a) {
-        const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType();
         spv::Id arg;
-        if (originalParam(qualifiers[a], paramType, function->hasImplicitThis() && a == 0)) {
+        if (originalParam(qualifiers[a], *argTypes[a], function->hasImplicitThis() && a == 0)) {
             builder.setAccessChain(lValues[lValueCount]);
             arg = builder.accessChainGetLValue();
             ++lValueCount;
         } else if (writableParam(qualifiers[a])) {
             // need space to hold the copy
-            arg = builder.createVariable(spv::StorageClassFunction, convertGlslangToSpvType(paramType), "param");
+            arg = builder.createVariable(spv::StorageClassFunction, builder.getContainedTypeId(function->getParamType(a)), "param");
             if (qualifiers[a] == glslang::EvqIn || qualifiers[a] == glslang::EvqInOut) {
                 // need to copy the input into output space
                 builder.setAccessChain(lValues[lValueCount]);
                 spv::Id copy = accessChainLoad(*argTypes[a]);
                 builder.clearAccessChain();
                 builder.setAccessChainLValue(arg);
-                multiTypeStore(paramType, copy);
+                multiTypeStore(*argTypes[a], copy);
             }
             ++lValueCount;
         } else {
-            arg = rValues[rValueCount];
+            // process r-value, which involves a copy for a type mismatch
+            if (function->getParamType(a) != convertGlslangToSpvType(*argTypes[a])) {
+                spv::Id argCopy = builder.createVariable(spv::StorageClassFunction, function->getParamType(a), "arg");
+                builder.clearAccessChain();
+                builder.setAccessChainLValue(argCopy);
+                multiTypeStore(*argTypes[a], rValues[rValueCount]);
+                arg = builder.createLoad(argCopy);
+            } else
+                arg = rValues[rValueCount];
             ++rValueCount;
         }
         spvArgs.push_back(arg);
@@ -4015,14 +4021,13 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
     // 4. Copy back out an "out" arguments.
     lValueCount = 0;
     for (int a = 0; a < (int)glslangArgs.size(); ++a) {
-        const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType();
-        if (originalParam(qualifiers[a], paramType, function->hasImplicitThis() && a == 0))
+        if (originalParam(qualifiers[a], *argTypes[a], function->hasImplicitThis() && a == 0))
             ++lValueCount;
         else if (writableParam(qualifiers[a])) {
             if (qualifiers[a] == glslang::EvqOut || qualifiers[a] == glslang::EvqInOut) {
                 spv::Id copy = builder.createLoad(spvArgs[a]);
                 builder.setAccessChain(lValues[lValueCount]);
-                multiTypeStore(paramType, copy);
+                multiTypeStore(*argTypes[a], copy);
             }
             ++lValueCount;
         }
index faa2701..8b6c644 100755 (executable)
@@ -258,7 +258,8 @@ public:
             delete blocks[i];
     }
     Id getId() const { return functionInstruction.getResultId(); }
-    Id getParamId(int p) { return parameterInstructions[p]->getResultId(); }
+    Id getParamId(int p) const { return parameterInstructions[p]->getResultId(); }
+    Id getParamType(int p) const { return parameterInstructions[p]->getTypeId(); }
 
     void addBlock(Block* block) { blocks.push_back(block); }
     void removeBlock(Block* block)
index 9bd1491..f6de5e2 100644 (file)
@@ -1,7 +1,7 @@
 spv.debugInfo.frag
 // Module Version 10300
 // Generated by (magic number): 80006
-// Id's are bound by 126
+// Id's are bound by 124
 
                               Capability Shader
                2:             ExtInstImport  "GLSL.std.450"
@@ -74,11 +74,9 @@ void main()
                               Name 54  "ubuf"
                               MemberName 54(ubuf) 0  "s"
                               Name 56  ""
-                              Name 57  "S"
-                              MemberName 57(S) 0  "a"
-                              Name 59  "param"
-                              Name 69  "s2d"
-                              Name 99  "i"
+                              Name 57  "param"
+                              Name 67  "s2d"
+                              Name 97  "i"
                               ModuleProcessed  "no-storage-format"
                               ModuleProcessed  "resource-set-binding 3"
                               ModuleProcessed  "auto-map-locations"
@@ -94,8 +92,8 @@ void main()
                               MemberDecorate 54(ubuf) 0 Offset 0
                               Decorate 54(ubuf) Block
                               Decorate 56 DescriptorSet 3
-                              Decorate 69(s2d) Location 0
-                              Decorate 69(s2d) DescriptorSet 3
+                              Decorate 67(s2d) Location 0
+                              Decorate 67(s2d) DescriptorSet 3
                3:             TypeVoid
                4:             TypeFunction 3
                7:             TypeInt 32 1
@@ -122,120 +120,118 @@ void main()
         54(ubuf):             TypeStruct 53(S)
               55:             TypePointer Uniform 54(ubuf)
               56:     55(ptr) Variable Uniform
-           57(S):             TypeStruct 7(int)
-              58:             TypePointer Function 57(S)
-              60:             TypePointer Uniform 53(S)
-              66:             TypeImage 10(float) 2D sampled format:Unknown
-              67:             TypeSampledImage 66
-              68:             TypePointer UniformConstant 67
-         69(s2d):     68(ptr) Variable UniformConstant
-              71:             TypeVector 10(float) 2
-              72:   10(float) Constant 1056964608
-              73:   71(fvec2) ConstantComposite 72 72
-              77:             TypePointer Uniform 7(int)
-             106:      7(int) Constant 10
-             111:      7(int) Constant 1
-             113:             TypePointer Output 10(float)
-             116:   10(float) Constant 1092616192
+              58:             TypePointer Uniform 53(S)
+              64:             TypeImage 10(float) 2D sampled format:Unknown
+              65:             TypeSampledImage 64
+              66:             TypePointer UniformConstant 65
+         67(s2d):     66(ptr) Variable UniformConstant
+              69:             TypeVector 10(float) 2
+              70:   10(float) Constant 1056964608
+              71:   69(fvec2) ConstantComposite 70 70
+              75:             TypePointer Uniform 7(int)
+             104:      7(int) Constant 10
+             109:      7(int) Constant 1
+             111:             TypePointer Output 10(float)
+             114:   10(float) Constant 1092616192
          5(main):           3 Function None 4
                6:             Label
-       59(param):     58(ptr) Variable Function
-           99(i):     19(ptr) Variable Function
-             118:     16(ptr) Variable Function
+       57(param):      9(ptr) Variable Function
+           97(i):     19(ptr) Variable Function
+             116:     16(ptr) Variable Function
                               Line 1 30 0
-              61:     60(ptr) AccessChain 56 18
-              62:       53(S) Load 61
-              63:      7(int) CompositeExtract 62 0
-              64:     19(ptr) AccessChain 59(param) 18
-                              Store 64 63
-              65:   11(fvec4) FunctionCall 14(foo(struct-S-i11;) 59(param)
-                              Store 52(outv) 65
+              59:     58(ptr) AccessChain 56 18
+              60:       53(S) Load 59
+              61:      7(int) CompositeExtract 60 0
+              62:     19(ptr) AccessChain 57(param) 18
+                              Store 62 61
+              63:   11(fvec4) FunctionCall 14(foo(struct-S-i11;) 57(param)
+                              Store 52(outv) 63
                               Line 1 31 0
-              70:          67 Load 69(s2d)
-              74:   11(fvec4) ImageSampleImplicitLod 70 73
-              75:   11(fvec4) Load 52(outv)
-              76:   11(fvec4) FAdd 75 74
-                              Store 52(outv) 76
+              68:          65 Load 67(s2d)
+              72:   11(fvec4) ImageSampleImplicitLod 68 71
+              73:   11(fvec4) Load 52(outv)
+              74:   11(fvec4) FAdd 73 72
+                              Store 52(outv) 74
                               Line 1 33 0
-              78:     77(ptr) AccessChain 56 18 18
-              79:      7(int) Load 78
-                              SelectionMerge 83 None
-                              Switch 79 82 
-                                     case 10: 80
-                                     case 20: 81
-              82:               Label
+              76:     75(ptr) AccessChain 56 18 18
+              77:      7(int) Load 76
+                              SelectionMerge 81 None
+                              Switch 77 80 
+                                     case 10: 78
+                                     case 20: 79
+              80:               Label
                                 Line 1 42 0
-              94:   11(fvec4)   Load 52(outv)
-              95:   11(fvec4)   CompositeConstruct 28 28 28 28
-              96:   11(fvec4)   FSub 94 95
-                                Store 52(outv) 96
+              92:   11(fvec4)   Load 52(outv)
+              93:   11(fvec4)   CompositeConstruct 28 28 28 28
+              94:   11(fvec4)   FSub 92 93
+                                Store 52(outv) 94
                                 Line 1 43 0
-                                Branch 83
-              80:               Label
+                                Branch 81
+              78:               Label
                                 Line 1 35 0
-              84:   11(fvec4)   Load 52(outv)
-              85:   11(fvec4)   CompositeConstruct 28 28 28 28
-              86:   11(fvec4)   FAdd 84 85
-                                Store 52(outv) 86
+              82:   11(fvec4)   Load 52(outv)
+              83:   11(fvec4)   CompositeConstruct 28 28 28 28
+              84:   11(fvec4)   FAdd 82 83
+                                Store 52(outv) 84
                                 Line 1 36 0
-                                Branch 83
-              81:               Label
+                                Branch 81
+              79:               Label
                                 Line 1 38 0
-              88:   11(fvec4)   Load 52(outv)
-              89:   11(fvec4)   VectorTimesScalar 88 45
-                                Store 52(outv) 89
+              86:   11(fvec4)   Load 52(outv)
+              87:   11(fvec4)   VectorTimesScalar 86 45
+                                Store 52(outv) 87
                                 Line 1 39 0
-              90:   11(fvec4)   Load 52(outv)
-              91:   11(fvec4)   CompositeConstruct 28 28 28 28
-              92:   11(fvec4)   FAdd 90 91
-                                Store 52(outv) 92
+              88:   11(fvec4)   Load 52(outv)
+              89:   11(fvec4)   CompositeConstruct 28 28 28 28
+              90:   11(fvec4)   FAdd 88 89
+                                Store 52(outv) 90
                                 Line 1 40 0
-                                Branch 83
-              83:             Label
+                                Branch 81
+              81:             Label
                               Line 1 46 0
-                              Store 99(i) 18
-                              Branch 100
-             100:             Label
-                              LoopMerge 102 103 None
-                              Branch 104
-             104:             Label
-             105:      7(int) Load 99(i)
-             107:    37(bool) SLessThan 105 106
-                              BranchConditional 107 101 102
-             101:               Label
+                              Store 97(i) 18
+                              Branch 98
+              98:             Label
+                              LoopMerge 100 101 None
+                              Branch 102
+             102:             Label
+             103:      7(int) Load 97(i)
+             105:    37(bool) SLessThan 103 104
+                              BranchConditional 105 99 100
+              99:               Label
                                 Line 1 47 0
-             108:   11(fvec4)   Load 52(outv)
-             109:   11(fvec4)   VectorTimesScalar 108 36
-                                Store 52(outv) 109
-                                Branch 103
-             103:               Label
+             106:   11(fvec4)   Load 52(outv)
+             107:   11(fvec4)   VectorTimesScalar 106 36
+                                Store 52(outv) 107
+                                Branch 101
+             101:               Label
                                 Line 1 46 0
-             110:      7(int)   Load 99(i)
-             112:      7(int)   IAdd 110 111
-                                Store 99(i) 112
-                                Branch 100
-             102:             Label
+             108:      7(int)   Load 97(i)
+             110:      7(int)   IAdd 108 109
+                                Store 97(i) 110
+                                Branch 98
+             100:             Label
                               Line 1 49 0
-             114:    113(ptr) AccessChain 52(outv) 32
-             115:   10(float) Load 114
-             117:    37(bool) FOrdLessThan 115 116
-                              SelectionMerge 120 None
-                              BranchConditional 117 119 123
-             119:               Label
+             112:    111(ptr) AccessChain 52(outv) 32
+             113:   10(float) Load 112
+             115:    37(bool) FOrdLessThan 113 114
+                              SelectionMerge 118 None
+                              BranchConditional 115 117 121
+             117:               Label
                                 Line 1 50 0
-             121:   11(fvec4)   Load 52(outv)
-             122:   11(fvec4)   ExtInst 2(GLSL.std.450) 13(Sin) 121
-                                Store 52(outv) 122
-                                Store 118 122
-                                Branch 120
-             123:               Label
+             119:   11(fvec4)   Load 52(outv)
+             120:   11(fvec4)   ExtInst 2(GLSL.std.450) 13(Sin) 119
+                                Store 52(outv) 120
+                                Store 116 120
+                                Branch 118
+             121:               Label
                                 Line 1 51 0
-             124:   11(fvec4)   Load 52(outv)
-             125:   11(fvec4)   ExtInst 2(GLSL.std.450) 14(Cos) 124
-                                Store 52(outv) 125
-                                Store 118 125
-                                Branch 120
-             120:             Label
+             122:   11(fvec4)   Load 52(outv)
+             123:   11(fvec4)   ExtInst 2(GLSL.std.450) 14(Cos) 122
+                                Store 52(outv) 123
+                                Store 116 123
+                                Branch 118
+             118:             Label
                               Return
                               FunctionEnd
 14(foo(struct-S-i11;):   11(fvec4) Function None 12
index 0bb266b..809fe9a 100644 (file)
@@ -1,7 +1,7 @@
 spv.debugInfo.frag
 // Module Version 10000
 // Generated by (magic number): 80006
-// Id's are bound by 126
+// Id's are bound by 124
 
                               Capability Shader
                2:             ExtInstImport  "GLSL.std.450"
@@ -85,11 +85,9 @@ void main()
                               Name 54  "ubuf"
                               MemberName 54(ubuf) 0  "s"
                               Name 56  ""
-                              Name 57  "S"
-                              MemberName 57(S) 0  "a"
-                              Name 59  "param"
-                              Name 69  "s2d"
-                              Name 99  "i"
+                              Name 57  "param"
+                              Name 67  "s2d"
+                              Name 97  "i"
                               Decorate 24(inv) Location 0
                               Decorate 52(outv) Location 0
                               MemberDecorate 53(S) 0 Offset 0
@@ -97,9 +95,9 @@ void main()
                               Decorate 54(ubuf) Block
                               Decorate 56 DescriptorSet 3
                               Decorate 56 Binding 0
-                              Decorate 69(s2d) Location 0
-                              Decorate 69(s2d) DescriptorSet 3
-                              Decorate 69(s2d) Binding 1
+                              Decorate 67(s2d) Location 0
+                              Decorate 67(s2d) DescriptorSet 3
+                              Decorate 67(s2d) Binding 1
                3:             TypeVoid
                4:             TypeFunction 3
                7:             TypeInt 32 1
@@ -126,120 +124,118 @@ void main()
         54(ubuf):             TypeStruct 53(S)
               55:             TypePointer Uniform 54(ubuf)
               56:     55(ptr) Variable Uniform
-           57(S):             TypeStruct 7(int)
-              58:             TypePointer Function 57(S)
-              60:             TypePointer Uniform 53(S)
-              66:             TypeImage 10(float) 2D sampled format:Unknown
-              67:             TypeSampledImage 66
-              68:             TypePointer UniformConstant 67
-         69(s2d):     68(ptr) Variable UniformConstant
-              71:             TypeVector 10(float) 2
-              72:   10(float) Constant 1056964608
-              73:   71(fvec2) ConstantComposite 72 72
-              77:             TypePointer Uniform 7(int)
-             106:      7(int) Constant 10
-             111:      7(int) Constant 1
-             113:             TypePointer Output 10(float)
-             116:   10(float) Constant 1092616192
+              58:             TypePointer Uniform 53(S)
+              64:             TypeImage 10(float) 2D sampled format:Unknown
+              65:             TypeSampledImage 64
+              66:             TypePointer UniformConstant 65
+         67(s2d):     66(ptr) Variable UniformConstant
+              69:             TypeVector 10(float) 2
+              70:   10(float) Constant 1056964608
+              71:   69(fvec2) ConstantComposite 70 70
+              75:             TypePointer Uniform 7(int)
+             104:      7(int) Constant 10
+             109:      7(int) Constant 1
+             111:             TypePointer Output 10(float)
+             114:   10(float) Constant 1092616192
          5(main):           3 Function None 4
                6:             Label
-       59(param):     58(ptr) Variable Function
-           99(i):     19(ptr) Variable Function
-             118:     16(ptr) Variable Function
+       57(param):      9(ptr) Variable Function
+           97(i):     19(ptr) Variable Function
+             116:     16(ptr) Variable Function
                               Line 1 30 0
-              61:     60(ptr) AccessChain 56 18
-              62:       53(S) Load 61
-              63:      7(int) CompositeExtract 62 0
-              64:     19(ptr) AccessChain 59(param) 18
-                              Store 64 63
-              65:   11(fvec4) FunctionCall 14(foo(struct-S-i11;) 59(param)
-                              Store 52(outv) 65
+              59:     58(ptr) AccessChain 56 18
+              60:       53(S) Load 59
+              61:      7(int) CompositeExtract 60 0
+              62:     19(ptr) AccessChain 57(param) 18
+                              Store 62 61
+              63:   11(fvec4) FunctionCall 14(foo(struct-S-i11;) 57(param)
+                              Store 52(outv) 63
                               Line 1 31 0
-              70:          67 Load 69(s2d)
-              74:   11(fvec4) ImageSampleImplicitLod 70 73
-              75:   11(fvec4) Load 52(outv)
-              76:   11(fvec4) FAdd 75 74
-                              Store 52(outv) 76
+              68:          65 Load 67(s2d)
+              72:   11(fvec4) ImageSampleImplicitLod 68 71
+              73:   11(fvec4) Load 52(outv)
+              74:   11(fvec4) FAdd 73 72
+                              Store 52(outv) 74
                               Line 1 33 0
-              78:     77(ptr) AccessChain 56 18 18
-              79:      7(int) Load 78
-                              SelectionMerge 83 None
-                              Switch 79 82 
-                                     case 10: 80
-                                     case 20: 81
-              82:               Label
+              76:     75(ptr) AccessChain 56 18 18
+              77:      7(int) Load 76
+                              SelectionMerge 81 None
+                              Switch 77 80 
+                                     case 10: 78
+                                     case 20: 79
+              80:               Label
                                 Line 1 42 0
-              94:   11(fvec4)   Load 52(outv)
-              95:   11(fvec4)   CompositeConstruct 28 28 28 28
-              96:   11(fvec4)   FSub 94 95
-                                Store 52(outv) 96
+              92:   11(fvec4)   Load 52(outv)
+              93:   11(fvec4)   CompositeConstruct 28 28 28 28
+              94:   11(fvec4)   FSub 92 93
+                                Store 52(outv) 94
                                 Line 1 43 0
-                                Branch 83
-              80:               Label
+                                Branch 81
+              78:               Label
                                 Line 1 35 0
-              84:   11(fvec4)   Load 52(outv)
-              85:   11(fvec4)   CompositeConstruct 28 28 28 28
-              86:   11(fvec4)   FAdd 84 85
-                                Store 52(outv) 86
+              82:   11(fvec4)   Load 52(outv)
+              83:   11(fvec4)   CompositeConstruct 28 28 28 28
+              84:   11(fvec4)   FAdd 82 83
+                                Store 52(outv) 84
                                 Line 1 36 0
-                                Branch 83
-              81:               Label
+                                Branch 81
+              79:               Label
                                 Line 1 38 0
-              88:   11(fvec4)   Load 52(outv)
-              89:   11(fvec4)   VectorTimesScalar 88 45
-                                Store 52(outv) 89
+              86:   11(fvec4)   Load 52(outv)
+              87:   11(fvec4)   VectorTimesScalar 86 45
+                                Store 52(outv) 87
                                 Line 1 39 0
-              90:   11(fvec4)   Load 52(outv)
-              91:   11(fvec4)   CompositeConstruct 28 28 28 28
-              92:   11(fvec4)   FAdd 90 91
-                                Store 52(outv) 92
+              88:   11(fvec4)   Load 52(outv)
+              89:   11(fvec4)   CompositeConstruct 28 28 28 28
+              90:   11(fvec4)   FAdd 88 89
+                                Store 52(outv) 90
                                 Line 1 40 0
-                                Branch 83
-              83:             Label
+                                Branch 81
+              81:             Label
                               Line 1 46 0
-                              Store 99(i) 18
-                              Branch 100
-             100:             Label
-                              LoopMerge 102 103 None
-                              Branch 104
-             104:             Label
-             105:      7(int) Load 99(i)
-             107:    37(bool) SLessThan 105 106
-                              BranchConditional 107 101 102
-             101:               Label
+                              Store 97(i) 18
+                              Branch 98
+              98:             Label
+                              LoopMerge 100 101 None
+                              Branch 102
+             102:             Label
+             103:      7(int) Load 97(i)
+             105:    37(bool) SLessThan 103 104
+                              BranchConditional 105 99 100
+              99:               Label
                                 Line 1 47 0
-             108:   11(fvec4)   Load 52(outv)
-             109:   11(fvec4)   VectorTimesScalar 108 36
-                                Store 52(outv) 109
-                                Branch 103
-             103:               Label
+             106:   11(fvec4)   Load 52(outv)
+             107:   11(fvec4)   VectorTimesScalar 106 36
+                                Store 52(outv) 107
+                                Branch 101
+             101:               Label
                                 Line 1 46 0
-             110:      7(int)   Load 99(i)
-             112:      7(int)   IAdd 110 111
-                                Store 99(i) 112
-                                Branch 100
-             102:             Label
+             108:      7(int)   Load 97(i)
+             110:      7(int)   IAdd 108 109
+                                Store 97(i) 110
+                                Branch 98
+             100:             Label
                               Line 1 49 0
-             114:    113(ptr) AccessChain 52(outv) 32
-             115:   10(float) Load 114
-             117:    37(bool) FOrdLessThan 115 116
-                              SelectionMerge 120 None
-                              BranchConditional 117 119 123
-             119:               Label
+             112:    111(ptr) AccessChain 52(outv) 32
+             113:   10(float) Load 112
+             115:    37(bool) FOrdLessThan 113 114
+                              SelectionMerge 118 None
+                              BranchConditional 115 117 121
+             117:               Label
                                 Line 1 50 0
-             121:   11(fvec4)   Load 52(outv)
-             122:   11(fvec4)   ExtInst 2(GLSL.std.450) 13(Sin) 121
-                                Store 52(outv) 122
-                                Store 118 122
-                                Branch 120
-             123:               Label
+             119:   11(fvec4)   Load 52(outv)
+             120:   11(fvec4)   ExtInst 2(GLSL.std.450) 13(Sin) 119
+                                Store 52(outv) 120
+                                Store 116 120
+                                Branch 118
+             121:               Label
                                 Line 1 51 0
-             124:   11(fvec4)   Load 52(outv)
-             125:   11(fvec4)   ExtInst 2(GLSL.std.450) 14(Cos) 124
-                                Store 52(outv) 125
-                                Store 118 125
-                                Branch 120
-             120:             Label
+             122:   11(fvec4)   Load 52(outv)
+             123:   11(fvec4)   ExtInst 2(GLSL.std.450) 14(Cos) 122
+                                Store 52(outv) 123
+                                Store 116 123
+                                Branch 118
+             118:             Label
                               Return
                               FunctionEnd
 14(foo(struct-S-i11;):   11(fvec4) Function None 12
index eef3021..b852ed1 100755 (executable)
@@ -1,7 +1,7 @@
 spv.multiStructFuncall.frag
 // Module Version 10000
 // Generated by (magic number): 80006
-// Id's are bound by 63
+// Id's are bound by 66
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
@@ -23,20 +23,21 @@ spv.multiStructFuncall.frag
                               Name 23  "blockName"
                               MemberName 23(blockName) 0  "s1"
                               Name 25  ""
-                              Name 33  "s2"
-                              Name 36  "S"
-                              MemberName 36(S) 0  "m"
-                              Name 38  "param"
-                              Name 45  "param"
+                              Name 31  "S"
+                              MemberName 31(S) 0  "m"
+                              Name 32  "arg"
+                              Name 39  "s2"
+                              Name 42  "param"
                               Name 48  "param"
-                              Name 59  "param"
+                              Name 51  "param"
+                              Name 62  "param"
                               MemberDecorate 22(S) 0 ColMajor
                               MemberDecorate 22(S) 0 Offset 0
                               MemberDecorate 22(S) 0 MatrixStride 16
                               MemberDecorate 23(blockName) 0 Offset 0
                               Decorate 23(blockName) BufferBlock
                               Decorate 25 DescriptorSet 0
-                              MemberDecorate 36(S) 0 ColMajor
+                              MemberDecorate 31(S) 0 ColMajor
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -53,48 +54,52 @@ spv.multiStructFuncall.frag
               26:             TypeInt 32 1
               27:     26(int) Constant 0
               28:             TypePointer Uniform 22(S)
-              32:             TypePointer Private 9(S)
-          33(s2):     32(ptr) Variable Private
-           36(S):             TypeStruct 8
-              37:             TypePointer Function 36(S)
-              42:             TypePointer Function 8
-              57:             TypePointer Uniform 8
+           31(S):             TypeStruct 8
+              34:             TypePointer Function 8
+              38:             TypePointer Private 9(S)
+          39(s2):     38(ptr) Variable Private
+              60:             TypePointer Uniform 8
          4(main):           2 Function None 3
                5:             Label
-       38(param):     37(ptr) Variable Function
-       45(param):     14(ptr) Variable Function
-       48(param):     37(ptr) Variable Function
-       59(param):     14(ptr) Variable Function
+         32(arg):     14(ptr) Variable Function
+       42(param):     14(ptr) Variable Function
+       48(param):     14(ptr) Variable Function
+       51(param):     14(ptr) Variable Function
+       62(param):     14(ptr) Variable Function
               29:     28(ptr) AccessChain 25 27
               30:       22(S) Load 29
-              31:           2 FunctionCall 12(fooConst(struct-S-mf441;) 30
-              34:        9(S) Load 33(s2)
-              35:           2 FunctionCall 12(fooConst(struct-S-mf441;) 34
-              39:     28(ptr) AccessChain 25 27
-              40:       22(S) Load 39
-              41:           8 CompositeExtract 40 0
-              43:     42(ptr) AccessChain 38(param) 27
-                              Store 43 41
-              44:           2 FunctionCall 17(foo(struct-S-mf441;) 38(param)
-              46:        9(S) Load 33(s2)
-                              Store 45(param) 46
-              47:           2 FunctionCall 17(foo(struct-S-mf441;) 45(param)
-              49:     28(ptr) AccessChain 25 27
-              50:       22(S) Load 49
-              51:           8 CompositeExtract 50 0
-              52:     42(ptr) AccessChain 48(param) 27
-                              Store 52 51
-              53:           2 FunctionCall 20(fooOut(struct-S-mf441;) 48(param)
-              54:       36(S) Load 48(param)
-              55:     28(ptr) AccessChain 25 27
-              56:           8 CompositeExtract 54 0
-              58:     57(ptr) AccessChain 55 27
-                              Store 58 56
-              60:        9(S) Load 33(s2)
-                              Store 59(param) 60
-              61:           2 FunctionCall 20(fooOut(struct-S-mf441;) 59(param)
-              62:        9(S) Load 59(param)
-                              Store 33(s2) 62
+              33:           8 CompositeExtract 30 0
+              35:     34(ptr) AccessChain 32(arg) 27
+                              Store 35 33
+              36:        9(S) Load 32(arg)
+              37:           2 FunctionCall 12(fooConst(struct-S-mf441;) 36
+              40:        9(S) Load 39(s2)
+              41:           2 FunctionCall 12(fooConst(struct-S-mf441;) 40
+              43:     28(ptr) AccessChain 25 27
+              44:       22(S) Load 43
+              45:           8 CompositeExtract 44 0
+              46:     34(ptr) AccessChain 42(param) 27
+                              Store 46 45
+              47:           2 FunctionCall 17(foo(struct-S-mf441;) 42(param)
+              49:        9(S) Load 39(s2)
+                              Store 48(param) 49
+              50:           2 FunctionCall 17(foo(struct-S-mf441;) 48(param)
+              52:     28(ptr) AccessChain 25 27
+              53:       22(S) Load 52
+              54:           8 CompositeExtract 53 0
+              55:     34(ptr) AccessChain 51(param) 27
+                              Store 55 54
+              56:           2 FunctionCall 20(fooOut(struct-S-mf441;) 51(param)
+              57:        9(S) Load 51(param)
+              58:     28(ptr) AccessChain 25 27
+              59:           8 CompositeExtract 57 0
+              61:     60(ptr) AccessChain 58 27
+                              Store 61 59
+              63:        9(S) Load 39(s2)
+                              Store 62(param) 63
+              64:           2 FunctionCall 20(fooOut(struct-S-mf441;) 62(param)
+              65:        9(S) Load 62(param)
+                              Store 39(s2) 65
                               Return
                               FunctionEnd
 12(fooConst(struct-S-mf441;):           2 Function None 10