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:
John Kessenich 2015-09-14 20:58:02 -06:00
parent 5f5b205ce9
commit e770b3e6cf
74 changed files with 9648 additions and 9816 deletions

View file

@ -5,7 +5,7 @@ Linked fragment stage:
// Module Version 99
// Generated by (magic number): 51a00bb
// Id's are bound by 38
// Id's are bound by 37
Source ESSL 300
Capability Shader
@ -14,62 +14,60 @@ Linked fragment stage:
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginLowerLeft
Name 4 "main"
Name 10 "c"
Name 12 "color"
Name 14 "S"
MemberName 14(S) 0 "c"
MemberName 14(S) 1 "f"
Name 16 "s"
Name 27 "p"
Name 30 "pos"
Decorate 10(c) RelaxedPrecision
Decorate 10(c) Location 7
Decorate 12(color) RelaxedPrecision
Decorate 12(color) Smooth
MemberDecorate 14(S) 0 RelaxedPrecision
MemberDecorate 14(S) 1 RelaxedPrecision
Decorate 27(p) RelaxedPrecision
Decorate 27(p) Location 3
Decorate 30(pos) RelaxedPrecision
Decorate 30(pos) Smooth
Name 9 "c"
Name 11 "color"
Name 13 "S"
MemberName 13(S) 0 "c"
MemberName 13(S) 1 "f"
Name 15 "s"
Name 26 "p"
Name 29 "pos"
Decorate 9(c) RelaxedPrecision
Decorate 9(c) Location 7
Decorate 11(color) RelaxedPrecision
Decorate 11(color) Smooth
MemberDecorate 13(S) 0 RelaxedPrecision
MemberDecorate 13(S) 1 RelaxedPrecision
Decorate 26(p) RelaxedPrecision
Decorate 26(p) Location 3
Decorate 29(pos) RelaxedPrecision
Decorate 29(pos) Smooth
2: TypeVoid
3: TypeFunction 2
7: TypeFloat 32
8: TypeVector 7(float) 3
9: TypePointer Output 8(fvec3)
10(c): 9(ptr) Variable Output
11: TypePointer Input 8(fvec3)
12(color): 11(ptr) Variable Input
14(S): TypeStruct 8(fvec3) 7(float)
15: TypePointer Input 14(S)
16(s): 15(ptr) Variable Input
17: TypeInt 32 1
18: 17(int) Constant 0
22: TypeVector 7(float) 4
23: TypeInt 32 0
24: 23(int) Constant 2
25: TypeArray 22(fvec4) 24
26: TypePointer Output 25
27(p): 26(ptr) Variable Output
28: 17(int) Constant 1
29: TypePointer Input 22(fvec4)
30(pos): 29(ptr) Variable Input
32: TypePointer Input 7(float)
36: TypePointer Output 22(fvec4)
6: TypeFloat 32
7: TypeVector 6(float) 3
8: TypePointer Output 7(fvec3)
9(c): 8(ptr) Variable Output
10: TypePointer Input 7(fvec3)
11(color): 10(ptr) Variable Input
13(S): TypeStruct 7(fvec3) 6(float)
14: TypePointer Input 13(S)
15(s): 14(ptr) Variable Input
16: TypeInt 32 1
17: 16(int) Constant 0
21: TypeVector 6(float) 4
22: TypeInt 32 0
23: 22(int) Constant 2
24: TypeArray 21(fvec4) 23
25: TypePointer Output 24
26(p): 25(ptr) Variable Output
27: 16(int) Constant 1
28: TypePointer Input 21(fvec4)
29(pos): 28(ptr) Variable Input
31: TypePointer Input 6(float)
35: TypePointer Output 21(fvec4)
4(main): 2 Function None 3
5: Label
13: 8(fvec3) Load 12(color)
19: 11(ptr) AccessChain 16(s) 18
20: 8(fvec3) Load 19
21: 8(fvec3) FAdd 13 20
Store 10(c) 21
31: 22(fvec4) Load 30(pos)
33: 32(ptr) AccessChain 16(s) 28
34: 7(float) Load 33
35: 22(fvec4) VectorTimesScalar 31 34
37: 36(ptr) AccessChain 27(p) 28
Store 37 35
Branch 6
6: Label
12: 7(fvec3) Load 11(color)
18: 10(ptr) AccessChain 15(s) 17
19: 7(fvec3) Load 18
20: 7(fvec3) FAdd 12 19
Store 9(c) 20
30: 21(fvec4) Load 29(pos)
32: 31(ptr) AccessChain 15(s) 27
33: 6(float) Load 32
34: 21(fvec4) VectorTimesScalar 30 33
36: 35(ptr) AccessChain 26(p) 27
Store 36 34
Return
FunctionEnd