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 142
// Id's are bound by 141
Source GLSL 130
Capability Shader
@ -13,182 +13,180 @@ Linked vertex stage:
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main"
Name 4 "main"
Name 9 "lod"
Name 11 "coords1D"
Name 15 "coords3D"
Name 21 "coords4D"
Name 24 "color"
Name 30 "texSampler1D"
Name 40 "coords2D"
Name 55 "texSampler2D"
Name 77 "texSampler3D"
Name 93 "texSamplerCube"
Name 103 "shadowSampler1D"
Name 114 "shadowSampler2D"
Name 137 "gl_Position"
Name 141 "gl_VertexID"
Decorate 137(gl_Position) BuiltIn Position
Decorate 141(gl_VertexID) BuiltIn VertexId
Decorate 141(gl_VertexID) NoStaticUse
Name 8 "lod"
Name 10 "coords1D"
Name 14 "coords3D"
Name 20 "coords4D"
Name 23 "color"
Name 29 "texSampler1D"
Name 39 "coords2D"
Name 54 "texSampler2D"
Name 76 "texSampler3D"
Name 92 "texSamplerCube"
Name 102 "shadowSampler1D"
Name 113 "shadowSampler2D"
Name 136 "gl_Position"
Name 140 "gl_VertexID"
Decorate 136(gl_Position) BuiltIn Position
Decorate 140(gl_VertexID) BuiltIn VertexId
Decorate 140(gl_VertexID) NoStaticUse
2: TypeVoid
3: TypeFunction 2
7: TypeFloat 32
8: TypePointer Function 7(float)
10: 7(float) Constant 1077936128
12: 7(float) Constant 1071971828
13: TypeVector 7(float) 3
14: TypePointer Function 13(fvec3)
16: 7(float) Constant 1076753334
17: 7(float) Constant 1079836148
18: 13(fvec3) ConstantComposite 12 16 17
19: TypeVector 7(float) 4
20: TypePointer Function 19(fvec4)
22: 7(float) Constant 1073741824
23: 19(fvec4) ConstantComposite 12 16 17 22
25: 7(float) Constant 0
26: 19(fvec4) ConstantComposite 25 25 25 25
27: TypeImage 7(float) 1D sampled format:Unknown
28: TypeSampledImage 27
29: TypePointer UniformConstant 28
30(texSampler1D): 29(ptr) Variable UniformConstant
38: TypeVector 7(float) 2
39: TypePointer Input 38(fvec2)
40(coords2D): 39(ptr) Variable Input
52: TypeImage 7(float) 2D sampled format:Unknown
53: TypeSampledImage 52
54: TypePointer UniformConstant 53
55(texSampler2D): 54(ptr) Variable UniformConstant
74: TypeImage 7(float) 3D sampled format:Unknown
75: TypeSampledImage 74
76: TypePointer UniformConstant 75
77(texSampler3D): 76(ptr) Variable UniformConstant
90: TypeImage 7(float) Cube sampled format:Unknown
91: TypeSampledImage 90
92: TypePointer UniformConstant 91
93(texSamplerCube): 92(ptr) Variable UniformConstant
100: TypeImage 7(float) 1D depth sampled format:Unknown
101: TypeSampledImage 100
102: TypePointer UniformConstant 101
103(shadowSampler1D): 102(ptr) Variable UniformConstant
111: TypeImage 7(float) 2D depth sampled format:Unknown
112: TypeSampledImage 111
113: TypePointer UniformConstant 112
114(shadowSampler2D): 113(ptr) Variable UniformConstant
136: TypePointer Output 19(fvec4)
137(gl_Position): 136(ptr) Variable Output
139: TypeInt 32 1
140: TypePointer Input 139(int)
141(gl_VertexID): 140(ptr) Variable Input
6: TypeFloat 32
7: TypePointer Function 6(float)
9: 6(float) Constant 1077936128
11: 6(float) Constant 1071971828
12: TypeVector 6(float) 3
13: TypePointer Function 12(fvec3)
15: 6(float) Constant 1076753334
16: 6(float) Constant 1079836148
17: 12(fvec3) ConstantComposite 11 15 16
18: TypeVector 6(float) 4
19: TypePointer Function 18(fvec4)
21: 6(float) Constant 1073741824
22: 18(fvec4) ConstantComposite 11 15 16 21
24: 6(float) Constant 0
25: 18(fvec4) ConstantComposite 24 24 24 24
26: TypeImage 6(float) 1D sampled format:Unknown
27: TypeSampledImage 26
28: TypePointer UniformConstant 27
29(texSampler1D): 28(ptr) Variable UniformConstant
37: TypeVector 6(float) 2
38: TypePointer Input 37(fvec2)
39(coords2D): 38(ptr) Variable Input
51: TypeImage 6(float) 2D sampled format:Unknown
52: TypeSampledImage 51
53: TypePointer UniformConstant 52
54(texSampler2D): 53(ptr) Variable UniformConstant
73: TypeImage 6(float) 3D sampled format:Unknown
74: TypeSampledImage 73
75: TypePointer UniformConstant 74
76(texSampler3D): 75(ptr) Variable UniformConstant
89: TypeImage 6(float) Cube sampled format:Unknown
90: TypeSampledImage 89
91: TypePointer UniformConstant 90
92(texSamplerCube): 91(ptr) Variable UniformConstant
99: TypeImage 6(float) 1D depth sampled format:Unknown
100: TypeSampledImage 99
101: TypePointer UniformConstant 100
102(shadowSampler1D): 101(ptr) Variable UniformConstant
110: TypeImage 6(float) 2D depth sampled format:Unknown
111: TypeSampledImage 110
112: TypePointer UniformConstant 111
113(shadowSampler2D): 112(ptr) Variable UniformConstant
135: TypePointer Output 18(fvec4)
136(gl_Position): 135(ptr) Variable Output
138: TypeInt 32 1
139: TypePointer Input 138(int)
140(gl_VertexID): 139(ptr) Variable Input
4(main): 2 Function None 3
5: Label
9(lod): 8(ptr) Variable Function
11(coords1D): 8(ptr) Variable Function
15(coords3D): 14(ptr) Variable Function
21(coords4D): 20(ptr) Variable Function
24(color): 20(ptr) Variable Function
Store 9(lod) 10
Store 11(coords1D) 12
Store 15(coords3D) 18
Store 21(coords4D) 23
Store 24(color) 26
31: 28 Load 30(texSampler1D)
32: 7(float) Load 11(coords1D)
33: 7(float) Load 9(lod)
34: 19(fvec4) ImageSampleExplicitLod 31 32 33
35: 19(fvec4) Load 24(color)
36: 19(fvec4) FAdd 35 34
Store 24(color) 36
37: 28 Load 30(texSampler1D)
41: 38(fvec2) Load 40(coords2D)
42: 7(float) Load 9(lod)
43: 19(fvec4) ImageSampleProjExplicitLod 37 41 42
44: 19(fvec4) Load 24(color)
45: 19(fvec4) FAdd 44 43
Store 24(color) 45
46: 28 Load 30(texSampler1D)
47: 19(fvec4) Load 21(coords4D)
48: 7(float) Load 9(lod)
49: 19(fvec4) ImageSampleProjExplicitLod 46 47 48
50: 19(fvec4) Load 24(color)
51: 19(fvec4) FAdd 50 49
Store 24(color) 51
56: 53 Load 55(texSampler2D)
57: 38(fvec2) Load 40(coords2D)
58: 7(float) Load 9(lod)
59: 19(fvec4) ImageSampleExplicitLod 56 57 58
60: 19(fvec4) Load 24(color)
61: 19(fvec4) FAdd 60 59
Store 24(color) 61
62: 53 Load 55(texSampler2D)
63: 13(fvec3) Load 15(coords3D)
64: 7(float) Load 9(lod)
65: 19(fvec4) ImageSampleProjExplicitLod 62 63 64
66: 19(fvec4) Load 24(color)
67: 19(fvec4) FAdd 66 65
Store 24(color) 67
68: 53 Load 55(texSampler2D)
69: 19(fvec4) Load 21(coords4D)
70: 7(float) Load 9(lod)
71: 19(fvec4) ImageSampleProjExplicitLod 68 69 70
72: 19(fvec4) Load 24(color)
73: 19(fvec4) FAdd 72 71
Store 24(color) 73
78: 75 Load 77(texSampler3D)
79: 13(fvec3) Load 15(coords3D)
80: 7(float) Load 9(lod)
81: 19(fvec4) ImageSampleExplicitLod 78 79 80
82: 19(fvec4) Load 24(color)
83: 19(fvec4) FAdd 82 81
Store 24(color) 83
84: 75 Load 77(texSampler3D)
85: 19(fvec4) Load 21(coords4D)
86: 7(float) Load 9(lod)
87: 19(fvec4) ImageSampleProjExplicitLod 84 85 86
88: 19(fvec4) Load 24(color)
89: 19(fvec4) FAdd 88 87
Store 24(color) 89
94: 91 Load 93(texSamplerCube)
95: 13(fvec3) Load 15(coords3D)
96: 7(float) Load 9(lod)
97: 19(fvec4) ImageSampleExplicitLod 94 95 96
98: 19(fvec4) Load 24(color)
99: 19(fvec4) FAdd 98 97
Store 24(color) 99
104: 101 Load 103(shadowSampler1D)
105: 13(fvec3) Load 15(coords3D)
106: 7(float) Load 9(lod)
107: 7(float) CompositeExtract 105 2
108: 19(fvec4) ImageSampleDrefExplicitLod 104 105 107 106
109: 19(fvec4) Load 24(color)
110: 19(fvec4) FAdd 109 108
Store 24(color) 110
115: 112 Load 114(shadowSampler2D)
116: 13(fvec3) Load 15(coords3D)
117: 7(float) Load 9(lod)
118: 7(float) CompositeExtract 116 2
119: 19(fvec4) ImageSampleDrefExplicitLod 115 116 118 117
120: 19(fvec4) Load 24(color)
121: 19(fvec4) FAdd 120 119
Store 24(color) 121
122: 101 Load 103(shadowSampler1D)
123: 19(fvec4) Load 21(coords4D)
124: 7(float) Load 9(lod)
125: 7(float) CompositeExtract 123 3
126: 19(fvec4) ImageSampleProjDrefExplicitLod 122 123 125 124
127: 19(fvec4) Load 24(color)
128: 19(fvec4) FAdd 127 126
Store 24(color) 128
129: 112 Load 114(shadowSampler2D)
130: 19(fvec4) Load 21(coords4D)
131: 7(float) Load 9(lod)
132: 7(float) CompositeExtract 130 3
133: 19(fvec4) ImageSampleProjDrefExplicitLod 129 130 132 131
134: 19(fvec4) Load 24(color)
135: 19(fvec4) FAdd 134 133
Store 24(color) 135
138: 19(fvec4) Load 24(color)
Store 137(gl_Position) 138
Branch 6
6: Label
8(lod): 7(ptr) Variable Function
10(coords1D): 7(ptr) Variable Function
14(coords3D): 13(ptr) Variable Function
20(coords4D): 19(ptr) Variable Function
23(color): 19(ptr) Variable Function
Store 8(lod) 9
Store 10(coords1D) 11
Store 14(coords3D) 17
Store 20(coords4D) 22
Store 23(color) 25
30: 27 Load 29(texSampler1D)
31: 6(float) Load 10(coords1D)
32: 6(float) Load 8(lod)
33: 18(fvec4) ImageSampleExplicitLod 30 31 32
34: 18(fvec4) Load 23(color)
35: 18(fvec4) FAdd 34 33
Store 23(color) 35
36: 27 Load 29(texSampler1D)
40: 37(fvec2) Load 39(coords2D)
41: 6(float) Load 8(lod)
42: 18(fvec4) ImageSampleProjExplicitLod 36 40 41
43: 18(fvec4) Load 23(color)
44: 18(fvec4) FAdd 43 42
Store 23(color) 44
45: 27 Load 29(texSampler1D)
46: 18(fvec4) Load 20(coords4D)
47: 6(float) Load 8(lod)
48: 18(fvec4) ImageSampleProjExplicitLod 45 46 47
49: 18(fvec4) Load 23(color)
50: 18(fvec4) FAdd 49 48
Store 23(color) 50
55: 52 Load 54(texSampler2D)
56: 37(fvec2) Load 39(coords2D)
57: 6(float) Load 8(lod)
58: 18(fvec4) ImageSampleExplicitLod 55 56 57
59: 18(fvec4) Load 23(color)
60: 18(fvec4) FAdd 59 58
Store 23(color) 60
61: 52 Load 54(texSampler2D)
62: 12(fvec3) Load 14(coords3D)
63: 6(float) Load 8(lod)
64: 18(fvec4) ImageSampleProjExplicitLod 61 62 63
65: 18(fvec4) Load 23(color)
66: 18(fvec4) FAdd 65 64
Store 23(color) 66
67: 52 Load 54(texSampler2D)
68: 18(fvec4) Load 20(coords4D)
69: 6(float) Load 8(lod)
70: 18(fvec4) ImageSampleProjExplicitLod 67 68 69
71: 18(fvec4) Load 23(color)
72: 18(fvec4) FAdd 71 70
Store 23(color) 72
77: 74 Load 76(texSampler3D)
78: 12(fvec3) Load 14(coords3D)
79: 6(float) Load 8(lod)
80: 18(fvec4) ImageSampleExplicitLod 77 78 79
81: 18(fvec4) Load 23(color)
82: 18(fvec4) FAdd 81 80
Store 23(color) 82
83: 74 Load 76(texSampler3D)
84: 18(fvec4) Load 20(coords4D)
85: 6(float) Load 8(lod)
86: 18(fvec4) ImageSampleProjExplicitLod 83 84 85
87: 18(fvec4) Load 23(color)
88: 18(fvec4) FAdd 87 86
Store 23(color) 88
93: 90 Load 92(texSamplerCube)
94: 12(fvec3) Load 14(coords3D)
95: 6(float) Load 8(lod)
96: 18(fvec4) ImageSampleExplicitLod 93 94 95
97: 18(fvec4) Load 23(color)
98: 18(fvec4) FAdd 97 96
Store 23(color) 98
103: 100 Load 102(shadowSampler1D)
104: 12(fvec3) Load 14(coords3D)
105: 6(float) Load 8(lod)
106: 6(float) CompositeExtract 104 2
107: 18(fvec4) ImageSampleDrefExplicitLod 103 104 106 105
108: 18(fvec4) Load 23(color)
109: 18(fvec4) FAdd 108 107
Store 23(color) 109
114: 111 Load 113(shadowSampler2D)
115: 12(fvec3) Load 14(coords3D)
116: 6(float) Load 8(lod)
117: 6(float) CompositeExtract 115 2
118: 18(fvec4) ImageSampleDrefExplicitLod 114 115 117 116
119: 18(fvec4) Load 23(color)
120: 18(fvec4) FAdd 119 118
Store 23(color) 120
121: 100 Load 102(shadowSampler1D)
122: 18(fvec4) Load 20(coords4D)
123: 6(float) Load 8(lod)
124: 6(float) CompositeExtract 122 3
125: 18(fvec4) ImageSampleProjDrefExplicitLod 121 122 124 123
126: 18(fvec4) Load 23(color)
127: 18(fvec4) FAdd 126 125
Store 23(color) 127
128: 111 Load 113(shadowSampler2D)
129: 18(fvec4) Load 20(coords4D)
130: 6(float) Load 8(lod)
131: 6(float) CompositeExtract 129 3
132: 18(fvec4) ImageSampleProjDrefExplicitLod 128 129 131 130
133: 18(fvec4) Load 23(color)
134: 18(fvec4) FAdd 133 132
Store 23(color) 134
137: 18(fvec4) Load 23(color)
Store 136(gl_Position) 137
Return
FunctionEnd