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:
@@ -7,7 +7,7 @@ Linked fragment stage:
|
||||
|
||||
// Module Version 99
|
||||
// Generated by (magic number): 51a00bb
|
||||
// Id's are bound by 94
|
||||
// Id's are bound by 93
|
||||
|
||||
Source GLSL 130
|
||||
Capability Shader
|
||||
@@ -16,133 +16,131 @@ Linked fragment stage:
|
||||
EntryPoint Fragment 4 "main"
|
||||
ExecutionMode 4 OriginLowerLeft
|
||||
Name 4 "main"
|
||||
Name 9 "iLocal"
|
||||
Name 11 "Count"
|
||||
Name 14 "lunarStruct1"
|
||||
MemberName 14(lunarStruct1) 0 "i"
|
||||
MemberName 14(lunarStruct1) 1 "f"
|
||||
Name 15 "lunarStruct2"
|
||||
MemberName 15(lunarStruct2) 0 "i"
|
||||
MemberName 15(lunarStruct2) 1 "f"
|
||||
MemberName 15(lunarStruct2) 2 "s1_1"
|
||||
Name 19 "lunarStruct3"
|
||||
MemberName 19(lunarStruct3) 0 "s2_1"
|
||||
MemberName 19(lunarStruct3) 1 "i"
|
||||
MemberName 19(lunarStruct3) 2 "f"
|
||||
MemberName 19(lunarStruct3) 3 "s1_1"
|
||||
Name 21 "foo3"
|
||||
Name 31 "scale"
|
||||
Name 35 "foo2"
|
||||
Name 37 "foo"
|
||||
Name 55 "gl_FragColor"
|
||||
Name 60 "sampler"
|
||||
Name 64 "coord"
|
||||
Name 70 "constructed"
|
||||
Decorate 55(gl_FragColor) BuiltIn FragColor
|
||||
Decorate 64(coord) Smooth
|
||||
Name 8 "iLocal"
|
||||
Name 10 "Count"
|
||||
Name 13 "lunarStruct1"
|
||||
MemberName 13(lunarStruct1) 0 "i"
|
||||
MemberName 13(lunarStruct1) 1 "f"
|
||||
Name 14 "lunarStruct2"
|
||||
MemberName 14(lunarStruct2) 0 "i"
|
||||
MemberName 14(lunarStruct2) 1 "f"
|
||||
MemberName 14(lunarStruct2) 2 "s1_1"
|
||||
Name 18 "lunarStruct3"
|
||||
MemberName 18(lunarStruct3) 0 "s2_1"
|
||||
MemberName 18(lunarStruct3) 1 "i"
|
||||
MemberName 18(lunarStruct3) 2 "f"
|
||||
MemberName 18(lunarStruct3) 3 "s1_1"
|
||||
Name 20 "foo3"
|
||||
Name 30 "scale"
|
||||
Name 34 "foo2"
|
||||
Name 36 "foo"
|
||||
Name 54 "gl_FragColor"
|
||||
Name 59 "sampler"
|
||||
Name 63 "coord"
|
||||
Name 69 "constructed"
|
||||
Decorate 54(gl_FragColor) BuiltIn FragColor
|
||||
Decorate 63(coord) Smooth
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
7: TypeInt 32 1
|
||||
8: TypePointer Function 7(int)
|
||||
10: TypePointer UniformConstant 7(int)
|
||||
11(Count): 10(ptr) Variable UniformConstant
|
||||
13: TypeFloat 32
|
||||
14(lunarStruct1): TypeStruct 7(int) 13(float)
|
||||
15(lunarStruct2): TypeStruct 7(int) 13(float) 14(lunarStruct1)
|
||||
16: TypeInt 32 0
|
||||
17: 16(int) Constant 3
|
||||
18: TypeArray 15(lunarStruct2) 17
|
||||
19(lunarStruct3): TypeStruct 18 7(int) 13(float) 14(lunarStruct1)
|
||||
20: TypePointer UniformConstant 19(lunarStruct3)
|
||||
21(foo3): 20(ptr) Variable UniformConstant
|
||||
22: 7(int) Constant 0
|
||||
23: 7(int) Constant 1
|
||||
26: TypeBool
|
||||
30: TypePointer Function 13(float)
|
||||
32: 16(int) Constant 5
|
||||
33: TypeArray 15(lunarStruct2) 32
|
||||
34: TypePointer UniformConstant 33
|
||||
35(foo2): 34(ptr) Variable UniformConstant
|
||||
36: TypePointer UniformConstant 14(lunarStruct1)
|
||||
37(foo): 36(ptr) Variable UniformConstant
|
||||
42: 7(int) Constant 2
|
||||
47: TypePointer UniformConstant 13(float)
|
||||
53: TypeVector 13(float) 4
|
||||
54: TypePointer Output 53(fvec4)
|
||||
55(gl_FragColor): 54(ptr) Variable Output
|
||||
57: TypeImage 13(float) 2D sampled format:Unknown
|
||||
58: TypeSampledImage 57
|
||||
59: TypePointer UniformConstant 58
|
||||
60(sampler): 59(ptr) Variable UniformConstant
|
||||
62: TypeVector 13(float) 2
|
||||
63: TypePointer Input 62(fvec2)
|
||||
64(coord): 63(ptr) Variable Input
|
||||
68: TypeArray 62(fvec2) 17
|
||||
69: TypePointer Function 68
|
||||
74: 13(float) Constant 1065353216
|
||||
75: 13(float) Constant 1073741824
|
||||
76: 62(fvec2) ConstantComposite 74 75
|
||||
80: TypePointer Function 62(fvec2)
|
||||
6: TypeInt 32 1
|
||||
7: TypePointer Function 6(int)
|
||||
9: TypePointer UniformConstant 6(int)
|
||||
10(Count): 9(ptr) Variable UniformConstant
|
||||
12: TypeFloat 32
|
||||
13(lunarStruct1): TypeStruct 6(int) 12(float)
|
||||
14(lunarStruct2): TypeStruct 6(int) 12(float) 13(lunarStruct1)
|
||||
15: TypeInt 32 0
|
||||
16: 15(int) Constant 3
|
||||
17: TypeArray 14(lunarStruct2) 16
|
||||
18(lunarStruct3): TypeStruct 17 6(int) 12(float) 13(lunarStruct1)
|
||||
19: TypePointer UniformConstant 18(lunarStruct3)
|
||||
20(foo3): 19(ptr) Variable UniformConstant
|
||||
21: 6(int) Constant 0
|
||||
22: 6(int) Constant 1
|
||||
25: TypeBool
|
||||
29: TypePointer Function 12(float)
|
||||
31: 15(int) Constant 5
|
||||
32: TypeArray 14(lunarStruct2) 31
|
||||
33: TypePointer UniformConstant 32
|
||||
34(foo2): 33(ptr) Variable UniformConstant
|
||||
35: TypePointer UniformConstant 13(lunarStruct1)
|
||||
36(foo): 35(ptr) Variable UniformConstant
|
||||
41: 6(int) Constant 2
|
||||
46: TypePointer UniformConstant 12(float)
|
||||
52: TypeVector 12(float) 4
|
||||
53: TypePointer Output 52(fvec4)
|
||||
54(gl_FragColor): 53(ptr) Variable Output
|
||||
56: TypeImage 12(float) 2D sampled format:Unknown
|
||||
57: TypeSampledImage 56
|
||||
58: TypePointer UniformConstant 57
|
||||
59(sampler): 58(ptr) Variable UniformConstant
|
||||
61: TypeVector 12(float) 2
|
||||
62: TypePointer Input 61(fvec2)
|
||||
63(coord): 62(ptr) Variable Input
|
||||
67: TypeArray 61(fvec2) 16
|
||||
68: TypePointer Function 67
|
||||
73: 12(float) Constant 1065353216
|
||||
74: 12(float) Constant 1073741824
|
||||
75: 61(fvec2) ConstantComposite 73 74
|
||||
79: TypePointer Function 61(fvec2)
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
9(iLocal): 8(ptr) Variable Function
|
||||
31(scale): 30(ptr) Variable Function
|
||||
70(constructed): 69(ptr) Variable Function
|
||||
12: 7(int) Load 11(Count)
|
||||
Store 9(iLocal) 12
|
||||
24: 10(ptr) AccessChain 21(foo3) 22 23 22
|
||||
25: 7(int) Load 24
|
||||
27: 26(bool) SGreaterThan 25 22
|
||||
SelectionMerge 29 None
|
||||
BranchConditional 27 28 50
|
||||
28: Label
|
||||
38: 10(ptr) AccessChain 37(foo) 22
|
||||
39: 7(int) Load 38
|
||||
40: 10(ptr) AccessChain 21(foo3) 22 39 22
|
||||
41: 7(int) Load 40
|
||||
43: 7(int) IAdd 41 42
|
||||
44: 7(int) Load 9(iLocal)
|
||||
45: 7(int) IAdd 44 23
|
||||
Store 9(iLocal) 45
|
||||
46: 7(int) IAdd 43 45
|
||||
48: 47(ptr) AccessChain 35(foo2) 46 42 23
|
||||
49: 13(float) Load 48
|
||||
Store 31(scale) 49
|
||||
Branch 29
|
||||
50: Label
|
||||
51: 47(ptr) AccessChain 21(foo3) 22 22 42 23
|
||||
52: 13(float) Load 51
|
||||
Store 31(scale) 52
|
||||
Branch 29
|
||||
29: Label
|
||||
56: 13(float) Load 31(scale)
|
||||
61: 58 Load 60(sampler)
|
||||
65: 62(fvec2) Load 64(coord)
|
||||
66: 53(fvec4) ImageSampleImplicitLod 61 65
|
||||
67: 53(fvec4) VectorTimesScalar 66 56
|
||||
Store 55(gl_FragColor) 67
|
||||
71: 62(fvec2) Load 64(coord)
|
||||
72: 13(float) Load 31(scale)
|
||||
73: 62(fvec2) CompositeConstruct 72 72
|
||||
77: 68 CompositeConstruct 71 73 76
|
||||
Store 70(constructed) 77
|
||||
78: 10(ptr) AccessChain 37(foo) 22
|
||||
79: 7(int) Load 78
|
||||
81: 80(ptr) AccessChain 70(constructed) 79
|
||||
82: 62(fvec2) Load 81
|
||||
83: 10(ptr) AccessChain 37(foo) 22
|
||||
84: 7(int) Load 83
|
||||
85: 80(ptr) AccessChain 70(constructed) 84
|
||||
86: 62(fvec2) Load 85
|
||||
87: 13(float) CompositeExtract 82 0
|
||||
88: 13(float) CompositeExtract 82 1
|
||||
89: 13(float) CompositeExtract 86 0
|
||||
90: 13(float) CompositeExtract 86 1
|
||||
91: 53(fvec4) CompositeConstruct 87 88 89 90
|
||||
92: 53(fvec4) Load 55(gl_FragColor)
|
||||
93: 53(fvec4) FAdd 92 91
|
||||
Store 55(gl_FragColor) 93
|
||||
Branch 6
|
||||
6: Label
|
||||
8(iLocal): 7(ptr) Variable Function
|
||||
30(scale): 29(ptr) Variable Function
|
||||
69(constructed): 68(ptr) Variable Function
|
||||
11: 6(int) Load 10(Count)
|
||||
Store 8(iLocal) 11
|
||||
23: 9(ptr) AccessChain 20(foo3) 21 22 21
|
||||
24: 6(int) Load 23
|
||||
26: 25(bool) SGreaterThan 24 21
|
||||
SelectionMerge 28 None
|
||||
BranchConditional 26 27 49
|
||||
27: Label
|
||||
37: 9(ptr) AccessChain 36(foo) 21
|
||||
38: 6(int) Load 37
|
||||
39: 9(ptr) AccessChain 20(foo3) 21 38 21
|
||||
40: 6(int) Load 39
|
||||
42: 6(int) IAdd 40 41
|
||||
43: 6(int) Load 8(iLocal)
|
||||
44: 6(int) IAdd 43 22
|
||||
Store 8(iLocal) 44
|
||||
45: 6(int) IAdd 42 44
|
||||
47: 46(ptr) AccessChain 34(foo2) 45 41 22
|
||||
48: 12(float) Load 47
|
||||
Store 30(scale) 48
|
||||
Branch 28
|
||||
49: Label
|
||||
50: 46(ptr) AccessChain 20(foo3) 21 21 41 22
|
||||
51: 12(float) Load 50
|
||||
Store 30(scale) 51
|
||||
Branch 28
|
||||
28: Label
|
||||
55: 12(float) Load 30(scale)
|
||||
60: 57 Load 59(sampler)
|
||||
64: 61(fvec2) Load 63(coord)
|
||||
65: 52(fvec4) ImageSampleImplicitLod 60 64
|
||||
66: 52(fvec4) VectorTimesScalar 65 55
|
||||
Store 54(gl_FragColor) 66
|
||||
70: 61(fvec2) Load 63(coord)
|
||||
71: 12(float) Load 30(scale)
|
||||
72: 61(fvec2) CompositeConstruct 71 71
|
||||
76: 67 CompositeConstruct 70 72 75
|
||||
Store 69(constructed) 76
|
||||
77: 9(ptr) AccessChain 36(foo) 21
|
||||
78: 6(int) Load 77
|
||||
80: 79(ptr) AccessChain 69(constructed) 78
|
||||
81: 61(fvec2) Load 80
|
||||
82: 9(ptr) AccessChain 36(foo) 21
|
||||
83: 6(int) Load 82
|
||||
84: 79(ptr) AccessChain 69(constructed) 83
|
||||
85: 61(fvec2) Load 84
|
||||
86: 12(float) CompositeExtract 81 0
|
||||
87: 12(float) CompositeExtract 81 1
|
||||
88: 12(float) CompositeExtract 85 0
|
||||
89: 12(float) CompositeExtract 85 1
|
||||
90: 52(fvec4) CompositeConstruct 86 87 88 89
|
||||
91: 52(fvec4) Load 54(gl_FragColor)
|
||||
92: 52(fvec4) FAdd 91 90
|
||||
Store 54(gl_FragColor) 92
|
||||
Return
|
||||
FunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user