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

@@ -10,7 +10,7 @@ Linked fragment stage:
// Module Version 99
// Generated by (magic number): 51a00bb
// Id's are bound by 70
// Id's are bound by 69
Source GLSL 130
Capability Shader
@@ -19,92 +19,90 @@ Linked fragment stage:
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginLowerLeft
Name 4 "main"
Name 10 "texColor"
Name 14 "texSampler2D"
Name 20 "userIn"
Name 23 "b"
Name 31 "gl_TexCoord"
Name 32 "a"
Name 46 "color"
Name 51 "alpha"
Name 56 "gl_FragColor"
Decorate 20(userIn) Smooth
Decorate 31(gl_TexCoord) Smooth
Decorate 46(color) Smooth
Decorate 51(alpha) Smooth
Decorate 56(gl_FragColor) BuiltIn FragColor
Name 9 "texColor"
Name 13 "texSampler2D"
Name 19 "userIn"
Name 22 "b"
Name 30 "gl_TexCoord"
Name 31 "a"
Name 45 "color"
Name 50 "alpha"
Name 55 "gl_FragColor"
Decorate 19(userIn) Smooth
Decorate 30(gl_TexCoord) Smooth
Decorate 45(color) Smooth
Decorate 50(alpha) Smooth
Decorate 55(gl_FragColor) BuiltIn FragColor
2: TypeVoid
3: TypeFunction 2
7: TypeFloat 32
8: TypeVector 7(float) 4
9: TypePointer Function 8(fvec4)
11: TypeImage 7(float) 2D sampled format:Unknown
12: TypeSampledImage 11
13: TypePointer UniformConstant 12
14(texSampler2D): 13(ptr) Variable UniformConstant
16: TypeInt 32 0
17: 16(int) Constant 2
18: TypeArray 8(fvec4) 17
19: TypePointer Input 18
20(userIn): 19(ptr) Variable Input
21: TypeInt 32 1
22: TypePointer UniformConstant 21(int)
23(b): 22(ptr) Variable UniformConstant
25: TypePointer Input 8(fvec4)
28: 16(int) Constant 6
29: TypeArray 8(fvec4) 28
30: TypePointer Input 29
31(gl_TexCoord): 30(ptr) Variable Input
32(a): 22(ptr) Variable UniformConstant
37: 21(int) Constant 5
41: TypeVector 7(float) 2
46(color): 25(ptr) Variable Input
50: TypePointer Input 7(float)
51(alpha): 50(ptr) Variable Input
55: TypePointer Output 8(fvec4)
56(gl_FragColor): 55(ptr) Variable Output
57: 21(int) Constant 0
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: TypeImage 6(float) 2D sampled format:Unknown
11: TypeSampledImage 10
12: TypePointer UniformConstant 11
13(texSampler2D): 12(ptr) Variable UniformConstant
15: TypeInt 32 0
16: 15(int) Constant 2
17: TypeArray 7(fvec4) 16
18: TypePointer Input 17
19(userIn): 18(ptr) Variable Input
20: TypeInt 32 1
21: TypePointer UniformConstant 20(int)
22(b): 21(ptr) Variable UniformConstant
24: TypePointer Input 7(fvec4)
27: 15(int) Constant 6
28: TypeArray 7(fvec4) 27
29: TypePointer Input 28
30(gl_TexCoord): 29(ptr) Variable Input
31(a): 21(ptr) Variable UniformConstant
36: 20(int) Constant 5
40: TypeVector 6(float) 2
45(color): 24(ptr) Variable Input
49: TypePointer Input 6(float)
50(alpha): 49(ptr) Variable Input
54: TypePointer Output 7(fvec4)
55(gl_FragColor): 54(ptr) Variable Output
56: 20(int) Constant 0
4(main): 2 Function None 3
5: Label
10(texColor): 9(ptr) Variable Function
15: 12 Load 14(texSampler2D)
24: 21(int) Load 23(b)
26: 25(ptr) AccessChain 20(userIn) 24
27: 8(fvec4) Load 26
33: 21(int) Load 32(a)
34: 25(ptr) AccessChain 31(gl_TexCoord) 33
35: 8(fvec4) Load 34
36: 8(fvec4) FAdd 27 35
38: 25(ptr) AccessChain 31(gl_TexCoord) 37
39: 8(fvec4) Load 38
40: 8(fvec4) FAdd 36 39
42: 7(float) CompositeExtract 40 0
43: 7(float) CompositeExtract 40 1
44: 41(fvec2) CompositeConstruct 42 43
45: 8(fvec4) ImageSampleImplicitLod 15 44
Store 10(texColor) 45
47: 8(fvec4) Load 46(color)
48: 8(fvec4) Load 10(texColor)
49: 8(fvec4) FAdd 48 47
Store 10(texColor) 49
52: 7(float) Load 51(alpha)
53: 8(fvec4) Load 10(texColor)
54: 8(fvec4) CompositeInsert 52 53 3
Store 10(texColor) 54
58: 25(ptr) AccessChain 31(gl_TexCoord) 57
59: 8(fvec4) Load 58
60: 21(int) Load 23(b)
61: 25(ptr) AccessChain 31(gl_TexCoord) 60
62: 8(fvec4) Load 61
63: 8(fvec4) FAdd 59 62
64: 8(fvec4) Load 10(texColor)
65: 8(fvec4) FAdd 63 64
66: 21(int) Load 32(a)
67: 25(ptr) AccessChain 20(userIn) 66
68: 8(fvec4) Load 67
69: 8(fvec4) FAdd 65 68
Store 56(gl_FragColor) 69
Branch 6
6: Label
9(texColor): 8(ptr) Variable Function
14: 11 Load 13(texSampler2D)
23: 20(int) Load 22(b)
25: 24(ptr) AccessChain 19(userIn) 23
26: 7(fvec4) Load 25
32: 20(int) Load 31(a)
33: 24(ptr) AccessChain 30(gl_TexCoord) 32
34: 7(fvec4) Load 33
35: 7(fvec4) FAdd 26 34
37: 24(ptr) AccessChain 30(gl_TexCoord) 36
38: 7(fvec4) Load 37
39: 7(fvec4) FAdd 35 38
41: 6(float) CompositeExtract 39 0
42: 6(float) CompositeExtract 39 1
43: 40(fvec2) CompositeConstruct 41 42
44: 7(fvec4) ImageSampleImplicitLod 14 43
Store 9(texColor) 44
46: 7(fvec4) Load 45(color)
47: 7(fvec4) Load 9(texColor)
48: 7(fvec4) FAdd 47 46
Store 9(texColor) 48
51: 6(float) Load 50(alpha)
52: 7(fvec4) Load 9(texColor)
53: 7(fvec4) CompositeInsert 51 52 3
Store 9(texColor) 53
57: 24(ptr) AccessChain 30(gl_TexCoord) 56
58: 7(fvec4) Load 57
59: 20(int) Load 22(b)
60: 24(ptr) AccessChain 30(gl_TexCoord) 59
61: 7(fvec4) Load 60
62: 7(fvec4) FAdd 58 61
63: 7(fvec4) Load 9(texColor)
64: 7(fvec4) FAdd 62 63
65: 20(int) Load 31(a)
66: 24(ptr) AccessChain 19(userIn) 65
67: 7(fvec4) Load 66
68: 7(fvec4) FAdd 64 67
Store 55(gl_FragColor) 68
Return
FunctionEnd