Merge pull request #1370 from KhronosGroup/fix-param-types

Fix #944: Convert argument type to match formal parameter type.
This commit is contained in:
John Kessenich 2018-05-04 21:19:47 -06:00 committed by GitHub
commit d2e9829a88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 277 additions and 274 deletions

View File

@ -170,7 +170,7 @@ protected:
void declareUseOfStructMember(const glslang::TTypeList& members, int glslangMember); void declareUseOfStructMember(const glslang::TTypeList& members, int glslangMember);
bool isShaderEntryPoint(const glslang::TIntermAggregate* node); bool isShaderEntryPoint(const glslang::TIntermAggregate* node);
bool writableParam(glslang::TStorageQualifier); bool writableParam(glslang::TStorageQualifier) const;
bool originalParam(glslang::TStorageQualifier, const glslang::TType&, bool implicitThisParam); bool originalParam(glslang::TStorageQualifier, const glslang::TType&, bool implicitThisParam);
void makeFunctions(const glslang::TIntermSequence&); void makeFunctions(const glslang::TIntermSequence&);
void makeGlobalInitializers(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? // Does parameter need a place to keep writes, separate from the original?
// Assumes called after originalParam(), which filters out block/buffer/opaque-based // Assumes called after originalParam(), which filters out block/buffer/opaque-based
// qualifiers such that we should have only in/out/inout/constreadonly here. // 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 || assert(qualifier == glslang::EvqIn ||
qualifier == glslang::EvqOut || qualifier == glslang::EvqOut ||
@ -3954,18 +3954,17 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
// 3. Make the call // 3. Make the call
// 4. Copy back the results // 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::Builder::AccessChain> lValues;
std::vector<spv::Id> rValues; std::vector<spv::Id> rValues;
std::vector<const glslang::TType*> argTypes; std::vector<const glslang::TType*> argTypes;
for (int a = 0; a < (int)glslangArgs.size(); ++a) { 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 // build l-value
builder.clearAccessChain(); builder.clearAccessChain();
glslangArgs[a]->traverse(this); glslangArgs[a]->traverse(this);
argTypes.push_back(&paramType);
// keep outputs and pass-by-originals as l-values, evaluate others as r-values // 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])) { writableParam(qualifiers[a])) {
// save l-value // save l-value
lValues.push_back(builder.getAccessChain()); lValues.push_back(builder.getAccessChain());
@ -3983,26 +3982,33 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
int rValueCount = 0; int rValueCount = 0;
std::vector<spv::Id> spvArgs; std::vector<spv::Id> spvArgs;
for (int a = 0; a < (int)glslangArgs.size(); ++a) { for (int a = 0; a < (int)glslangArgs.size(); ++a) {
const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType();
spv::Id arg; 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]); builder.setAccessChain(lValues[lValueCount]);
arg = builder.accessChainGetLValue(); arg = builder.accessChainGetLValue();
++lValueCount; ++lValueCount;
} else if (writableParam(qualifiers[a])) { } else if (writableParam(qualifiers[a])) {
// need space to hold the copy // 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) { if (qualifiers[a] == glslang::EvqIn || qualifiers[a] == glslang::EvqInOut) {
// need to copy the input into output space // need to copy the input into output space
builder.setAccessChain(lValues[lValueCount]); builder.setAccessChain(lValues[lValueCount]);
spv::Id copy = accessChainLoad(*argTypes[a]); spv::Id copy = accessChainLoad(*argTypes[a]);
builder.clearAccessChain(); builder.clearAccessChain();
builder.setAccessChainLValue(arg); builder.setAccessChainLValue(arg);
multiTypeStore(paramType, copy); multiTypeStore(*argTypes[a], copy);
} }
++lValueCount; ++lValueCount;
} else { } 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; ++rValueCount;
} }
spvArgs.push_back(arg); spvArgs.push_back(arg);
@ -4015,14 +4021,13 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
// 4. Copy back out an "out" arguments. // 4. Copy back out an "out" arguments.
lValueCount = 0; lValueCount = 0;
for (int a = 0; a < (int)glslangArgs.size(); ++a) { for (int a = 0; a < (int)glslangArgs.size(); ++a) {
const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType(); if (originalParam(qualifiers[a], *argTypes[a], function->hasImplicitThis() && a == 0))
if (originalParam(qualifiers[a], paramType, function->hasImplicitThis() && a == 0))
++lValueCount; ++lValueCount;
else if (writableParam(qualifiers[a])) { else if (writableParam(qualifiers[a])) {
if (qualifiers[a] == glslang::EvqOut || qualifiers[a] == glslang::EvqInOut) { if (qualifiers[a] == glslang::EvqOut || qualifiers[a] == glslang::EvqInOut) {
spv::Id copy = builder.createLoad(spvArgs[a]); spv::Id copy = builder.createLoad(spvArgs[a]);
builder.setAccessChain(lValues[lValueCount]); builder.setAccessChain(lValues[lValueCount]);
multiTypeStore(paramType, copy); multiTypeStore(*argTypes[a], copy);
} }
++lValueCount; ++lValueCount;
} }

View File

@ -258,7 +258,8 @@ public:
delete blocks[i]; delete blocks[i];
} }
Id getId() const { return functionInstruction.getResultId(); } 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 addBlock(Block* block) { blocks.push_back(block); }
void removeBlock(Block* block) void removeBlock(Block* block)

View File

@ -1,7 +1,7 @@
spv.debugInfo.frag spv.debugInfo.frag
// Module Version 10300 // Module Version 10300
// Generated by (magic number): 80006 // Generated by (magic number): 80006
// Id's are bound by 126 // Id's are bound by 124
Capability Shader Capability Shader
2: ExtInstImport "GLSL.std.450" 2: ExtInstImport "GLSL.std.450"
@ -74,11 +74,9 @@ void main()
Name 54 "ubuf" Name 54 "ubuf"
MemberName 54(ubuf) 0 "s" MemberName 54(ubuf) 0 "s"
Name 56 "" Name 56 ""
Name 57 "S" Name 57 "param"
MemberName 57(S) 0 "a" Name 67 "s2d"
Name 59 "param" Name 97 "i"
Name 69 "s2d"
Name 99 "i"
ModuleProcessed "no-storage-format" ModuleProcessed "no-storage-format"
ModuleProcessed "resource-set-binding 3" ModuleProcessed "resource-set-binding 3"
ModuleProcessed "auto-map-locations" ModuleProcessed "auto-map-locations"
@ -94,8 +92,8 @@ void main()
MemberDecorate 54(ubuf) 0 Offset 0 MemberDecorate 54(ubuf) 0 Offset 0
Decorate 54(ubuf) Block Decorate 54(ubuf) Block
Decorate 56 DescriptorSet 3 Decorate 56 DescriptorSet 3
Decorate 69(s2d) Location 0 Decorate 67(s2d) Location 0
Decorate 69(s2d) DescriptorSet 3 Decorate 67(s2d) DescriptorSet 3
3: TypeVoid 3: TypeVoid
4: TypeFunction 3 4: TypeFunction 3
7: TypeInt 32 1 7: TypeInt 32 1
@ -122,120 +120,118 @@ void main()
54(ubuf): TypeStruct 53(S) 54(ubuf): TypeStruct 53(S)
55: TypePointer Uniform 54(ubuf) 55: TypePointer Uniform 54(ubuf)
56: 55(ptr) Variable Uniform 56: 55(ptr) Variable Uniform
57(S): TypeStruct 7(int) 58: TypePointer Uniform 53(S)
58: TypePointer Function 57(S) 64: TypeImage 10(float) 2D sampled format:Unknown
60: TypePointer Uniform 53(S) 65: TypeSampledImage 64
66: TypeImage 10(float) 2D sampled format:Unknown 66: TypePointer UniformConstant 65
67: TypeSampledImage 66 67(s2d): 66(ptr) Variable UniformConstant
68: TypePointer UniformConstant 67 69: TypeVector 10(float) 2
69(s2d): 68(ptr) Variable UniformConstant 70: 10(float) Constant 1056964608
71: TypeVector 10(float) 2 71: 69(fvec2) ConstantComposite 70 70
72: 10(float) Constant 1056964608 75: TypePointer Uniform 7(int)
73: 71(fvec2) ConstantComposite 72 72 104: 7(int) Constant 10
77: TypePointer Uniform 7(int) 109: 7(int) Constant 1
106: 7(int) Constant 10 111: TypePointer Output 10(float)
111: 7(int) Constant 1 114: 10(float) Constant 1092616192
113: TypePointer Output 10(float)
116: 10(float) Constant 1092616192
5(main): 3 Function None 4 5(main): 3 Function None 4
6: Label 6: Label
59(param): 58(ptr) Variable Function 57(param): 9(ptr) Variable Function
99(i): 19(ptr) Variable Function 97(i): 19(ptr) Variable Function
118: 16(ptr) Variable Function 116: 16(ptr) Variable Function
Line 1 30 0 Line 1 30 0
61: 60(ptr) AccessChain 56 18 59: 58(ptr) AccessChain 56 18
62: 53(S) Load 61 60: 53(S) Load 59
63: 7(int) CompositeExtract 62 0 61: 7(int) CompositeExtract 60 0
64: 19(ptr) AccessChain 59(param) 18 62: 19(ptr) AccessChain 57(param) 18
Store 64 63 Store 62 61
65: 11(fvec4) FunctionCall 14(foo(struct-S-i11;) 59(param) 63: 11(fvec4) FunctionCall 14(foo(struct-S-i11;) 57(param)
Store 52(outv) 65 Store 52(outv) 63
Line 1 31 0 Line 1 31 0
70: 67 Load 69(s2d) 68: 65 Load 67(s2d)
74: 11(fvec4) ImageSampleImplicitLod 70 73 72: 11(fvec4) ImageSampleImplicitLod 68 71
75: 11(fvec4) Load 52(outv) 73: 11(fvec4) Load 52(outv)
76: 11(fvec4) FAdd 75 74 74: 11(fvec4) FAdd 73 72
Store 52(outv) 76 Store 52(outv) 74
Line 1 33 0 Line 1 33 0
78: 77(ptr) AccessChain 56 18 18 76: 75(ptr) AccessChain 56 18 18
79: 7(int) Load 78 77: 7(int) Load 76
SelectionMerge 83 None SelectionMerge 81 None
Switch 79 82 Switch 77 80
case 10: 80 case 10: 78
case 20: 81 case 20: 79
82: 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
Line 1 43 0
Branch 83
80: Label 80: Label
Line 1 42 0
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 81
78: Label
Line 1 35 0 Line 1 35 0
84: 11(fvec4) Load 52(outv) 82: 11(fvec4) Load 52(outv)
85: 11(fvec4) CompositeConstruct 28 28 28 28 83: 11(fvec4) CompositeConstruct 28 28 28 28
86: 11(fvec4) FAdd 84 85 84: 11(fvec4) FAdd 82 83
Store 52(outv) 86 Store 52(outv) 84
Line 1 36 0 Line 1 36 0
Branch 83 Branch 81
81: Label 79: Label
Line 1 38 0 Line 1 38 0
88: 11(fvec4) Load 52(outv) 86: 11(fvec4) Load 52(outv)
89: 11(fvec4) VectorTimesScalar 88 45 87: 11(fvec4) VectorTimesScalar 86 45
Store 52(outv) 89 Store 52(outv) 87
Line 1 39 0 Line 1 39 0
90: 11(fvec4) Load 52(outv) 88: 11(fvec4) Load 52(outv)
91: 11(fvec4) CompositeConstruct 28 28 28 28 89: 11(fvec4) CompositeConstruct 28 28 28 28
92: 11(fvec4) FAdd 90 91 90: 11(fvec4) FAdd 88 89
Store 52(outv) 92 Store 52(outv) 90
Line 1 40 0 Line 1 40 0
Branch 83 Branch 81
83: Label 81: Label
Line 1 46 0 Line 1 46 0
Store 99(i) 18 Store 97(i) 18
Branch 100 Branch 98
100: Label 98: Label
LoopMerge 102 103 None LoopMerge 100 101 None
Branch 104 Branch 102
104: Label
105: 7(int) Load 99(i)
107: 37(bool) SLessThan 105 106
BranchConditional 107 101 102
101: 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
Line 1 46 0
110: 7(int) Load 99(i)
112: 7(int) IAdd 110 111
Store 99(i) 112
Branch 100
102: Label 102: Label
103: 7(int) Load 97(i)
105: 37(bool) SLessThan 103 104
BranchConditional 105 99 100
99: Label
Line 1 47 0
106: 11(fvec4) Load 52(outv)
107: 11(fvec4) VectorTimesScalar 106 36
Store 52(outv) 107
Branch 101
101: Label
Line 1 46 0
108: 7(int) Load 97(i)
110: 7(int) IAdd 108 109
Store 97(i) 110
Branch 98
100: Label
Line 1 49 0 Line 1 49 0
114: 113(ptr) AccessChain 52(outv) 32 112: 111(ptr) AccessChain 52(outv) 32
115: 10(float) Load 114 113: 10(float) Load 112
117: 37(bool) FOrdLessThan 115 116 115: 37(bool) FOrdLessThan 113 114
SelectionMerge 120 None SelectionMerge 118 None
BranchConditional 117 119 123 BranchConditional 115 117 121
119: Label 117: Label
Line 1 50 0 Line 1 50 0
121: 11(fvec4) Load 52(outv) 119: 11(fvec4) Load 52(outv)
122: 11(fvec4) ExtInst 2(GLSL.std.450) 13(Sin) 121 120: 11(fvec4) ExtInst 2(GLSL.std.450) 13(Sin) 119
Store 52(outv) 122 Store 52(outv) 120
Store 118 122 Store 116 120
Branch 120 Branch 118
123: Label 121: Label
Line 1 51 0 Line 1 51 0
124: 11(fvec4) Load 52(outv) 122: 11(fvec4) Load 52(outv)
125: 11(fvec4) ExtInst 2(GLSL.std.450) 14(Cos) 124 123: 11(fvec4) ExtInst 2(GLSL.std.450) 14(Cos) 122
Store 52(outv) 125 Store 52(outv) 123
Store 118 125 Store 116 123
Branch 120 Branch 118
120: Label 118: Label
Return Return
FunctionEnd FunctionEnd
14(foo(struct-S-i11;): 11(fvec4) Function None 12 14(foo(struct-S-i11;): 11(fvec4) Function None 12

View File

@ -1,7 +1,7 @@
spv.debugInfo.frag spv.debugInfo.frag
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80006 // Generated by (magic number): 80006
// Id's are bound by 126 // Id's are bound by 124
Capability Shader Capability Shader
2: ExtInstImport "GLSL.std.450" 2: ExtInstImport "GLSL.std.450"
@ -85,11 +85,9 @@ void main()
Name 54 "ubuf" Name 54 "ubuf"
MemberName 54(ubuf) 0 "s" MemberName 54(ubuf) 0 "s"
Name 56 "" Name 56 ""
Name 57 "S" Name 57 "param"
MemberName 57(S) 0 "a" Name 67 "s2d"
Name 59 "param" Name 97 "i"
Name 69 "s2d"
Name 99 "i"
Decorate 24(inv) Location 0 Decorate 24(inv) Location 0
Decorate 52(outv) Location 0 Decorate 52(outv) Location 0
MemberDecorate 53(S) 0 Offset 0 MemberDecorate 53(S) 0 Offset 0
@ -97,9 +95,9 @@ void main()
Decorate 54(ubuf) Block Decorate 54(ubuf) Block
Decorate 56 DescriptorSet 3 Decorate 56 DescriptorSet 3
Decorate 56 Binding 0 Decorate 56 Binding 0
Decorate 69(s2d) Location 0 Decorate 67(s2d) Location 0
Decorate 69(s2d) DescriptorSet 3 Decorate 67(s2d) DescriptorSet 3
Decorate 69(s2d) Binding 1 Decorate 67(s2d) Binding 1
3: TypeVoid 3: TypeVoid
4: TypeFunction 3 4: TypeFunction 3
7: TypeInt 32 1 7: TypeInt 32 1
@ -126,120 +124,118 @@ void main()
54(ubuf): TypeStruct 53(S) 54(ubuf): TypeStruct 53(S)
55: TypePointer Uniform 54(ubuf) 55: TypePointer Uniform 54(ubuf)
56: 55(ptr) Variable Uniform 56: 55(ptr) Variable Uniform
57(S): TypeStruct 7(int) 58: TypePointer Uniform 53(S)
58: TypePointer Function 57(S) 64: TypeImage 10(float) 2D sampled format:Unknown
60: TypePointer Uniform 53(S) 65: TypeSampledImage 64
66: TypeImage 10(float) 2D sampled format:Unknown 66: TypePointer UniformConstant 65
67: TypeSampledImage 66 67(s2d): 66(ptr) Variable UniformConstant
68: TypePointer UniformConstant 67 69: TypeVector 10(float) 2
69(s2d): 68(ptr) Variable UniformConstant 70: 10(float) Constant 1056964608
71: TypeVector 10(float) 2 71: 69(fvec2) ConstantComposite 70 70
72: 10(float) Constant 1056964608 75: TypePointer Uniform 7(int)
73: 71(fvec2) ConstantComposite 72 72 104: 7(int) Constant 10
77: TypePointer Uniform 7(int) 109: 7(int) Constant 1
106: 7(int) Constant 10 111: TypePointer Output 10(float)
111: 7(int) Constant 1 114: 10(float) Constant 1092616192
113: TypePointer Output 10(float)
116: 10(float) Constant 1092616192
5(main): 3 Function None 4 5(main): 3 Function None 4
6: Label 6: Label
59(param): 58(ptr) Variable Function 57(param): 9(ptr) Variable Function
99(i): 19(ptr) Variable Function 97(i): 19(ptr) Variable Function
118: 16(ptr) Variable Function 116: 16(ptr) Variable Function
Line 1 30 0 Line 1 30 0
61: 60(ptr) AccessChain 56 18 59: 58(ptr) AccessChain 56 18
62: 53(S) Load 61 60: 53(S) Load 59
63: 7(int) CompositeExtract 62 0 61: 7(int) CompositeExtract 60 0
64: 19(ptr) AccessChain 59(param) 18 62: 19(ptr) AccessChain 57(param) 18
Store 64 63 Store 62 61
65: 11(fvec4) FunctionCall 14(foo(struct-S-i11;) 59(param) 63: 11(fvec4) FunctionCall 14(foo(struct-S-i11;) 57(param)
Store 52(outv) 65 Store 52(outv) 63
Line 1 31 0 Line 1 31 0
70: 67 Load 69(s2d) 68: 65 Load 67(s2d)
74: 11(fvec4) ImageSampleImplicitLod 70 73 72: 11(fvec4) ImageSampleImplicitLod 68 71
75: 11(fvec4) Load 52(outv) 73: 11(fvec4) Load 52(outv)
76: 11(fvec4) FAdd 75 74 74: 11(fvec4) FAdd 73 72
Store 52(outv) 76 Store 52(outv) 74
Line 1 33 0 Line 1 33 0
78: 77(ptr) AccessChain 56 18 18 76: 75(ptr) AccessChain 56 18 18
79: 7(int) Load 78 77: 7(int) Load 76
SelectionMerge 83 None SelectionMerge 81 None
Switch 79 82 Switch 77 80
case 10: 80 case 10: 78
case 20: 81 case 20: 79
82: 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
Line 1 43 0
Branch 83
80: Label 80: Label
Line 1 42 0
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 81
78: Label
Line 1 35 0 Line 1 35 0
84: 11(fvec4) Load 52(outv) 82: 11(fvec4) Load 52(outv)
85: 11(fvec4) CompositeConstruct 28 28 28 28 83: 11(fvec4) CompositeConstruct 28 28 28 28
86: 11(fvec4) FAdd 84 85 84: 11(fvec4) FAdd 82 83
Store 52(outv) 86 Store 52(outv) 84
Line 1 36 0 Line 1 36 0
Branch 83 Branch 81
81: Label 79: Label
Line 1 38 0 Line 1 38 0
88: 11(fvec4) Load 52(outv) 86: 11(fvec4) Load 52(outv)
89: 11(fvec4) VectorTimesScalar 88 45 87: 11(fvec4) VectorTimesScalar 86 45
Store 52(outv) 89 Store 52(outv) 87
Line 1 39 0 Line 1 39 0
90: 11(fvec4) Load 52(outv) 88: 11(fvec4) Load 52(outv)
91: 11(fvec4) CompositeConstruct 28 28 28 28 89: 11(fvec4) CompositeConstruct 28 28 28 28
92: 11(fvec4) FAdd 90 91 90: 11(fvec4) FAdd 88 89
Store 52(outv) 92 Store 52(outv) 90
Line 1 40 0 Line 1 40 0
Branch 83 Branch 81
83: Label 81: Label
Line 1 46 0 Line 1 46 0
Store 99(i) 18 Store 97(i) 18
Branch 100 Branch 98
100: Label 98: Label
LoopMerge 102 103 None LoopMerge 100 101 None
Branch 104 Branch 102
104: Label
105: 7(int) Load 99(i)
107: 37(bool) SLessThan 105 106
BranchConditional 107 101 102
101: 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
Line 1 46 0
110: 7(int) Load 99(i)
112: 7(int) IAdd 110 111
Store 99(i) 112
Branch 100
102: Label 102: Label
103: 7(int) Load 97(i)
105: 37(bool) SLessThan 103 104
BranchConditional 105 99 100
99: Label
Line 1 47 0
106: 11(fvec4) Load 52(outv)
107: 11(fvec4) VectorTimesScalar 106 36
Store 52(outv) 107
Branch 101
101: Label
Line 1 46 0
108: 7(int) Load 97(i)
110: 7(int) IAdd 108 109
Store 97(i) 110
Branch 98
100: Label
Line 1 49 0 Line 1 49 0
114: 113(ptr) AccessChain 52(outv) 32 112: 111(ptr) AccessChain 52(outv) 32
115: 10(float) Load 114 113: 10(float) Load 112
117: 37(bool) FOrdLessThan 115 116 115: 37(bool) FOrdLessThan 113 114
SelectionMerge 120 None SelectionMerge 118 None
BranchConditional 117 119 123 BranchConditional 115 117 121
119: Label 117: Label
Line 1 50 0 Line 1 50 0
121: 11(fvec4) Load 52(outv) 119: 11(fvec4) Load 52(outv)
122: 11(fvec4) ExtInst 2(GLSL.std.450) 13(Sin) 121 120: 11(fvec4) ExtInst 2(GLSL.std.450) 13(Sin) 119
Store 52(outv) 122 Store 52(outv) 120
Store 118 122 Store 116 120
Branch 120 Branch 118
123: Label 121: Label
Line 1 51 0 Line 1 51 0
124: 11(fvec4) Load 52(outv) 122: 11(fvec4) Load 52(outv)
125: 11(fvec4) ExtInst 2(GLSL.std.450) 14(Cos) 124 123: 11(fvec4) ExtInst 2(GLSL.std.450) 14(Cos) 122
Store 52(outv) 125 Store 52(outv) 123
Store 118 125 Store 116 123
Branch 120 Branch 118
120: Label 118: Label
Return Return
FunctionEnd FunctionEnd
14(foo(struct-S-i11;): 11(fvec4) Function None 12 14(foo(struct-S-i11;): 11(fvec4) Function None 12

View File

@ -1,7 +1,7 @@
spv.multiStructFuncall.frag spv.multiStructFuncall.frag
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80006 // Generated by (magic number): 80006
// Id's are bound by 63 // Id's are bound by 66
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
@ -23,20 +23,21 @@ spv.multiStructFuncall.frag
Name 23 "blockName" Name 23 "blockName"
MemberName 23(blockName) 0 "s1" MemberName 23(blockName) 0 "s1"
Name 25 "" Name 25 ""
Name 33 "s2" Name 31 "S"
Name 36 "S" MemberName 31(S) 0 "m"
MemberName 36(S) 0 "m" Name 32 "arg"
Name 38 "param" Name 39 "s2"
Name 45 "param" Name 42 "param"
Name 48 "param" Name 48 "param"
Name 59 "param" Name 51 "param"
Name 62 "param"
MemberDecorate 22(S) 0 ColMajor MemberDecorate 22(S) 0 ColMajor
MemberDecorate 22(S) 0 Offset 0 MemberDecorate 22(S) 0 Offset 0
MemberDecorate 22(S) 0 MatrixStride 16 MemberDecorate 22(S) 0 MatrixStride 16
MemberDecorate 23(blockName) 0 Offset 0 MemberDecorate 23(blockName) 0 Offset 0
Decorate 23(blockName) BufferBlock Decorate 23(blockName) BufferBlock
Decorate 25 DescriptorSet 0 Decorate 25 DescriptorSet 0
MemberDecorate 36(S) 0 ColMajor MemberDecorate 31(S) 0 ColMajor
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
@ -53,48 +54,52 @@ spv.multiStructFuncall.frag
26: TypeInt 32 1 26: TypeInt 32 1
27: 26(int) Constant 0 27: 26(int) Constant 0
28: TypePointer Uniform 22(S) 28: TypePointer Uniform 22(S)
32: TypePointer Private 9(S) 31(S): TypeStruct 8
33(s2): 32(ptr) Variable Private 34: TypePointer Function 8
36(S): TypeStruct 8 38: TypePointer Private 9(S)
37: TypePointer Function 36(S) 39(s2): 38(ptr) Variable Private
42: TypePointer Function 8 60: TypePointer Uniform 8
57: TypePointer Uniform 8
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
38(param): 37(ptr) Variable Function 32(arg): 14(ptr) Variable Function
45(param): 14(ptr) Variable Function 42(param): 14(ptr) Variable Function
48(param): 37(ptr) Variable Function 48(param): 14(ptr) Variable Function
59(param): 14(ptr) Variable Function 51(param): 14(ptr) Variable Function
62(param): 14(ptr) Variable Function
29: 28(ptr) AccessChain 25 27 29: 28(ptr) AccessChain 25 27
30: 22(S) Load 29 30: 22(S) Load 29
31: 2 FunctionCall 12(fooConst(struct-S-mf441;) 30 33: 8 CompositeExtract 30 0
34: 9(S) Load 33(s2) 35: 34(ptr) AccessChain 32(arg) 27
35: 2 FunctionCall 12(fooConst(struct-S-mf441;) 34 Store 35 33
39: 28(ptr) AccessChain 25 27 36: 9(S) Load 32(arg)
40: 22(S) Load 39 37: 2 FunctionCall 12(fooConst(struct-S-mf441;) 36
41: 8 CompositeExtract 40 0 40: 9(S) Load 39(s2)
43: 42(ptr) AccessChain 38(param) 27 41: 2 FunctionCall 12(fooConst(struct-S-mf441;) 40
Store 43 41 43: 28(ptr) AccessChain 25 27
44: 2 FunctionCall 17(foo(struct-S-mf441;) 38(param) 44: 22(S) Load 43
46: 9(S) Load 33(s2) 45: 8 CompositeExtract 44 0
Store 45(param) 46 46: 34(ptr) AccessChain 42(param) 27
47: 2 FunctionCall 17(foo(struct-S-mf441;) 45(param) Store 46 45
49: 28(ptr) AccessChain 25 27 47: 2 FunctionCall 17(foo(struct-S-mf441;) 42(param)
50: 22(S) Load 49 49: 9(S) Load 39(s2)
51: 8 CompositeExtract 50 0 Store 48(param) 49
52: 42(ptr) AccessChain 48(param) 27 50: 2 FunctionCall 17(foo(struct-S-mf441;) 48(param)
Store 52 51 52: 28(ptr) AccessChain 25 27
53: 2 FunctionCall 20(fooOut(struct-S-mf441;) 48(param) 53: 22(S) Load 52
54: 36(S) Load 48(param) 54: 8 CompositeExtract 53 0
55: 28(ptr) AccessChain 25 27 55: 34(ptr) AccessChain 51(param) 27
56: 8 CompositeExtract 54 0 Store 55 54
58: 57(ptr) AccessChain 55 27 56: 2 FunctionCall 20(fooOut(struct-S-mf441;) 51(param)
Store 58 56 57: 9(S) Load 51(param)
60: 9(S) Load 33(s2) 58: 28(ptr) AccessChain 25 27
Store 59(param) 60 59: 8 CompositeExtract 57 0
61: 2 FunctionCall 20(fooOut(struct-S-mf441;) 59(param) 61: 60(ptr) AccessChain 58 27
62: 9(S) Load 59(param) Store 61 59
Store 33(s2) 62 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 Return
FunctionEnd FunctionEnd
12(fooConst(struct-S-mf441;): 2 Function None 10 12(fooConst(struct-S-mf441;): 2 Function None 10