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 fragment stage:
// Module Version 99
// Generated by (magic number): 51a00bb
// Id's are bound by 23
// Id's are bound by 22
Source GLSL 130
Capability Shader
@@ -16,33 +16,31 @@ Linked fragment stage:
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginLowerLeft
Name 4 "main"
Name 13 "gl_FragData"
Name 16 "i"
Name 19 "Color"
Decorate 13(gl_FragData) BuiltIn FragColor
Decorate 19(Color) Smooth
Name 12 "gl_FragData"
Name 15 "i"
Name 18 "Color"
Decorate 12(gl_FragData) BuiltIn FragColor
Decorate 18(Color) Smooth
2: TypeVoid
3: TypeFunction 2
7: TypeFloat 32
8: TypeVector 7(float) 4
9: TypeInt 32 0
10: 9(int) Constant 32
11: TypeArray 8(fvec4) 10
12: TypePointer Output 11
13(gl_FragData): 12(ptr) Variable Output
14: TypeInt 32 1
15: TypePointer UniformConstant 14(int)
16(i): 15(ptr) Variable UniformConstant
18: TypePointer Input 8(fvec4)
19(Color): 18(ptr) Variable Input
21: TypePointer Output 8(fvec4)
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeInt 32 0
9: 8(int) Constant 32
10: TypeArray 7(fvec4) 9
11: TypePointer Output 10
12(gl_FragData): 11(ptr) Variable Output
13: TypeInt 32 1
14: TypePointer UniformConstant 13(int)
15(i): 14(ptr) Variable UniformConstant
17: TypePointer Input 7(fvec4)
18(Color): 17(ptr) Variable Input
20: TypePointer Output 7(fvec4)
4(main): 2 Function None 3
5: Label
17: 14(int) Load 16(i)
20: 8(fvec4) Load 19(Color)
22: 21(ptr) AccessChain 13(gl_FragData) 17
Store 22 20
Branch 6
6: Label
16: 13(int) Load 15(i)
19: 7(fvec4) Load 18(Color)
21: 20(ptr) AccessChain 12(gl_FragData) 16
Store 21 19
Return
FunctionEnd