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