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:
@@ -5,7 +5,7 @@ Linked fragment stage:
|
||||
|
||||
// Module Version 99
|
||||
// Generated by (magic number): 51a00bb
|
||||
// Id's are bound by 81
|
||||
// Id's are bound by 80
|
||||
|
||||
Source GLSL 110
|
||||
Capability Shader
|
||||
@@ -14,119 +14,117 @@ Linked fragment stage:
|
||||
EntryPoint Fragment 4 "main"
|
||||
ExecutionMode 4 OriginLowerLeft
|
||||
Name 4 "main"
|
||||
Name 10 "white"
|
||||
Name 13 "black"
|
||||
Name 16 "color"
|
||||
Name 19 "x"
|
||||
Name 22 "tex_coord"
|
||||
Name 28 "y"
|
||||
Name 33 "radius"
|
||||
Name 56 "gl_FragColor"
|
||||
Decorate 22(tex_coord) Smooth
|
||||
Decorate 56(gl_FragColor) BuiltIn FragColor
|
||||
Name 9 "white"
|
||||
Name 12 "black"
|
||||
Name 15 "color"
|
||||
Name 18 "x"
|
||||
Name 21 "tex_coord"
|
||||
Name 27 "y"
|
||||
Name 32 "radius"
|
||||
Name 55 "gl_FragColor"
|
||||
Decorate 21(tex_coord) 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: 7(float) Constant 1065353216
|
||||
12: 8(fvec4) ConstantComposite 11 11 11 11
|
||||
14: 7(float) Constant 1045220557
|
||||
15: 8(fvec4) ConstantComposite 14 14 14 14
|
||||
18: TypePointer Function 7(float)
|
||||
20: TypeVector 7(float) 2
|
||||
21: TypePointer Input 20(fvec2)
|
||||
22(tex_coord): 21(ptr) Variable Input
|
||||
25: 7(float) Constant 1073741824
|
||||
43: TypeBool
|
||||
48: 7(float) Constant 1066192077
|
||||
55: TypePointer Output 8(fvec4)
|
||||
56(gl_FragColor): 55(ptr) Variable Output
|
||||
59: 7(float) Constant 1067030938
|
||||
68: 7(float) Constant 1061158912
|
||||
73: 7(float) Constant 1098907648
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypePointer Function 7(fvec4)
|
||||
10: 6(float) Constant 1065353216
|
||||
11: 7(fvec4) ConstantComposite 10 10 10 10
|
||||
13: 6(float) Constant 1045220557
|
||||
14: 7(fvec4) ConstantComposite 13 13 13 13
|
||||
17: TypePointer Function 6(float)
|
||||
19: TypeVector 6(float) 2
|
||||
20: TypePointer Input 19(fvec2)
|
||||
21(tex_coord): 20(ptr) Variable Input
|
||||
24: 6(float) Constant 1073741824
|
||||
42: TypeBool
|
||||
47: 6(float) Constant 1066192077
|
||||
54: TypePointer Output 7(fvec4)
|
||||
55(gl_FragColor): 54(ptr) Variable Output
|
||||
58: 6(float) Constant 1067030938
|
||||
67: 6(float) Constant 1061158912
|
||||
72: 6(float) Constant 1098907648
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
10(white): 9(ptr) Variable Function
|
||||
13(black): 9(ptr) Variable Function
|
||||
16(color): 9(ptr) Variable Function
|
||||
19(x): 18(ptr) Variable Function
|
||||
28(y): 18(ptr) Variable Function
|
||||
33(radius): 18(ptr) Variable Function
|
||||
Store 10(white) 12
|
||||
Store 13(black) 15
|
||||
17: 8(fvec4) Load 10(white)
|
||||
Store 16(color) 17
|
||||
23: 20(fvec2) Load 22(tex_coord)
|
||||
24: 7(float) CompositeExtract 23 0
|
||||
26: 7(float) FMul 24 25
|
||||
27: 7(float) FSub 26 11
|
||||
Store 19(x) 27
|
||||
29: 20(fvec2) Load 22(tex_coord)
|
||||
30: 7(float) CompositeExtract 29 1
|
||||
31: 7(float) FMul 30 25
|
||||
32: 7(float) FSub 31 11
|
||||
Store 28(y) 32
|
||||
34: 7(float) Load 19(x)
|
||||
35: 7(float) Load 19(x)
|
||||
36: 7(float) FMul 34 35
|
||||
37: 7(float) Load 28(y)
|
||||
38: 7(float) Load 28(y)
|
||||
39: 7(float) FMul 37 38
|
||||
40: 7(float) FAdd 36 39
|
||||
41: 7(float) ExtInst 1(GLSL.std.450) 31(Sqrt) 40
|
||||
Store 33(radius) 41
|
||||
42: 7(float) Load 33(radius)
|
||||
44: 43(bool) FOrdGreaterThan 42 11
|
||||
SelectionMerge 46 None
|
||||
BranchConditional 44 45 46
|
||||
45: Label
|
||||
47: 7(float) Load 33(radius)
|
||||
49: 43(bool) FOrdGreaterThan 47 48
|
||||
SelectionMerge 51 None
|
||||
BranchConditional 49 50 51
|
||||
50: Label
|
||||
52: 8(fvec4) Load 16(color)
|
||||
53: 8(fvec4) CompositeConstruct 11 11 11 11
|
||||
54: 8(fvec4) FAdd 52 53
|
||||
Store 16(color) 54
|
||||
Branch 51
|
||||
51: Label
|
||||
57: 8(fvec4) Load 16(color)
|
||||
Store 56(gl_FragColor) 57
|
||||
58: 7(float) Load 33(radius)
|
||||
60: 43(bool) FOrdGreaterThan 58 59
|
||||
SelectionMerge 62 None
|
||||
BranchConditional 60 61 62
|
||||
61: Label
|
||||
63: 8(fvec4) Load 16(color)
|
||||
64: 8(fvec4) CompositeConstruct 11 11 11 11
|
||||
65: 8(fvec4) FAdd 63 64
|
||||
Store 16(color) 65
|
||||
Branch 62
|
||||
62: Label
|
||||
Branch 46
|
||||
46: Label
|
||||
9(white): 8(ptr) Variable Function
|
||||
12(black): 8(ptr) Variable Function
|
||||
15(color): 8(ptr) Variable Function
|
||||
18(x): 17(ptr) Variable Function
|
||||
27(y): 17(ptr) Variable Function
|
||||
32(radius): 17(ptr) Variable Function
|
||||
Store 9(white) 11
|
||||
Store 12(black) 14
|
||||
16: 7(fvec4) Load 9(white)
|
||||
Store 15(color) 16
|
||||
22: 19(fvec2) Load 21(tex_coord)
|
||||
23: 6(float) CompositeExtract 22 0
|
||||
25: 6(float) FMul 23 24
|
||||
26: 6(float) FSub 25 10
|
||||
Store 18(x) 26
|
||||
28: 19(fvec2) Load 21(tex_coord)
|
||||
29: 6(float) CompositeExtract 28 1
|
||||
30: 6(float) FMul 29 24
|
||||
31: 6(float) FSub 30 10
|
||||
Store 27(y) 31
|
||||
33: 6(float) Load 18(x)
|
||||
34: 6(float) Load 18(x)
|
||||
35: 6(float) FMul 33 34
|
||||
36: 6(float) Load 27(y)
|
||||
37: 6(float) Load 27(y)
|
||||
38: 6(float) FMul 36 37
|
||||
39: 6(float) FAdd 35 38
|
||||
40: 6(float) ExtInst 1(GLSL.std.450) 31(Sqrt) 39
|
||||
Store 32(radius) 40
|
||||
41: 6(float) Load 32(radius)
|
||||
43: 42(bool) FOrdGreaterThan 41 10
|
||||
SelectionMerge 45 None
|
||||
BranchConditional 43 44 45
|
||||
44: Label
|
||||
46: 6(float) Load 32(radius)
|
||||
48: 42(bool) FOrdGreaterThan 46 47
|
||||
SelectionMerge 50 None
|
||||
BranchConditional 48 49 50
|
||||
49: Label
|
||||
51: 7(fvec4) Load 15(color)
|
||||
52: 7(fvec4) CompositeConstruct 10 10 10 10
|
||||
53: 7(fvec4) FAdd 51 52
|
||||
Store 15(color) 53
|
||||
Branch 50
|
||||
50: Label
|
||||
56: 7(fvec4) Load 15(color)
|
||||
Store 55(gl_FragColor) 56
|
||||
57: 6(float) Load 32(radius)
|
||||
59: 42(bool) FOrdGreaterThan 57 58
|
||||
SelectionMerge 61 None
|
||||
BranchConditional 59 60 61
|
||||
60: Label
|
||||
62: 7(fvec4) Load 15(color)
|
||||
63: 7(fvec4) CompositeConstruct 10 10 10 10
|
||||
64: 7(fvec4) FAdd 62 63
|
||||
Store 15(color) 64
|
||||
Branch 61
|
||||
61: Label
|
||||
Branch 45
|
||||
45: Label
|
||||
Kill
|
||||
66: Label
|
||||
67: 7(float) Load 33(radius)
|
||||
69: 43(bool) FOrdGreaterThanEqual 67 68
|
||||
SelectionMerge 71 None
|
||||
BranchConditional 69 70 71
|
||||
70: Label
|
||||
72: 7(float) Load 33(radius)
|
||||
74: 7(float) ExtInst 1(GLSL.std.450) 26(Pow) 72 73
|
||||
75: 7(float) FDiv 74 25
|
||||
76: 7(float) ExtInst 1(GLSL.std.450) 4(FAbs) 75
|
||||
77: 8(fvec4) Load 16(color)
|
||||
78: 8(fvec4) CompositeConstruct 76 76 76 76
|
||||
79: 8(fvec4) FSub 77 78
|
||||
Store 16(color) 79
|
||||
Branch 71
|
||||
71: Label
|
||||
80: 8(fvec4) Load 16(color)
|
||||
Store 56(gl_FragColor) 80
|
||||
Branch 6
|
||||
6: Label
|
||||
65: Label
|
||||
66: 6(float) Load 32(radius)
|
||||
68: 42(bool) FOrdGreaterThanEqual 66 67
|
||||
SelectionMerge 70 None
|
||||
BranchConditional 68 69 70
|
||||
69: Label
|
||||
71: 6(float) Load 32(radius)
|
||||
73: 6(float) ExtInst 1(GLSL.std.450) 26(Pow) 71 72
|
||||
74: 6(float) FDiv 73 24
|
||||
75: 6(float) ExtInst 1(GLSL.std.450) 4(FAbs) 74
|
||||
76: 7(fvec4) Load 15(color)
|
||||
77: 7(fvec4) CompositeConstruct 75 75 75 75
|
||||
78: 7(fvec4) FSub 76 77
|
||||
Store 15(color) 78
|
||||
Branch 70
|
||||
70: Label
|
||||
79: 7(fvec4) Load 15(color)
|
||||
Store 55(gl_FragColor) 79
|
||||
Return
|
||||
FunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user