Do true SPV type check for function array arg linkage

Previous check was missing type difference between uniform array
actual arg with stride decoration and the formal arg without. Now
does logical or component-wise copy where needed.

Fixes #2637
This commit is contained in:
Greg Fischer 2021-05-20 09:17:53 -06:00
parent e71278cc92
commit 11c24e9adb
8 changed files with 308 additions and 100 deletions

View file

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