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 53
// Id's are bound by 52
Source GLSL 150
Capability Shader
@ -13,97 +13,95 @@ Linked vertex stage:
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main"
Name 4 "main"
Name 14 "gl_PerVertex"
MemberName 14(gl_PerVertex) 0 "gl_Position"
MemberName 14(gl_PerVertex) 1 "gl_PointSize"
MemberName 14(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 14(gl_PerVertex) 3 "gl_ClipVertex"
MemberName 14(gl_PerVertex) 4 "gl_FrontColor"
MemberName 14(gl_PerVertex) 5 "gl_BackColor"
MemberName 14(gl_PerVertex) 6 "gl_FrontSecondaryColor"
MemberName 14(gl_PerVertex) 7 "gl_BackSecondaryColor"
MemberName 14(gl_PerVertex) 8 "gl_TexCoord"
MemberName 14(gl_PerVertex) 9 "gl_FogFragCoord"
Name 16 ""
Name 20 "iv4"
Name 26 "ps"
Name 36 "s1"
MemberName 36(s1) 0 "a"
MemberName 36(s1) 1 "a2"
MemberName 36(s1) 2 "b"
Name 38 "s2"
MemberName 38(s2) 0 "c"
MemberName 38(s2) 1 "d"
Name 40 "s2out"
Name 42 "i"
Name 49 "ui"
Name 51 "gl_VertexID"
Name 52 "gl_InstanceID"
MemberDecorate 14(gl_PerVertex) 0 Invariant
MemberDecorate 14(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 14(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 14(gl_PerVertex) 2 BuiltIn ClipDistance
Decorate 14(gl_PerVertex) Block
Decorate 49(ui) NoStaticUse
Decorate 51(gl_VertexID) BuiltIn VertexId
Decorate 51(gl_VertexID) NoStaticUse
Decorate 52(gl_InstanceID) BuiltIn InstanceId
Decorate 52(gl_InstanceID) NoStaticUse
Name 13 "gl_PerVertex"
MemberName 13(gl_PerVertex) 0 "gl_Position"
MemberName 13(gl_PerVertex) 1 "gl_PointSize"
MemberName 13(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 13(gl_PerVertex) 3 "gl_ClipVertex"
MemberName 13(gl_PerVertex) 4 "gl_FrontColor"
MemberName 13(gl_PerVertex) 5 "gl_BackColor"
MemberName 13(gl_PerVertex) 6 "gl_FrontSecondaryColor"
MemberName 13(gl_PerVertex) 7 "gl_BackSecondaryColor"
MemberName 13(gl_PerVertex) 8 "gl_TexCoord"
MemberName 13(gl_PerVertex) 9 "gl_FogFragCoord"
Name 15 ""
Name 19 "iv4"
Name 25 "ps"
Name 35 "s1"
MemberName 35(s1) 0 "a"
MemberName 35(s1) 1 "a2"
MemberName 35(s1) 2 "b"
Name 37 "s2"
MemberName 37(s2) 0 "c"
MemberName 37(s2) 1 "d"
Name 39 "s2out"
Name 41 "i"
Name 48 "ui"
Name 50 "gl_VertexID"
Name 51 "gl_InstanceID"
MemberDecorate 13(gl_PerVertex) 0 Invariant
MemberDecorate 13(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 13(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 13(gl_PerVertex) 2 BuiltIn ClipDistance
Decorate 13(gl_PerVertex) Block
Decorate 48(ui) NoStaticUse
Decorate 50(gl_VertexID) BuiltIn VertexId
Decorate 50(gl_VertexID) NoStaticUse
Decorate 51(gl_InstanceID) BuiltIn InstanceId
Decorate 51(gl_InstanceID) NoStaticUse
2: TypeVoid
3: TypeFunction 2
7: TypeFloat 32
8: TypeVector 7(float) 4
9: TypeInt 32 0
10: 9(int) Constant 4
11: TypeArray 7(float) 10
12: 9(int) Constant 1
13: TypeArray 8(fvec4) 12
14(gl_PerVertex): TypeStruct 8(fvec4) 7(float) 11 8(fvec4) 8(fvec4) 8(fvec4) 8(fvec4) 8(fvec4) 13 7(float)
15: TypePointer Output 14(gl_PerVertex)
16: 15(ptr) Variable Output
17: TypeInt 32 1
18: 17(int) Constant 0
19: TypePointer Input 8(fvec4)
20(iv4): 19(ptr) Variable Input
22: TypePointer Output 8(fvec4)
24: 17(int) Constant 1
25: TypePointer UniformConstant 7(float)
26(ps): 25(ptr) Variable UniformConstant
28: TypePointer Output 7(float)
30: 17(int) Constant 2
34: 9(int) Constant 3
35: TypeArray 8(fvec4) 34
36(s1): TypeStruct 17(int) 17(int) 35
37: TypeArray 36(s1) 10
38(s2): TypeStruct 17(int) 37
39: TypePointer Output 38(s2)
40(s2out): 39(ptr) Variable Output
41: TypePointer Function 17(int)
48: TypePointer UniformConstant 17(int)
49(ui): 48(ptr) Variable UniformConstant
50: TypePointer Input 17(int)
51(gl_VertexID): 50(ptr) Variable Input
52(gl_InstanceID): 50(ptr) Variable Input
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeInt 32 0
9: 8(int) Constant 4
10: TypeArray 6(float) 9
11: 8(int) Constant 1
12: TypeArray 7(fvec4) 11
13(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 10 7(fvec4) 7(fvec4) 7(fvec4) 7(fvec4) 7(fvec4) 12 6(float)
14: TypePointer Output 13(gl_PerVertex)
15: 14(ptr) Variable Output
16: TypeInt 32 1
17: 16(int) Constant 0
18: TypePointer Input 7(fvec4)
19(iv4): 18(ptr) Variable Input
21: TypePointer Output 7(fvec4)
23: 16(int) Constant 1
24: TypePointer UniformConstant 6(float)
25(ps): 24(ptr) Variable UniformConstant
27: TypePointer Output 6(float)
29: 16(int) Constant 2
33: 8(int) Constant 3
34: TypeArray 7(fvec4) 33
35(s1): TypeStruct 16(int) 16(int) 34
36: TypeArray 35(s1) 9
37(s2): TypeStruct 16(int) 36
38: TypePointer Output 37(s2)
39(s2out): 38(ptr) Variable Output
40: TypePointer Function 16(int)
47: TypePointer UniformConstant 16(int)
48(ui): 47(ptr) Variable UniformConstant
49: TypePointer Input 16(int)
50(gl_VertexID): 49(ptr) Variable Input
51(gl_InstanceID): 49(ptr) Variable Input
4(main): 2 Function None 3
5: Label
42(i): 41(ptr) Variable Function
21: 8(fvec4) Load 20(iv4)
23: 22(ptr) AccessChain 16 18
Store 23 21
27: 7(float) Load 26(ps)
29: 28(ptr) AccessChain 16 24
Store 29 27
31: 8(fvec4) Load 20(iv4)
32: 7(float) CompositeExtract 31 0
33: 28(ptr) AccessChain 16 30 30
Store 33 32
43: 17(int) Load 42(i)
44: 7(float) Load 26(ps)
45: 22(ptr) AccessChain 40(s2out) 24 43 30 30
46: 8(fvec4) Load 45
47: 8(fvec4) CompositeInsert 44 46 3
Store 45 47
Branch 6
6: Label
41(i): 40(ptr) Variable Function
20: 7(fvec4) Load 19(iv4)
22: 21(ptr) AccessChain 15 17
Store 22 20
26: 6(float) Load 25(ps)
28: 27(ptr) AccessChain 15 23
Store 28 26
30: 7(fvec4) Load 19(iv4)
31: 6(float) CompositeExtract 30 0
32: 27(ptr) AccessChain 15 29 29
Store 32 31
42: 16(int) Load 41(i)
43: 6(float) Load 25(ps)
44: 21(ptr) AccessChain 39(s2out) 23 42 29 29
45: 7(fvec4) Load 44
46: 7(fvec4) CompositeInsert 43 45 3
Store 44 46
Return
FunctionEnd