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:
@@ -5,7 +5,7 @@ Linked vertex stage:
|
||||
|
||||
// Module Version 99
|
||||
// Generated by (magic number): 51a00bb
|
||||
// Id's are bound by 52
|
||||
// Id's are bound by 51
|
||||
|
||||
Source ESSL 300
|
||||
Capability Shader
|
||||
@@ -13,96 +13,94 @@ Linked vertex stage:
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Vertex 4 "main"
|
||||
Name 4 "main"
|
||||
Name 9 "i"
|
||||
Name 25 "A"
|
||||
Name 31 "B"
|
||||
Name 34 "C"
|
||||
Name 40 "D"
|
||||
Name 43 "E"
|
||||
Name 45 "F"
|
||||
Name 47 "G"
|
||||
Name 50 "gl_VertexID"
|
||||
Name 51 "gl_InstanceID"
|
||||
Decorate 50(gl_VertexID) BuiltIn VertexId
|
||||
Decorate 50(gl_VertexID) NoStaticUse
|
||||
Decorate 51(gl_InstanceID) BuiltIn InstanceId
|
||||
Decorate 51(gl_InstanceID) NoStaticUse
|
||||
Name 8 "i"
|
||||
Name 24 "A"
|
||||
Name 30 "B"
|
||||
Name 33 "C"
|
||||
Name 39 "D"
|
||||
Name 42 "E"
|
||||
Name 44 "F"
|
||||
Name 46 "G"
|
||||
Name 49 "gl_VertexID"
|
||||
Name 50 "gl_InstanceID"
|
||||
Decorate 49(gl_VertexID) BuiltIn VertexId
|
||||
Decorate 49(gl_VertexID) NoStaticUse
|
||||
Decorate 50(gl_InstanceID) BuiltIn InstanceId
|
||||
Decorate 50(gl_InstanceID) NoStaticUse
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
7: TypeInt 32 1
|
||||
8: TypePointer Function 7(int)
|
||||
10: 7(int) Constant 0
|
||||
15: TypeBool
|
||||
16: 15(bool) ConstantTrue
|
||||
20: 7(int) Constant 1
|
||||
22: 7(int) Constant 19
|
||||
27: 7(int) Constant 2
|
||||
32: 15(bool) ConstantFalse
|
||||
36: 7(int) Constant 5
|
||||
41: 7(int) Constant 3
|
||||
44: 7(int) Constant 42
|
||||
46: 7(int) Constant 99
|
||||
48: 7(int) Constant 12
|
||||
49: TypePointer Input 7(int)
|
||||
50(gl_VertexID): 49(ptr) Variable Input
|
||||
51(gl_InstanceID): 49(ptr) Variable Input
|
||||
6: TypeInt 32 1
|
||||
7: TypePointer Function 6(int)
|
||||
9: 6(int) Constant 0
|
||||
14: TypeBool
|
||||
15: 14(bool) ConstantTrue
|
||||
19: 6(int) Constant 1
|
||||
21: 6(int) Constant 19
|
||||
26: 6(int) Constant 2
|
||||
31: 14(bool) ConstantFalse
|
||||
35: 6(int) Constant 5
|
||||
40: 6(int) Constant 3
|
||||
43: 6(int) Constant 42
|
||||
45: 6(int) Constant 99
|
||||
47: 6(int) Constant 12
|
||||
48: TypePointer Input 6(int)
|
||||
49(gl_VertexID): 48(ptr) Variable Input
|
||||
50(gl_InstanceID): 48(ptr) Variable Input
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
9(i): 8(ptr) Variable Function
|
||||
25(A): 8(ptr) Variable Function
|
||||
31(B): 8(ptr) Variable Function
|
||||
34(C): 8(ptr) Variable Function
|
||||
40(D): 8(ptr) Variable Function
|
||||
43(E): 8(ptr) Variable Function
|
||||
45(F): 8(ptr) Variable Function
|
||||
47(G): 8(ptr) Variable Function
|
||||
Store 9(i) 10
|
||||
Branch 11
|
||||
11: Label
|
||||
14: 15(bool) Phi 16 5 32 29 32 39
|
||||
LoopMerge 12 None
|
||||
Branch 17
|
||||
17: Label
|
||||
SelectionMerge 13 None
|
||||
BranchConditional 14 13 18
|
||||
18: Label
|
||||
19: 7(int) Load 9(i)
|
||||
21: 7(int) IAdd 19 20
|
||||
Store 9(i) 21
|
||||
23: 15(bool) SLessThan 21 22
|
||||
SelectionMerge 24 None
|
||||
BranchConditional 23 24 12
|
||||
24: Label
|
||||
Branch 13
|
||||
13: Label
|
||||
Store 25(A) 10
|
||||
26: 7(int) Load 9(i)
|
||||
28: 15(bool) IEqual 26 27
|
||||
SelectionMerge 30 None
|
||||
BranchConditional 28 29 30
|
||||
29: Label
|
||||
Store 31(B) 20
|
||||
Branch 11
|
||||
33: Label
|
||||
Store 34(C) 27
|
||||
Branch 30
|
||||
30: Label
|
||||
35: 7(int) Load 9(i)
|
||||
37: 15(bool) IEqual 35 36
|
||||
SelectionMerge 39 None
|
||||
BranchConditional 37 38 39
|
||||
38: Label
|
||||
Store 40(D) 41
|
||||
8(i): 7(ptr) Variable Function
|
||||
24(A): 7(ptr) Variable Function
|
||||
30(B): 7(ptr) Variable Function
|
||||
33(C): 7(ptr) Variable Function
|
||||
39(D): 7(ptr) Variable Function
|
||||
42(E): 7(ptr) Variable Function
|
||||
44(F): 7(ptr) Variable Function
|
||||
46(G): 7(ptr) Variable Function
|
||||
Store 8(i) 9
|
||||
Branch 10
|
||||
10: Label
|
||||
13: 14(bool) Phi 15 5 31 28 31 38
|
||||
LoopMerge 11 None
|
||||
Branch 16
|
||||
16: Label
|
||||
SelectionMerge 12 None
|
||||
BranchConditional 13 12 17
|
||||
17: Label
|
||||
18: 6(int) Load 8(i)
|
||||
20: 6(int) IAdd 18 19
|
||||
Store 8(i) 20
|
||||
22: 14(bool) SLessThan 20 21
|
||||
SelectionMerge 23 None
|
||||
BranchConditional 22 23 11
|
||||
23: Label
|
||||
Branch 12
|
||||
42: Label
|
||||
Store 43(E) 44
|
||||
Branch 39
|
||||
39: Label
|
||||
Store 45(F) 46
|
||||
Branch 11
|
||||
12: Label
|
||||
Store 47(G) 48
|
||||
Branch 6
|
||||
6: Label
|
||||
Store 24(A) 9
|
||||
25: 6(int) Load 8(i)
|
||||
27: 14(bool) IEqual 25 26
|
||||
SelectionMerge 29 None
|
||||
BranchConditional 27 28 29
|
||||
28: Label
|
||||
Store 30(B) 19
|
||||
Branch 10
|
||||
32: Label
|
||||
Store 33(C) 26
|
||||
Branch 29
|
||||
29: Label
|
||||
34: 6(int) Load 8(i)
|
||||
36: 14(bool) IEqual 34 35
|
||||
SelectionMerge 38 None
|
||||
BranchConditional 36 37 38
|
||||
37: Label
|
||||
Store 39(D) 40
|
||||
Branch 11
|
||||
41: Label
|
||||
Store 42(E) 43
|
||||
Branch 38
|
||||
38: Label
|
||||
Store 44(F) 45
|
||||
Branch 10
|
||||
11: Label
|
||||
Store 46(G) 47
|
||||
Return
|
||||
FunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user