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

@ -7,7 +7,7 @@ Linked tessellation evaluation stage:
// Module Version 99
// Generated by (magic number): 51a00bb
// Id's are bound by 99
// Id's are bound by 98
Source GLSL 400
SourceExtension "GL_ARB_separate_shader_objects"
@ -17,177 +17,175 @@ Linked tessellation evaluation stage:
EntryPoint TessellationEvaluation 4 "main"
ExecutionMode 4 InputTriangles
Name 4 "main"
Name 9 "a"
Name 14 "p"
Name 18 "gl_PerVertex"
MemberName 18(gl_PerVertex) 0 "gl_Position"
MemberName 18(gl_PerVertex) 1 "gl_PointSize"
MemberName 18(gl_PerVertex) 2 "gl_ClipDistance"
Name 22 "gl_in"
Name 29 "ps"
Name 33 "cd"
Name 37 "pvi"
Name 39 "gl_PatchVerticesIn"
Name 41 "pid"
Name 42 "gl_PrimitiveID"
Name 46 "tc"
Name 48 "gl_TessCoord"
Name 50 "tlo"
Name 54 "gl_TessLevelOuter"
Name 58 "tli"
Name 62 "gl_TessLevelInner"
Name 67 "gl_PerVertex"
MemberName 67(gl_PerVertex) 0 "gl_Position"
MemberName 67(gl_PerVertex) 1 "gl_PointSize"
MemberName 67(gl_PerVertex) 2 "gl_ClipDistance"
Name 69 ""
Name 78 "patchIn"
Name 82 "inb"
Name 83 "ind"
Name 84 "testblb"
MemberName 84(testblb) 0 "f"
Name 87 "blb"
Name 88 "testbld"
MemberName 88(testbld) 0 "f"
Name 91 "bld"
Name 94 "ivla"
Name 95 "ivlb"
Name 98 "ovla"
Decorate 18(gl_PerVertex) Block
Decorate 39(gl_PatchVerticesIn) BuiltIn PatchVertices
Decorate 42(gl_PrimitiveID) BuiltIn PrimitiveId
Decorate 48(gl_TessCoord) BuiltIn TessCoord
Decorate 54(gl_TessLevelOuter) Patch
Decorate 54(gl_TessLevelOuter) BuiltIn TessLevelOuter
Decorate 62(gl_TessLevelInner) Patch
Decorate 62(gl_TessLevelInner) BuiltIn TessLevelInner
MemberDecorate 67(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 67(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 67(gl_PerVertex) 2 BuiltIn ClipDistance
Decorate 67(gl_PerVertex) Block
Decorate 78(patchIn) Patch
Decorate 78(patchIn) NoStaticUse
Decorate 82(inb) NoStaticUse
Decorate 83(ind) NoStaticUse
Decorate 84(testblb) Block
Decorate 87(blb) NoStaticUse
Decorate 88(testbld) Block
Decorate 91(bld) NoStaticUse
Decorate 94(ivla) Location 23
Decorate 94(ivla) NoStaticUse
Decorate 95(ivlb) Location 24
Decorate 95(ivlb) NoStaticUse
Decorate 98(ovla) Location 23
Decorate 98(ovla) NoStaticUse
Name 8 "a"
Name 13 "p"
Name 17 "gl_PerVertex"
MemberName 17(gl_PerVertex) 0 "gl_Position"
MemberName 17(gl_PerVertex) 1 "gl_PointSize"
MemberName 17(gl_PerVertex) 2 "gl_ClipDistance"
Name 21 "gl_in"
Name 28 "ps"
Name 32 "cd"
Name 36 "pvi"
Name 38 "gl_PatchVerticesIn"
Name 40 "pid"
Name 41 "gl_PrimitiveID"
Name 45 "tc"
Name 47 "gl_TessCoord"
Name 49 "tlo"
Name 53 "gl_TessLevelOuter"
Name 57 "tli"
Name 61 "gl_TessLevelInner"
Name 66 "gl_PerVertex"
MemberName 66(gl_PerVertex) 0 "gl_Position"
MemberName 66(gl_PerVertex) 1 "gl_PointSize"
MemberName 66(gl_PerVertex) 2 "gl_ClipDistance"
Name 68 ""
Name 77 "patchIn"
Name 81 "inb"
Name 82 "ind"
Name 83 "testblb"
MemberName 83(testblb) 0 "f"
Name 86 "blb"
Name 87 "testbld"
MemberName 87(testbld) 0 "f"
Name 90 "bld"
Name 93 "ivla"
Name 94 "ivlb"
Name 97 "ovla"
Decorate 17(gl_PerVertex) Block
Decorate 38(gl_PatchVerticesIn) BuiltIn PatchVertices
Decorate 41(gl_PrimitiveID) BuiltIn PrimitiveId
Decorate 47(gl_TessCoord) BuiltIn TessCoord
Decorate 53(gl_TessLevelOuter) Patch
Decorate 53(gl_TessLevelOuter) BuiltIn TessLevelOuter
Decorate 61(gl_TessLevelInner) Patch
Decorate 61(gl_TessLevelInner) BuiltIn TessLevelInner
MemberDecorate 66(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 66(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 66(gl_PerVertex) 2 BuiltIn ClipDistance
Decorate 66(gl_PerVertex) Block
Decorate 77(patchIn) Patch
Decorate 77(patchIn) NoStaticUse
Decorate 81(inb) NoStaticUse
Decorate 82(ind) NoStaticUse
Decorate 83(testblb) Block
Decorate 86(blb) NoStaticUse
Decorate 87(testbld) Block
Decorate 90(bld) NoStaticUse
Decorate 93(ivla) Location 23
Decorate 93(ivla) NoStaticUse
Decorate 94(ivlb) Location 24
Decorate 94(ivlb) NoStaticUse
Decorate 97(ovla) Location 23
Decorate 97(ovla) NoStaticUse
2: TypeVoid
3: TypeFunction 2
7: TypeInt 32 1
8: TypePointer Function 7(int)
10: 7(int) Constant 1512
11: TypeFloat 32
12: TypeVector 11(float) 4
13: TypePointer Function 12(fvec4)
15: TypeInt 32 0
16: 15(int) Constant 1
17: TypeArray 11(float) 16
18(gl_PerVertex): TypeStruct 12(fvec4) 11(float) 17
19: 15(int) Constant 32
20: TypeArray 18(gl_PerVertex) 19
21: TypePointer Input 20
22(gl_in): 21(ptr) Variable Input
23: 7(int) Constant 1
24: 7(int) Constant 0
25: TypePointer Input 12(fvec4)
28: TypePointer Function 11(float)
30: TypePointer Input 11(float)
34: 7(int) Constant 2
38: TypePointer Input 7(int)
39(gl_PatchVerticesIn): 38(ptr) Variable Input
42(gl_PrimitiveID): 38(ptr) Variable Input
44: TypeVector 11(float) 3
45: TypePointer Function 44(fvec3)
47: TypePointer Input 44(fvec3)
48(gl_TessCoord): 47(ptr) Variable Input
51: 15(int) Constant 4
52: TypeArray 11(float) 51
53: TypePointer Input 52
54(gl_TessLevelOuter): 53(ptr) Variable Input
55: 7(int) Constant 3
59: 15(int) Constant 2
60: TypeArray 11(float) 59
61: TypePointer Input 60
62(gl_TessLevelInner): 61(ptr) Variable Input
65: 15(int) Constant 3
66: TypeArray 11(float) 65
67(gl_PerVertex): TypeStruct 12(fvec4) 11(float) 66
68: TypePointer Output 67(gl_PerVertex)
69: 68(ptr) Variable Output
71: TypePointer Output 12(fvec4)
74: TypePointer Output 11(float)
78(patchIn): 25(ptr) Variable Input
79: TypeVector 11(float) 2
80: TypeArray 79(fvec2) 19
81: TypePointer Input 80
82(inb): 81(ptr) Variable Input
83(ind): 81(ptr) Variable Input
84(testblb): TypeStruct 7(int)
85: TypeArray 84(testblb) 19
86: TypePointer Input 85
87(blb): 86(ptr) Variable Input
88(testbld): TypeStruct 7(int)
89: TypeArray 88(testbld) 19
90: TypePointer Input 89
91(bld): 90(ptr) Variable Input
92: TypeArray 12(fvec4) 19
93: TypePointer Input 92
94(ivla): 93(ptr) Variable Input
95(ivlb): 93(ptr) Variable Input
96: TypeArray 12(fvec4) 59
97: TypePointer Output 96
98(ovla): 97(ptr) Variable Output
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 1512
10: TypeFloat 32
11: TypeVector 10(float) 4
12: TypePointer Function 11(fvec4)
14: TypeInt 32 0
15: 14(int) Constant 1
16: TypeArray 10(float) 15
17(gl_PerVertex): TypeStruct 11(fvec4) 10(float) 16
18: 14(int) Constant 32
19: TypeArray 17(gl_PerVertex) 18
20: TypePointer Input 19
21(gl_in): 20(ptr) Variable Input
22: 6(int) Constant 1
23: 6(int) Constant 0
24: TypePointer Input 11(fvec4)
27: TypePointer Function 10(float)
29: TypePointer Input 10(float)
33: 6(int) Constant 2
37: TypePointer Input 6(int)
38(gl_PatchVerticesIn): 37(ptr) Variable Input
41(gl_PrimitiveID): 37(ptr) Variable Input
43: TypeVector 10(float) 3
44: TypePointer Function 43(fvec3)
46: TypePointer Input 43(fvec3)
47(gl_TessCoord): 46(ptr) Variable Input
50: 14(int) Constant 4
51: TypeArray 10(float) 50
52: TypePointer Input 51
53(gl_TessLevelOuter): 52(ptr) Variable Input
54: 6(int) Constant 3
58: 14(int) Constant 2
59: TypeArray 10(float) 58
60: TypePointer Input 59
61(gl_TessLevelInner): 60(ptr) Variable Input
64: 14(int) Constant 3
65: TypeArray 10(float) 64
66(gl_PerVertex): TypeStruct 11(fvec4) 10(float) 65
67: TypePointer Output 66(gl_PerVertex)
68: 67(ptr) Variable Output
70: TypePointer Output 11(fvec4)
73: TypePointer Output 10(float)
77(patchIn): 24(ptr) Variable Input
78: TypeVector 10(float) 2
79: TypeArray 78(fvec2) 18
80: TypePointer Input 79
81(inb): 80(ptr) Variable Input
82(ind): 80(ptr) Variable Input
83(testblb): TypeStruct 6(int)
84: TypeArray 83(testblb) 18
85: TypePointer Input 84
86(blb): 85(ptr) Variable Input
87(testbld): TypeStruct 6(int)
88: TypeArray 87(testbld) 18
89: TypePointer Input 88
90(bld): 89(ptr) Variable Input
91: TypeArray 11(fvec4) 18
92: TypePointer Input 91
93(ivla): 92(ptr) Variable Input
94(ivlb): 92(ptr) Variable Input
95: TypeArray 11(fvec4) 58
96: TypePointer Output 95
97(ovla): 96(ptr) Variable Output
4(main): 2 Function None 3
5: Label
9(a): 8(ptr) Variable Function
14(p): 13(ptr) Variable Function
29(ps): 28(ptr) Variable Function
33(cd): 28(ptr) Variable Function
37(pvi): 8(ptr) Variable Function
41(pid): 8(ptr) Variable Function
46(tc): 45(ptr) Variable Function
50(tlo): 28(ptr) Variable Function
58(tli): 28(ptr) Variable Function
Store 9(a) 10
26: 25(ptr) AccessChain 22(gl_in) 23 24
27: 12(fvec4) Load 26
Store 14(p) 27
31: 30(ptr) AccessChain 22(gl_in) 23 23
32: 11(float) Load 31
Store 29(ps) 32
35: 30(ptr) AccessChain 22(gl_in) 23 34 34
36: 11(float) Load 35
Store 33(cd) 36
40: 7(int) Load 39(gl_PatchVerticesIn)
Store 37(pvi) 40
43: 7(int) Load 42(gl_PrimitiveID)
Store 41(pid) 43
49: 44(fvec3) Load 48(gl_TessCoord)
Store 46(tc) 49
56: 30(ptr) AccessChain 54(gl_TessLevelOuter) 55
57: 11(float) Load 56
Store 50(tlo) 57
63: 30(ptr) AccessChain 62(gl_TessLevelInner) 23
64: 11(float) Load 63
Store 58(tli) 64
70: 12(fvec4) Load 14(p)
72: 71(ptr) AccessChain 69 24
Store 72 70
73: 11(float) Load 29(ps)
75: 74(ptr) AccessChain 69 23
Store 75 73
76: 11(float) Load 33(cd)
77: 74(ptr) AccessChain 69 34 34
Store 77 76
Branch 6
6: Label
8(a): 7(ptr) Variable Function
13(p): 12(ptr) Variable Function
28(ps): 27(ptr) Variable Function
32(cd): 27(ptr) Variable Function
36(pvi): 7(ptr) Variable Function
40(pid): 7(ptr) Variable Function
45(tc): 44(ptr) Variable Function
49(tlo): 27(ptr) Variable Function
57(tli): 27(ptr) Variable Function
Store 8(a) 9
25: 24(ptr) AccessChain 21(gl_in) 22 23
26: 11(fvec4) Load 25
Store 13(p) 26
30: 29(ptr) AccessChain 21(gl_in) 22 22
31: 10(float) Load 30
Store 28(ps) 31
34: 29(ptr) AccessChain 21(gl_in) 22 33 33
35: 10(float) Load 34
Store 32(cd) 35
39: 6(int) Load 38(gl_PatchVerticesIn)
Store 36(pvi) 39
42: 6(int) Load 41(gl_PrimitiveID)
Store 40(pid) 42
48: 43(fvec3) Load 47(gl_TessCoord)
Store 45(tc) 48
55: 29(ptr) AccessChain 53(gl_TessLevelOuter) 54
56: 10(float) Load 55
Store 49(tlo) 56
62: 29(ptr) AccessChain 61(gl_TessLevelInner) 22
63: 10(float) Load 62
Store 57(tli) 63
69: 11(fvec4) Load 13(p)
71: 70(ptr) AccessChain 68 23
Store 71 69
72: 10(float) Load 28(ps)
74: 73(ptr) AccessChain 68 22
Store 74 72
75: 10(float) Load 32(cd)
76: 73(ptr) AccessChain 68 33 33
Store 76 75
Return
FunctionEnd