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 38
|
||||
// Id's are bound by 37
|
||||
|
||||
Source GLSL 110
|
||||
Capability Shader
|
||||
@@ -14,61 +14,59 @@ Linked fragment stage:
|
||||
EntryPoint Fragment 4 "main"
|
||||
ExecutionMode 4 OriginLowerLeft
|
||||
Name 4 "main"
|
||||
Name 10 "color"
|
||||
Name 12 "BaseColor"
|
||||
Name 25 "d"
|
||||
Name 30 "bigColor"
|
||||
Name 36 "gl_FragColor"
|
||||
Decorate 12(BaseColor) Smooth
|
||||
Decorate 36(gl_FragColor) BuiltIn FragColor
|
||||
Name 9 "color"
|
||||
Name 11 "BaseColor"
|
||||
Name 24 "d"
|
||||
Name 29 "bigColor"
|
||||
Name 35 "gl_FragColor"
|
||||
Decorate 11(BaseColor) Smooth
|
||||
Decorate 35(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
|
||||
18: TypeBool
|
||||
19: 18(bool) ConstantTrue
|
||||
24: TypePointer UniformConstant 7(float)
|
||||
25(d): 24(ptr) Variable UniformConstant
|
||||
29: TypePointer UniformConstant 8(fvec4)
|
||||
30(bigColor): 29(ptr) Variable UniformConstant
|
||||
34: 18(bool) ConstantFalse
|
||||
35: TypePointer Output 8(fvec4)
|
||||
36(gl_FragColor): 35(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
|
||||
17: TypeBool
|
||||
18: 17(bool) ConstantTrue
|
||||
23: TypePointer UniformConstant 6(float)
|
||||
24(d): 23(ptr) Variable UniformConstant
|
||||
28: TypePointer UniformConstant 7(fvec4)
|
||||
29(bigColor): 28(ptr) Variable UniformConstant
|
||||
33: 17(bool) ConstantFalse
|
||||
34: TypePointer Output 7(fvec4)
|
||||
35(gl_FragColor): 34(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
10(color): 9(ptr) Variable Function
|
||||
13: 8(fvec4) Load 12(BaseColor)
|
||||
Store 10(color) 13
|
||||
Branch 14
|
||||
14: Label
|
||||
17: 18(bool) Phi 19 5 34 16
|
||||
LoopMerge 15 None
|
||||
Branch 20
|
||||
20: Label
|
||||
SelectionMerge 16 None
|
||||
BranchConditional 17 16 21
|
||||
21: Label
|
||||
22: 8(fvec4) Load 10(color)
|
||||
23: 7(float) CompositeExtract 22 0
|
||||
26: 7(float) Load 25(d)
|
||||
27: 18(bool) FOrdLessThan 23 26
|
||||
SelectionMerge 28 None
|
||||
BranchConditional 27 28 15
|
||||
28: Label
|
||||
Branch 16
|
||||
16: Label
|
||||
31: 8(fvec4) Load 30(bigColor)
|
||||
32: 8(fvec4) Load 10(color)
|
||||
33: 8(fvec4) FAdd 32 31
|
||||
Store 10(color) 33
|
||||
Branch 14
|
||||
9(color): 8(ptr) Variable Function
|
||||
12: 7(fvec4) Load 11(BaseColor)
|
||||
Store 9(color) 12
|
||||
Branch 13
|
||||
13: Label
|
||||
16: 17(bool) Phi 18 5 33 15
|
||||
LoopMerge 14 None
|
||||
Branch 19
|
||||
19: Label
|
||||
SelectionMerge 15 None
|
||||
BranchConditional 16 15 20
|
||||
20: Label
|
||||
21: 7(fvec4) Load 9(color)
|
||||
22: 6(float) CompositeExtract 21 0
|
||||
25: 6(float) Load 24(d)
|
||||
26: 17(bool) FOrdLessThan 22 25
|
||||
SelectionMerge 27 None
|
||||
BranchConditional 26 27 14
|
||||
27: Label
|
||||
Branch 15
|
||||
15: Label
|
||||
37: 8(fvec4) Load 10(color)
|
||||
Store 36(gl_FragColor) 37
|
||||
Branch 6
|
||||
6: Label
|
||||
30: 7(fvec4) Load 29(bigColor)
|
||||
31: 7(fvec4) Load 9(color)
|
||||
32: 7(fvec4) FAdd 31 30
|
||||
Store 9(color) 32
|
||||
Branch 13
|
||||
14: Label
|
||||
36: 7(fvec4) Load 9(color)
|
||||
Store 35(gl_FragColor) 36
|
||||
Return
|
||||
FunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user