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 control stage:
// Module Version 99
// Generated by (magic number): 51a00bb
// Id's are bound by 91
// Id's are bound by 90
Source GLSL 400
SourceExtension "GL_ARB_separate_shader_objects"
@ -17,164 +17,162 @@ Linked tessellation control stage:
EntryPoint TessellationControl 4 "main"
ExecutionMode 4 OutputVertices 4
Name 4 "main"
Name 13 "a"
Name 18 "p"
Name 20 "gl_PerVertex"
MemberName 20(gl_PerVertex) 0 "gl_Position"
MemberName 20(gl_PerVertex) 1 "gl_PointSize"
MemberName 20(gl_PerVertex) 2 "gl_ClipDistance"
Name 24 "gl_in"
Name 31 "ps"
Name 35 "cd"
Name 39 "pvi"
Name 41 "gl_PatchVerticesIn"
Name 43 "pid"
Name 44 "gl_PrimitiveID"
Name 46 "iid"
Name 47 "gl_InvocationID"
Name 49 "gl_PerVertex"
MemberName 49(gl_PerVertex) 0 "gl_Position"
MemberName 49(gl_PerVertex) 1 "gl_PointSize"
MemberName 49(gl_PerVertex) 2 "gl_ClipDistance"
Name 53 "gl_out"
Name 64 "gl_TessLevelOuter"
Name 71 "gl_TessLevelInner"
Name 76 "outa"
Name 77 "patchOut"
Name 81 "inb"
Name 82 "ind"
Name 85 "ivla"
Name 86 "ivlb"
Name 89 "ovla"
Name 90 "ovlb"
Decorate 20(gl_PerVertex) Block
Decorate 41(gl_PatchVerticesIn) BuiltIn PatchVertices
Decorate 44(gl_PrimitiveID) BuiltIn PrimitiveId
Decorate 47(gl_InvocationID) BuiltIn InvocationId
MemberDecorate 49(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 49(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 49(gl_PerVertex) 2 BuiltIn ClipDistance
Decorate 49(gl_PerVertex) Block
Decorate 64(gl_TessLevelOuter) Patch
Decorate 64(gl_TessLevelOuter) BuiltIn TessLevelOuter
Decorate 71(gl_TessLevelInner) Patch
Decorate 71(gl_TessLevelInner) BuiltIn TessLevelInner
Decorate 76(outa) NoStaticUse
Decorate 77(patchOut) Patch
Decorate 77(patchOut) NoStaticUse
Decorate 81(inb) NoStaticUse
Decorate 82(ind) NoStaticUse
Decorate 85(ivla) Location 3
Decorate 85(ivla) NoStaticUse
Decorate 86(ivlb) Location 4
Decorate 86(ivlb) NoStaticUse
Decorate 89(ovla) Location 3
Decorate 89(ovla) NoStaticUse
Decorate 90(ovlb) Location 4
Decorate 90(ovlb) NoStaticUse
Name 12 "a"
Name 17 "p"
Name 19 "gl_PerVertex"
MemberName 19(gl_PerVertex) 0 "gl_Position"
MemberName 19(gl_PerVertex) 1 "gl_PointSize"
MemberName 19(gl_PerVertex) 2 "gl_ClipDistance"
Name 23 "gl_in"
Name 30 "ps"
Name 34 "cd"
Name 38 "pvi"
Name 40 "gl_PatchVerticesIn"
Name 42 "pid"
Name 43 "gl_PrimitiveID"
Name 45 "iid"
Name 46 "gl_InvocationID"
Name 48 "gl_PerVertex"
MemberName 48(gl_PerVertex) 0 "gl_Position"
MemberName 48(gl_PerVertex) 1 "gl_PointSize"
MemberName 48(gl_PerVertex) 2 "gl_ClipDistance"
Name 52 "gl_out"
Name 63 "gl_TessLevelOuter"
Name 70 "gl_TessLevelInner"
Name 75 "outa"
Name 76 "patchOut"
Name 80 "inb"
Name 81 "ind"
Name 84 "ivla"
Name 85 "ivlb"
Name 88 "ovla"
Name 89 "ovlb"
Decorate 19(gl_PerVertex) Block
Decorate 40(gl_PatchVerticesIn) BuiltIn PatchVertices
Decorate 43(gl_PrimitiveID) BuiltIn PrimitiveId
Decorate 46(gl_InvocationID) BuiltIn InvocationId
MemberDecorate 48(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 48(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 48(gl_PerVertex) 2 BuiltIn ClipDistance
Decorate 48(gl_PerVertex) Block
Decorate 63(gl_TessLevelOuter) Patch
Decorate 63(gl_TessLevelOuter) BuiltIn TessLevelOuter
Decorate 70(gl_TessLevelInner) Patch
Decorate 70(gl_TessLevelInner) BuiltIn TessLevelInner
Decorate 75(outa) NoStaticUse
Decorate 76(patchOut) Patch
Decorate 76(patchOut) NoStaticUse
Decorate 80(inb) NoStaticUse
Decorate 81(ind) NoStaticUse
Decorate 84(ivla) Location 3
Decorate 84(ivla) NoStaticUse
Decorate 85(ivlb) Location 4
Decorate 85(ivlb) NoStaticUse
Decorate 88(ovla) Location 3
Decorate 88(ovla) NoStaticUse
Decorate 89(ovlb) Location 4
Decorate 89(ovlb) NoStaticUse
2: TypeVoid
3: TypeFunction 2
7: TypeInt 32 0
8: 7(int) Constant 1
9: 7(int) Constant 1023
10: 7(int) Constant 0
11: TypeInt 32 1
12: TypePointer Function 11(int)
14: 11(int) Constant 5392
15: TypeFloat 32
16: TypeVector 15(float) 4
17: TypePointer Function 16(fvec4)
19: TypeArray 15(float) 8
20(gl_PerVertex): TypeStruct 16(fvec4) 15(float) 19
21: 7(int) Constant 32
22: TypeArray 20(gl_PerVertex) 21
23: TypePointer Input 22
24(gl_in): 23(ptr) Variable Input
25: 11(int) Constant 1
26: 11(int) Constant 0
27: TypePointer Input 16(fvec4)
30: TypePointer Function 15(float)
32: TypePointer Input 15(float)
36: 11(int) Constant 2
40: TypePointer Input 11(int)
41(gl_PatchVerticesIn): 40(ptr) Variable Input
44(gl_PrimitiveID): 40(ptr) Variable Input
47(gl_InvocationID): 40(ptr) Variable Input
49(gl_PerVertex): TypeStruct 16(fvec4) 15(float) 19
50: 7(int) Constant 4
51: TypeArray 49(gl_PerVertex) 50
52: TypePointer Output 51
53(gl_out): 52(ptr) Variable Output
55: TypePointer Output 16(fvec4)
58: TypePointer Output 15(float)
62: TypeArray 15(float) 50
63: TypePointer Output 62
64(gl_TessLevelOuter): 63(ptr) Variable Output
65: 11(int) Constant 3
66: 15(float) Constant 1078774989
68: 7(int) Constant 2
69: TypeArray 15(float) 68
70: TypePointer Output 69
71(gl_TessLevelInner): 70(ptr) Variable Output
72: 15(float) Constant 1067869798
74: TypeArray 11(int) 50
75: TypePointer PrivateGlobal 74
76(outa): 75(ptr) Variable PrivateGlobal
77(patchOut): 55(ptr) Variable Output
78: TypeVector 15(float) 2
79: TypeArray 78(fvec2) 21
80: TypePointer Input 79
81(inb): 80(ptr) Variable Input
82(ind): 80(ptr) Variable Input
83: TypeArray 16(fvec4) 21
84: TypePointer Input 83
85(ivla): 84(ptr) Variable Input
86(ivlb): 84(ptr) Variable Input
87: TypeArray 16(fvec4) 50
88: TypePointer Output 87
89(ovla): 88(ptr) Variable Output
90(ovlb): 88(ptr) Variable Output
6: TypeInt 32 0
7: 6(int) Constant 1
8: 6(int) Constant 1023
9: 6(int) Constant 0
10: TypeInt 32 1
11: TypePointer Function 10(int)
13: 10(int) Constant 5392
14: TypeFloat 32
15: TypeVector 14(float) 4
16: TypePointer Function 15(fvec4)
18: TypeArray 14(float) 7
19(gl_PerVertex): TypeStruct 15(fvec4) 14(float) 18
20: 6(int) Constant 32
21: TypeArray 19(gl_PerVertex) 20
22: TypePointer Input 21
23(gl_in): 22(ptr) Variable Input
24: 10(int) Constant 1
25: 10(int) Constant 0
26: TypePointer Input 15(fvec4)
29: TypePointer Function 14(float)
31: TypePointer Input 14(float)
35: 10(int) Constant 2
39: TypePointer Input 10(int)
40(gl_PatchVerticesIn): 39(ptr) Variable Input
43(gl_PrimitiveID): 39(ptr) Variable Input
46(gl_InvocationID): 39(ptr) Variable Input
48(gl_PerVertex): TypeStruct 15(fvec4) 14(float) 18
49: 6(int) Constant 4
50: TypeArray 48(gl_PerVertex) 49
51: TypePointer Output 50
52(gl_out): 51(ptr) Variable Output
54: TypePointer Output 15(fvec4)
57: TypePointer Output 14(float)
61: TypeArray 14(float) 49
62: TypePointer Output 61
63(gl_TessLevelOuter): 62(ptr) Variable Output
64: 10(int) Constant 3
65: 14(float) Constant 1078774989
67: 6(int) Constant 2
68: TypeArray 14(float) 67
69: TypePointer Output 68
70(gl_TessLevelInner): 69(ptr) Variable Output
71: 14(float) Constant 1067869798
73: TypeArray 10(int) 49
74: TypePointer PrivateGlobal 73
75(outa): 74(ptr) Variable PrivateGlobal
76(patchOut): 54(ptr) Variable Output
77: TypeVector 14(float) 2
78: TypeArray 77(fvec2) 20
79: TypePointer Input 78
80(inb): 79(ptr) Variable Input
81(ind): 79(ptr) Variable Input
82: TypeArray 15(fvec4) 20
83: TypePointer Input 82
84(ivla): 83(ptr) Variable Input
85(ivlb): 83(ptr) Variable Input
86: TypeArray 15(fvec4) 49
87: TypePointer Output 86
88(ovla): 87(ptr) Variable Output
89(ovlb): 87(ptr) Variable Output
4(main): 2 Function None 3
5: Label
13(a): 12(ptr) Variable Function
18(p): 17(ptr) Variable Function
31(ps): 30(ptr) Variable Function
35(cd): 30(ptr) Variable Function
39(pvi): 12(ptr) Variable Function
43(pid): 12(ptr) Variable Function
46(iid): 12(ptr) Variable Function
MemoryBarrier 8 9
ControlBarrier 8 8 10
Store 13(a) 14
28: 27(ptr) AccessChain 24(gl_in) 25 26
29: 16(fvec4) Load 28
Store 18(p) 29
33: 32(ptr) AccessChain 24(gl_in) 25 25
34: 15(float) Load 33
Store 31(ps) 34
37: 32(ptr) AccessChain 24(gl_in) 25 36 36
38: 15(float) Load 37
Store 35(cd) 38
42: 11(int) Load 41(gl_PatchVerticesIn)
Store 39(pvi) 42
45: 11(int) Load 44(gl_PrimitiveID)
Store 43(pid) 45
48: 11(int) Load 47(gl_InvocationID)
Store 46(iid) 48
54: 16(fvec4) Load 18(p)
56: 55(ptr) AccessChain 53(gl_out) 25 26
Store 56 54
57: 15(float) Load 31(ps)
59: 58(ptr) AccessChain 53(gl_out) 25 25
Store 59 57
60: 15(float) Load 35(cd)
61: 58(ptr) AccessChain 53(gl_out) 25 36 25
Store 61 60
67: 58(ptr) AccessChain 64(gl_TessLevelOuter) 65
Store 67 66
73: 58(ptr) AccessChain 71(gl_TessLevelInner) 25
Store 73 72
Branch 6
6: Label
12(a): 11(ptr) Variable Function
17(p): 16(ptr) Variable Function
30(ps): 29(ptr) Variable Function
34(cd): 29(ptr) Variable Function
38(pvi): 11(ptr) Variable Function
42(pid): 11(ptr) Variable Function
45(iid): 11(ptr) Variable Function
MemoryBarrier 7 8
ControlBarrier 7 7 9
Store 12(a) 13
27: 26(ptr) AccessChain 23(gl_in) 24 25
28: 15(fvec4) Load 27
Store 17(p) 28
32: 31(ptr) AccessChain 23(gl_in) 24 24
33: 14(float) Load 32
Store 30(ps) 33
36: 31(ptr) AccessChain 23(gl_in) 24 35 35
37: 14(float) Load 36
Store 34(cd) 37
41: 10(int) Load 40(gl_PatchVerticesIn)
Store 38(pvi) 41
44: 10(int) Load 43(gl_PrimitiveID)
Store 42(pid) 44
47: 10(int) Load 46(gl_InvocationID)
Store 45(iid) 47
53: 15(fvec4) Load 17(p)
55: 54(ptr) AccessChain 52(gl_out) 24 25
Store 55 53
56: 14(float) Load 30(ps)
58: 57(ptr) AccessChain 52(gl_out) 24 24
Store 58 56
59: 14(float) Load 34(cd)
60: 57(ptr) AccessChain 52(gl_out) 24 35 24
Store 60 59
66: 57(ptr) AccessChain 63(gl_TessLevelOuter) 64
Store 66 65
72: 57(ptr) AccessChain 70(gl_TessLevelInner) 24
Store 72 71
Return
FunctionEnd