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 vertex stage:
// Module Version 99
// Generated by (magic number): 51a00bb
// Id's are bound by 26
// Id's are bound by 25
Source GLSL 450
Capability Shader
@@ -15,50 +15,48 @@ Linked vertex stage:
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main"
Name 4 "main"
Name 10 "color"
Name 11 "setBuf"
MemberName 11(setBuf) 0 "color"
Name 13 "setBufInst"
Name 22 "sampler"
Name 24 "gl_VertexID"
Name 25 "gl_InstanceID"
Decorate 10(color) Smooth
Decorate 11(setBuf) GLSLShared
Decorate 11(setBuf) BufferBlock
Decorate 13(setBufInst) DescriptorSet 0
Decorate 13(setBufInst) Binding 8
Decorate 22(sampler) DescriptorSet 4
Decorate 22(sampler) Binding 7
Decorate 22(sampler) NoStaticUse
Decorate 24(gl_VertexID) BuiltIn VertexId
Decorate 24(gl_VertexID) NoStaticUse
Decorate 25(gl_InstanceID) BuiltIn InstanceId
Decorate 25(gl_InstanceID) NoStaticUse
Name 9 "color"
Name 10 "setBuf"
MemberName 10(setBuf) 0 "color"
Name 12 "setBufInst"
Name 21 "sampler"
Name 23 "gl_VertexID"
Name 24 "gl_InstanceID"
Decorate 9(color) Smooth
Decorate 10(setBuf) GLSLShared
Decorate 10(setBuf) BufferBlock
Decorate 12(setBufInst) DescriptorSet 0
Decorate 12(setBufInst) Binding 8
Decorate 21(sampler) DescriptorSet 4
Decorate 21(sampler) Binding 7
Decorate 21(sampler) NoStaticUse
Decorate 23(gl_VertexID) BuiltIn VertexId
Decorate 23(gl_VertexID) NoStaticUse
Decorate 24(gl_InstanceID) BuiltIn InstanceId
Decorate 24(gl_InstanceID) NoStaticUse
2: TypeVoid
3: TypeFunction 2
7: TypeFloat 32
8: TypeVector 7(float) 4
9: TypePointer Output 8(fvec4)
10(color): 9(ptr) Variable Output
11(setBuf): TypeStruct 8(fvec4)
12: TypePointer Uniform 11(setBuf)
13(setBufInst): 12(ptr) Variable Uniform
14: TypeInt 32 1
15: 14(int) Constant 0
16: TypePointer Uniform 8(fvec4)
19: TypeImage 7(float) 2D sampled format:Unknown
20: TypeSampledImage 19
21: TypePointer UniformConstant 20
22(sampler): 21(ptr) Variable UniformConstant
23: TypePointer Input 14(int)
24(gl_VertexID): 23(ptr) Variable Input
25(gl_InstanceID): 23(ptr) Variable Input
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Output 7(fvec4)
9(color): 8(ptr) Variable Output
10(setBuf): TypeStruct 7(fvec4)
11: TypePointer Uniform 10(setBuf)
12(setBufInst): 11(ptr) Variable Uniform
13: TypeInt 32 1
14: 13(int) Constant 0
15: TypePointer Uniform 7(fvec4)
18: TypeImage 6(float) 2D sampled format:Unknown
19: TypeSampledImage 18
20: TypePointer UniformConstant 19
21(sampler): 20(ptr) Variable UniformConstant
22: TypePointer Input 13(int)
23(gl_VertexID): 22(ptr) Variable Input
24(gl_InstanceID): 22(ptr) Variable Input
4(main): 2 Function None 3
5: Label
17: 16(ptr) AccessChain 13(setBufInst) 15
18: 8(fvec4) Load 17
Store 10(color) 18
Branch 6
6: Label
16: 15(ptr) AccessChain 12(setBufInst) 14
17: 7(fvec4) Load 16
Store 9(color) 17
Return
FunctionEnd