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 42
// Id's are bound by 41
Source GLSL 120
Capability Shader
@@ -14,67 +14,65 @@ Linked fragment stage:
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginLowerLeft
Name 4 "main"
Name 10 "color"
Name 12 "BaseColor"
Name 14 "color2"
Name 16 "otherColor"
Name 19 "c"
Name 22 "d"
Name 28 "bigColor"
Name 33 "smallColor"
Name 38 "gl_FragColor"
Decorate 12(BaseColor) Smooth
Decorate 19(c) Smooth
Decorate 38(gl_FragColor) BuiltIn FragColor
Name 9 "color"
Name 11 "BaseColor"
Name 13 "color2"
Name 15 "otherColor"
Name 18 "c"
Name 21 "d"
Name 27 "bigColor"
Name 32 "smallColor"
Name 37 "gl_FragColor"
Decorate 11(BaseColor) Smooth
Decorate 18(c) Smooth
Decorate 37(gl_FragColor) BuiltIn FragColor
2: TypeVoid
3: TypeFunction 2
7: TypeFloat 32
8: TypeVector 7(float) 4
9: TypePointer Function 8(fvec4)
11: TypePointer Input 8(fvec4)
12(BaseColor): 11(ptr) Variable Input
15: TypePointer UniformConstant 8(fvec4)
16(otherColor): 15(ptr) Variable UniformConstant
18: TypePointer Input 7(float)
19(c): 18(ptr) Variable Input
21: TypePointer UniformConstant 7(float)
22(d): 21(ptr) Variable UniformConstant
24: TypeBool
28(bigColor): 15(ptr) Variable UniformConstant
33(smallColor): 15(ptr) Variable UniformConstant
37: TypePointer Output 8(fvec4)
38(gl_FragColor): 37(ptr) Variable Output
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: TypePointer Input 7(fvec4)
11(BaseColor): 10(ptr) Variable Input
14: TypePointer UniformConstant 7(fvec4)
15(otherColor): 14(ptr) Variable UniformConstant
17: TypePointer Input 6(float)
18(c): 17(ptr) Variable Input
20: TypePointer UniformConstant 6(float)
21(d): 20(ptr) Variable UniformConstant
23: TypeBool
27(bigColor): 14(ptr) Variable UniformConstant
32(smallColor): 14(ptr) Variable UniformConstant
36: TypePointer Output 7(fvec4)
37(gl_FragColor): 36(ptr) Variable Output
4(main): 2 Function None 3
5: Label
10(color): 9(ptr) Variable Function
14(color2): 9(ptr) Variable Function
13: 8(fvec4) Load 12(BaseColor)
Store 10(color) 13
17: 8(fvec4) Load 16(otherColor)
Store 14(color2) 17
20: 7(float) Load 19(c)
23: 7(float) Load 22(d)
25: 24(bool) FOrdGreaterThan 20 23
SelectionMerge 27 None
BranchConditional 25 26 32
26: Label
29: 8(fvec4) Load 28(bigColor)
30: 8(fvec4) Load 10(color)
31: 8(fvec4) FAdd 30 29
Store 10(color) 31
Branch 27
32: Label
34: 8(fvec4) Load 33(smallColor)
35: 8(fvec4) Load 10(color)
36: 8(fvec4) FAdd 35 34
Store 10(color) 36
Branch 27
27: Label
39: 8(fvec4) Load 10(color)
40: 8(fvec4) Load 14(color2)
41: 8(fvec4) FMul 39 40
Store 38(gl_FragColor) 41
Branch 6
6: Label
9(color): 8(ptr) Variable Function
13(color2): 8(ptr) Variable Function
12: 7(fvec4) Load 11(BaseColor)
Store 9(color) 12
16: 7(fvec4) Load 15(otherColor)
Store 13(color2) 16
19: 6(float) Load 18(c)
22: 6(float) Load 21(d)
24: 23(bool) FOrdGreaterThan 19 22
SelectionMerge 26 None
BranchConditional 24 25 31
25: Label
28: 7(fvec4) Load 27(bigColor)
29: 7(fvec4) Load 9(color)
30: 7(fvec4) FAdd 29 28
Store 9(color) 30
Branch 26
31: Label
33: 7(fvec4) Load 32(smallColor)
34: 7(fvec4) Load 9(color)
35: 7(fvec4) FAdd 34 33
Store 9(color) 35
Branch 26
26: Label
38: 7(fvec4) Load 9(color)
39: 7(fvec4) Load 13(color2)
40: 7(fvec4) FMul 38 39
Store 37(gl_FragColor) 40
Return
FunctionEnd