SPV return from main: Simplify a legacy design such returns are not jumps to exit block.
Structured control-flow rules allow leaving the middle of a construct through a return, but not through a jump to a block that does a return. Addresses issue #58.
This commit is contained in:
parent
5f5b205ce9
commit
e770b3e6cf
74 changed files with 9648 additions and 9816 deletions
|
|
@ -7,7 +7,7 @@ Linked fragment stage:
|
|||
|
||||
// Module Version 99
|
||||
// Generated by (magic number): 51a00bb
|
||||
// Id's are bound by 121
|
||||
// Id's are bound by 120
|
||||
|
||||
Source GLSL 130
|
||||
Capability Shader
|
||||
|
|
@ -16,179 +16,177 @@ Linked fragment stage:
|
|||
EntryPoint Fragment 4 "main"
|
||||
ExecutionMode 4 OriginLowerLeft
|
||||
Name 4 "main"
|
||||
Name 9 "s0"
|
||||
MemberName 9(s0) 0 "i"
|
||||
Name 10 "s1"
|
||||
MemberName 10(s1) 0 "i"
|
||||
MemberName 10(s1) 1 "f"
|
||||
MemberName 10(s1) 2 "s0_1"
|
||||
Name 11 "s2"
|
||||
MemberName 11(s2) 0 "i"
|
||||
MemberName 11(s2) 1 "f"
|
||||
MemberName 11(s2) 2 "s1_1"
|
||||
Name 15 "s3"
|
||||
MemberName 15(s3) 0 "s2_1"
|
||||
MemberName 15(s3) 1 "i"
|
||||
MemberName 15(s3) 2 "f"
|
||||
MemberName 15(s3) 3 "s1_1"
|
||||
Name 17 "foo3"
|
||||
Name 28 "locals2"
|
||||
Name 41 "fArray"
|
||||
Name 47 "locals1Array"
|
||||
Name 50 "foo1"
|
||||
Name 54 "locals0"
|
||||
Name 55 "s00"
|
||||
MemberName 55(s00) 0 "s0_0"
|
||||
Name 57 "locals00"
|
||||
Name 62 "coord"
|
||||
Name 69 "foo0"
|
||||
Name 84 "foo00"
|
||||
Name 97 "gl_FragColor"
|
||||
Name 114 "sampler"
|
||||
Name 120 "foo2"
|
||||
Decorate 62(coord) Smooth
|
||||
Decorate 97(gl_FragColor) BuiltIn FragColor
|
||||
Decorate 120(foo2) NoStaticUse
|
||||
Name 8 "s0"
|
||||
MemberName 8(s0) 0 "i"
|
||||
Name 9 "s1"
|
||||
MemberName 9(s1) 0 "i"
|
||||
MemberName 9(s1) 1 "f"
|
||||
MemberName 9(s1) 2 "s0_1"
|
||||
Name 10 "s2"
|
||||
MemberName 10(s2) 0 "i"
|
||||
MemberName 10(s2) 1 "f"
|
||||
MemberName 10(s2) 2 "s1_1"
|
||||
Name 14 "s3"
|
||||
MemberName 14(s3) 0 "s2_1"
|
||||
MemberName 14(s3) 1 "i"
|
||||
MemberName 14(s3) 2 "f"
|
||||
MemberName 14(s3) 3 "s1_1"
|
||||
Name 16 "foo3"
|
||||
Name 27 "locals2"
|
||||
Name 40 "fArray"
|
||||
Name 46 "locals1Array"
|
||||
Name 49 "foo1"
|
||||
Name 53 "locals0"
|
||||
Name 54 "s00"
|
||||
MemberName 54(s00) 0 "s0_0"
|
||||
Name 56 "locals00"
|
||||
Name 61 "coord"
|
||||
Name 68 "foo0"
|
||||
Name 83 "foo00"
|
||||
Name 96 "gl_FragColor"
|
||||
Name 113 "sampler"
|
||||
Name 119 "foo2"
|
||||
Decorate 61(coord) Smooth
|
||||
Decorate 96(gl_FragColor) BuiltIn FragColor
|
||||
Decorate 119(foo2) NoStaticUse
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
7: TypeInt 32 1
|
||||
8: TypeFloat 32
|
||||
9(s0): TypeStruct 7(int)
|
||||
10(s1): TypeStruct 7(int) 8(float) 9(s0)
|
||||
11(s2): TypeStruct 7(int) 8(float) 10(s1)
|
||||
12: TypeInt 32 0
|
||||
13: 12(int) Constant 12
|
||||
14: TypeArray 11(s2) 13
|
||||
15(s3): TypeStruct 14 7(int) 8(float) 10(s1)
|
||||
16: TypePointer UniformConstant 15(s3)
|
||||
17(foo3): 16(ptr) Variable UniformConstant
|
||||
18: 7(int) Constant 0
|
||||
19: 7(int) Constant 9
|
||||
20: TypePointer UniformConstant 7(int)
|
||||
23: TypeBool
|
||||
27: TypePointer Function 11(s2)
|
||||
29: 7(int) Constant 1
|
||||
30: 8(float) Constant 1065353216
|
||||
31: TypePointer Function 8(float)
|
||||
33: 7(int) Constant 2
|
||||
34: 9(s0) ConstantComposite 18
|
||||
35: 10(s1) ConstantComposite 18 30 34
|
||||
36: TypePointer Function 10(s1)
|
||||
38: 12(int) Constant 6
|
||||
39: TypeArray 8(float) 38
|
||||
40: TypePointer Function 39
|
||||
42: 8(float) Constant 0
|
||||
43: 39 ConstantComposite 42 42 42 42 42 42
|
||||
44: 12(int) Constant 10
|
||||
45: TypeArray 10(s1) 44
|
||||
46: TypePointer Function 45
|
||||
48: 7(int) Constant 6
|
||||
49: TypePointer UniformConstant 10(s1)
|
||||
50(foo1): 49(ptr) Variable UniformConstant
|
||||
53: TypePointer Function 9(s0)
|
||||
55(s00): TypeStruct 9(s0)
|
||||
56: TypePointer Function 55(s00)
|
||||
58: 55(s00) ConstantComposite 34
|
||||
60: TypeVector 8(float) 2
|
||||
61: TypePointer Input 60(fvec2)
|
||||
62(coord): 61(ptr) Variable Input
|
||||
68: TypePointer UniformConstant 9(s0)
|
||||
69(foo0): 68(ptr) Variable UniformConstant
|
||||
73: 8(float) Constant 1073741824
|
||||
74: 8(float) Constant 1077936128
|
||||
75: 8(float) Constant 1082130432
|
||||
76: 8(float) Constant 1084227584
|
||||
77: 39 ConstantComposite 42 30 73 74 75 76
|
||||
83: TypePointer UniformConstant 55(s00)
|
||||
84(foo00): 83(ptr) Variable UniformConstant
|
||||
86: TypePointer Function 7(int)
|
||||
89: 7(int) Constant 5
|
||||
95: TypeVector 8(float) 4
|
||||
96: TypePointer Output 95(fvec4)
|
||||
97(gl_FragColor): 96(ptr) Variable Output
|
||||
104: 7(int) Constant 3
|
||||
111: TypeImage 8(float) 2D sampled format:Unknown
|
||||
112: TypeSampledImage 111
|
||||
113: TypePointer UniformConstant 112
|
||||
114(sampler): 113(ptr) Variable UniformConstant
|
||||
119: TypePointer UniformConstant 11(s2)
|
||||
120(foo2): 119(ptr) Variable UniformConstant
|
||||
6: TypeInt 32 1
|
||||
7: TypeFloat 32
|
||||
8(s0): TypeStruct 6(int)
|
||||
9(s1): TypeStruct 6(int) 7(float) 8(s0)
|
||||
10(s2): TypeStruct 6(int) 7(float) 9(s1)
|
||||
11: TypeInt 32 0
|
||||
12: 11(int) Constant 12
|
||||
13: TypeArray 10(s2) 12
|
||||
14(s3): TypeStruct 13 6(int) 7(float) 9(s1)
|
||||
15: TypePointer UniformConstant 14(s3)
|
||||
16(foo3): 15(ptr) Variable UniformConstant
|
||||
17: 6(int) Constant 0
|
||||
18: 6(int) Constant 9
|
||||
19: TypePointer UniformConstant 6(int)
|
||||
22: TypeBool
|
||||
26: TypePointer Function 10(s2)
|
||||
28: 6(int) Constant 1
|
||||
29: 7(float) Constant 1065353216
|
||||
30: TypePointer Function 7(float)
|
||||
32: 6(int) Constant 2
|
||||
33: 8(s0) ConstantComposite 17
|
||||
34: 9(s1) ConstantComposite 17 29 33
|
||||
35: TypePointer Function 9(s1)
|
||||
37: 11(int) Constant 6
|
||||
38: TypeArray 7(float) 37
|
||||
39: TypePointer Function 38
|
||||
41: 7(float) Constant 0
|
||||
42: 38 ConstantComposite 41 41 41 41 41 41
|
||||
43: 11(int) Constant 10
|
||||
44: TypeArray 9(s1) 43
|
||||
45: TypePointer Function 44
|
||||
47: 6(int) Constant 6
|
||||
48: TypePointer UniformConstant 9(s1)
|
||||
49(foo1): 48(ptr) Variable UniformConstant
|
||||
52: TypePointer Function 8(s0)
|
||||
54(s00): TypeStruct 8(s0)
|
||||
55: TypePointer Function 54(s00)
|
||||
57: 54(s00) ConstantComposite 33
|
||||
59: TypeVector 7(float) 2
|
||||
60: TypePointer Input 59(fvec2)
|
||||
61(coord): 60(ptr) Variable Input
|
||||
67: TypePointer UniformConstant 8(s0)
|
||||
68(foo0): 67(ptr) Variable UniformConstant
|
||||
72: 7(float) Constant 1073741824
|
||||
73: 7(float) Constant 1077936128
|
||||
74: 7(float) Constant 1082130432
|
||||
75: 7(float) Constant 1084227584
|
||||
76: 38 ConstantComposite 41 29 72 73 74 75
|
||||
82: TypePointer UniformConstant 54(s00)
|
||||
83(foo00): 82(ptr) Variable UniformConstant
|
||||
85: TypePointer Function 6(int)
|
||||
88: 6(int) Constant 5
|
||||
94: TypeVector 7(float) 4
|
||||
95: TypePointer Output 94(fvec4)
|
||||
96(gl_FragColor): 95(ptr) Variable Output
|
||||
103: 6(int) Constant 3
|
||||
110: TypeImage 7(float) 2D sampled format:Unknown
|
||||
111: TypeSampledImage 110
|
||||
112: TypePointer UniformConstant 111
|
||||
113(sampler): 112(ptr) Variable UniformConstant
|
||||
118: TypePointer UniformConstant 10(s2)
|
||||
119(foo2): 118(ptr) Variable UniformConstant
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
28(locals2): 27(ptr) Variable Function
|
||||
41(fArray): 40(ptr) Variable Function
|
||||
47(locals1Array): 46(ptr) Variable Function
|
||||
54(locals0): 53(ptr) Variable Function
|
||||
57(locals00): 56(ptr) Variable Function
|
||||
21: 20(ptr) AccessChain 17(foo3) 18 19 18
|
||||
22: 7(int) Load 21
|
||||
24: 23(bool) SGreaterThan 22 18
|
||||
SelectionMerge 26 None
|
||||
BranchConditional 24 25 59
|
||||
25: Label
|
||||
32: 31(ptr) AccessChain 28(locals2) 29
|
||||
Store 32 30
|
||||
37: 36(ptr) AccessChain 28(locals2) 33
|
||||
Store 37 35
|
||||
Store 41(fArray) 43
|
||||
51: 10(s1) Load 50(foo1)
|
||||
52: 36(ptr) AccessChain 47(locals1Array) 48
|
||||
Store 52 51
|
||||
Store 54(locals0) 34
|
||||
Store 57(locals00) 58
|
||||
Branch 26
|
||||
59: Label
|
||||
63: 60(fvec2) Load 62(coord)
|
||||
64: 8(float) CompositeExtract 63 0
|
||||
65: 31(ptr) AccessChain 28(locals2) 29
|
||||
Store 65 64
|
||||
66: 60(fvec2) Load 62(coord)
|
||||
67: 8(float) CompositeExtract 66 1
|
||||
70: 9(s0) Load 69(foo0)
|
||||
71: 10(s1) CompositeConstruct 29 67 70
|
||||
72: 36(ptr) AccessChain 28(locals2) 33
|
||||
Store 72 71
|
||||
Store 41(fArray) 77
|
||||
78: 36(ptr) AccessChain 28(locals2) 33
|
||||
79: 10(s1) Load 78
|
||||
80: 36(ptr) AccessChain 47(locals1Array) 48
|
||||
Store 80 79
|
||||
81: 68(ptr) AccessChain 50(foo1) 33
|
||||
82: 9(s0) Load 81
|
||||
Store 54(locals0) 82
|
||||
85: 55(s00) Load 84(foo00)
|
||||
Store 57(locals00) 85
|
||||
Branch 26
|
||||
26: Label
|
||||
87: 86(ptr) AccessChain 54(locals0) 18
|
||||
88: 7(int) Load 87
|
||||
90: 23(bool) SGreaterThan 88 89
|
||||
SelectionMerge 92 None
|
||||
BranchConditional 90 91 92
|
||||
91: Label
|
||||
93: 53(ptr) AccessChain 57(locals00) 18
|
||||
94: 9(s0) Load 93
|
||||
Store 54(locals0) 94
|
||||
Branch 92
|
||||
92: Label
|
||||
98: 86(ptr) AccessChain 54(locals0) 18
|
||||
99: 7(int) Load 98
|
||||
100: 8(float) ConvertSToF 99
|
||||
101: 31(ptr) AccessChain 47(locals1Array) 48 29
|
||||
102: 8(float) Load 101
|
||||
103: 8(float) FAdd 100 102
|
||||
105: 31(ptr) AccessChain 41(fArray) 104
|
||||
106: 8(float) Load 105
|
||||
107: 8(float) FAdd 103 106
|
||||
108: 31(ptr) AccessChain 28(locals2) 33 29
|
||||
109: 8(float) Load 108
|
||||
110: 8(float) FAdd 107 109
|
||||
115: 112 Load 114(sampler)
|
||||
116: 60(fvec2) Load 62(coord)
|
||||
117: 95(fvec4) ImageSampleImplicitLod 115 116
|
||||
118: 95(fvec4) VectorTimesScalar 117 110
|
||||
Store 97(gl_FragColor) 118
|
||||
Branch 6
|
||||
6: Label
|
||||
27(locals2): 26(ptr) Variable Function
|
||||
40(fArray): 39(ptr) Variable Function
|
||||
46(locals1Array): 45(ptr) Variable Function
|
||||
53(locals0): 52(ptr) Variable Function
|
||||
56(locals00): 55(ptr) Variable Function
|
||||
20: 19(ptr) AccessChain 16(foo3) 17 18 17
|
||||
21: 6(int) Load 20
|
||||
23: 22(bool) SGreaterThan 21 17
|
||||
SelectionMerge 25 None
|
||||
BranchConditional 23 24 58
|
||||
24: Label
|
||||
31: 30(ptr) AccessChain 27(locals2) 28
|
||||
Store 31 29
|
||||
36: 35(ptr) AccessChain 27(locals2) 32
|
||||
Store 36 34
|
||||
Store 40(fArray) 42
|
||||
50: 9(s1) Load 49(foo1)
|
||||
51: 35(ptr) AccessChain 46(locals1Array) 47
|
||||
Store 51 50
|
||||
Store 53(locals0) 33
|
||||
Store 56(locals00) 57
|
||||
Branch 25
|
||||
58: Label
|
||||
62: 59(fvec2) Load 61(coord)
|
||||
63: 7(float) CompositeExtract 62 0
|
||||
64: 30(ptr) AccessChain 27(locals2) 28
|
||||
Store 64 63
|
||||
65: 59(fvec2) Load 61(coord)
|
||||
66: 7(float) CompositeExtract 65 1
|
||||
69: 8(s0) Load 68(foo0)
|
||||
70: 9(s1) CompositeConstruct 28 66 69
|
||||
71: 35(ptr) AccessChain 27(locals2) 32
|
||||
Store 71 70
|
||||
Store 40(fArray) 76
|
||||
77: 35(ptr) AccessChain 27(locals2) 32
|
||||
78: 9(s1) Load 77
|
||||
79: 35(ptr) AccessChain 46(locals1Array) 47
|
||||
Store 79 78
|
||||
80: 67(ptr) AccessChain 49(foo1) 32
|
||||
81: 8(s0) Load 80
|
||||
Store 53(locals0) 81
|
||||
84: 54(s00) Load 83(foo00)
|
||||
Store 56(locals00) 84
|
||||
Branch 25
|
||||
25: Label
|
||||
86: 85(ptr) AccessChain 53(locals0) 17
|
||||
87: 6(int) Load 86
|
||||
89: 22(bool) SGreaterThan 87 88
|
||||
SelectionMerge 91 None
|
||||
BranchConditional 89 90 91
|
||||
90: Label
|
||||
92: 52(ptr) AccessChain 56(locals00) 17
|
||||
93: 8(s0) Load 92
|
||||
Store 53(locals0) 93
|
||||
Branch 91
|
||||
91: Label
|
||||
97: 85(ptr) AccessChain 53(locals0) 17
|
||||
98: 6(int) Load 97
|
||||
99: 7(float) ConvertSToF 98
|
||||
100: 30(ptr) AccessChain 46(locals1Array) 47 28
|
||||
101: 7(float) Load 100
|
||||
102: 7(float) FAdd 99 101
|
||||
104: 30(ptr) AccessChain 40(fArray) 103
|
||||
105: 7(float) Load 104
|
||||
106: 7(float) FAdd 102 105
|
||||
107: 30(ptr) AccessChain 27(locals2) 32 28
|
||||
108: 7(float) Load 107
|
||||
109: 7(float) FAdd 106 108
|
||||
114: 111 Load 113(sampler)
|
||||
115: 59(fvec2) Load 61(coord)
|
||||
116: 94(fvec4) ImageSampleImplicitLod 114 115
|
||||
117: 94(fvec4) VectorTimesScalar 116 109
|
||||
Store 96(gl_FragColor) 117
|
||||
Return
|
||||
FunctionEnd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue