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 vertex stage:
// Module Version 99
// Generated by (magic number): 51a00bb
// Id's are bound by 44
// Id's are bound by 43
Source GLSL 330
Capability Shader
@ -13,64 +13,62 @@ Linked vertex stage:
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main"
Name 4 "main"
Name 10 "glPos"
Name 13 "mvp"
Name 16 "v"
Name 20 "f"
Name 24 "am3"
Name 35 "arraym"
Name 42 "gl_VertexID"
Name 43 "gl_InstanceID"
Decorate 10(glPos) Smooth
Decorate 20(f) Smooth
Decorate 42(gl_VertexID) BuiltIn VertexId
Decorate 42(gl_VertexID) NoStaticUse
Decorate 43(gl_InstanceID) BuiltIn InstanceId
Decorate 43(gl_InstanceID) NoStaticUse
Name 9 "glPos"
Name 12 "mvp"
Name 15 "v"
Name 19 "f"
Name 23 "am3"
Name 34 "arraym"
Name 41 "gl_VertexID"
Name 42 "gl_InstanceID"
Decorate 9(glPos) Smooth
Decorate 19(f) Smooth
Decorate 41(gl_VertexID) BuiltIn VertexId
Decorate 41(gl_VertexID) NoStaticUse
Decorate 42(gl_InstanceID) BuiltIn InstanceId
Decorate 42(gl_InstanceID) NoStaticUse
2: TypeVoid
3: TypeFunction 2
7: TypeFloat 32
8: TypeVector 7(float) 4
9: TypePointer Output 8(fvec4)
10(glPos): 9(ptr) Variable Output
11: TypeMatrix 8(fvec4) 4
12: TypePointer UniformConstant 11
13(mvp): 12(ptr) Variable UniformConstant
15: TypePointer Input 8(fvec4)
16(v): 15(ptr) Variable Input
19: TypePointer Output 7(float)
20(f): 19(ptr) Variable Output
21: TypeVector 7(float) 3
22: TypeMatrix 21(fvec3) 3
23: TypePointer Input 22
24(am3): 23(ptr) Variable Input
25: TypeInt 32 1
26: 25(int) Constant 2
27: TypePointer Input 21(fvec3)
31: TypeInt 32 0
32: 31(int) Constant 3
33: TypeArray 11 32
34: TypePointer Input 33
35(arraym): 34(ptr) Variable Input
36: 25(int) Constant 1
41: TypePointer Input 25(int)
42(gl_VertexID): 41(ptr) Variable Input
43(gl_InstanceID): 41(ptr) Variable Input
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Output 7(fvec4)
9(glPos): 8(ptr) Variable Output
10: TypeMatrix 7(fvec4) 4
11: TypePointer UniformConstant 10
12(mvp): 11(ptr) Variable UniformConstant
14: TypePointer Input 7(fvec4)
15(v): 14(ptr) Variable Input
18: TypePointer Output 6(float)
19(f): 18(ptr) Variable Output
20: TypeVector 6(float) 3
21: TypeMatrix 20(fvec3) 3
22: TypePointer Input 21
23(am3): 22(ptr) Variable Input
24: TypeInt 32 1
25: 24(int) Constant 2
26: TypePointer Input 20(fvec3)
30: TypeInt 32 0
31: 30(int) Constant 3
32: TypeArray 10 31
33: TypePointer Input 32
34(arraym): 33(ptr) Variable Input
35: 24(int) Constant 1
40: TypePointer Input 24(int)
41(gl_VertexID): 40(ptr) Variable Input
42(gl_InstanceID): 40(ptr) Variable Input
4(main): 2 Function None 3
5: Label
14: 11 Load 13(mvp)
17: 8(fvec4) Load 16(v)
18: 8(fvec4) MatrixTimesVector 14 17
Store 10(glPos) 18
28: 27(ptr) AccessChain 24(am3) 26
29: 21(fvec3) Load 28
30: 7(float) CompositeExtract 29 1
37: 15(ptr) AccessChain 35(arraym) 36 26
38: 8(fvec4) Load 37
39: 7(float) CompositeExtract 38 3
40: 7(float) FAdd 30 39
Store 20(f) 40
Branch 6
6: Label
13: 10 Load 12(mvp)
16: 7(fvec4) Load 15(v)
17: 7(fvec4) MatrixTimesVector 13 16
Store 9(glPos) 17
27: 26(ptr) AccessChain 23(am3) 25
28: 20(fvec3) Load 27
29: 6(float) CompositeExtract 28 1
36: 14(ptr) AccessChain 34(arraym) 35 25
37: 7(fvec4) Load 36
38: 6(float) CompositeExtract 37 3
39: 6(float) FAdd 29 38
Store 19(f) 39
Return
FunctionEnd