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:
@@ -7,7 +7,7 @@ Linked fragment stage:
|
||||
|
||||
// Module Version 99
|
||||
// Generated by (magic number): 51a00bb
|
||||
// Id's are bound by 51
|
||||
// Id's are bound by 50
|
||||
|
||||
Source GLSL 130
|
||||
Capability Shader
|
||||
@@ -16,84 +16,82 @@ Linked fragment stage:
|
||||
EntryPoint Fragment 4 "main"
|
||||
ExecutionMode 4 OriginLowerLeft
|
||||
Name 4 "main"
|
||||
Name 9 "lunarStruct1"
|
||||
MemberName 9(lunarStruct1) 0 "i"
|
||||
MemberName 9(lunarStruct1) 1 "f"
|
||||
Name 10 "lunarStruct2"
|
||||
MemberName 10(lunarStruct2) 0 "i"
|
||||
MemberName 10(lunarStruct2) 1 "f"
|
||||
MemberName 10(lunarStruct2) 2 "s1_1"
|
||||
Name 11 "lunarStruct3"
|
||||
MemberName 11(lunarStruct3) 0 "s2_1"
|
||||
MemberName 11(lunarStruct3) 1 "i"
|
||||
MemberName 11(lunarStruct3) 2 "f"
|
||||
MemberName 11(lunarStruct3) 3 "s1_1"
|
||||
Name 13 "foo3"
|
||||
Name 23 "locals2"
|
||||
Name 28 "foo2"
|
||||
Name 32 "gl_FragColor"
|
||||
Name 41 "sampler"
|
||||
Name 45 "coord"
|
||||
Name 50 "foo"
|
||||
Decorate 32(gl_FragColor) BuiltIn FragColor
|
||||
Decorate 45(coord) Smooth
|
||||
Decorate 50(foo) NoStaticUse
|
||||
Name 8 "lunarStruct1"
|
||||
MemberName 8(lunarStruct1) 0 "i"
|
||||
MemberName 8(lunarStruct1) 1 "f"
|
||||
Name 9 "lunarStruct2"
|
||||
MemberName 9(lunarStruct2) 0 "i"
|
||||
MemberName 9(lunarStruct2) 1 "f"
|
||||
MemberName 9(lunarStruct2) 2 "s1_1"
|
||||
Name 10 "lunarStruct3"
|
||||
MemberName 10(lunarStruct3) 0 "s2_1"
|
||||
MemberName 10(lunarStruct3) 1 "i"
|
||||
MemberName 10(lunarStruct3) 2 "f"
|
||||
MemberName 10(lunarStruct3) 3 "s1_1"
|
||||
Name 12 "foo3"
|
||||
Name 22 "locals2"
|
||||
Name 27 "foo2"
|
||||
Name 31 "gl_FragColor"
|
||||
Name 40 "sampler"
|
||||
Name 44 "coord"
|
||||
Name 49 "foo"
|
||||
Decorate 31(gl_FragColor) BuiltIn FragColor
|
||||
Decorate 44(coord) Smooth
|
||||
Decorate 49(foo) NoStaticUse
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
7: TypeInt 32 1
|
||||
8: TypeFloat 32
|
||||
9(lunarStruct1): TypeStruct 7(int) 8(float)
|
||||
10(lunarStruct2): TypeStruct 7(int) 8(float) 9(lunarStruct1)
|
||||
11(lunarStruct3): TypeStruct 10(lunarStruct2) 7(int) 8(float) 9(lunarStruct1)
|
||||
12: TypePointer UniformConstant 11(lunarStruct3)
|
||||
13(foo3): 12(ptr) Variable UniformConstant
|
||||
14: 7(int) Constant 0
|
||||
15: TypePointer UniformConstant 7(int)
|
||||
18: TypeBool
|
||||
22: TypePointer Function 10(lunarStruct2)
|
||||
24: TypePointer UniformConstant 10(lunarStruct2)
|
||||
28(foo2): 24(ptr) Variable UniformConstant
|
||||
30: TypeVector 8(float) 4
|
||||
31: TypePointer Output 30(fvec4)
|
||||
32(gl_FragColor): 31(ptr) Variable Output
|
||||
33: 7(int) Constant 2
|
||||
34: 7(int) Constant 1
|
||||
35: TypePointer Function 8(float)
|
||||
38: TypeImage 8(float) 2D sampled format:Unknown
|
||||
39: TypeSampledImage 38
|
||||
40: TypePointer UniformConstant 39
|
||||
41(sampler): 40(ptr) Variable UniformConstant
|
||||
43: TypeVector 8(float) 2
|
||||
44: TypePointer Input 43(fvec2)
|
||||
45(coord): 44(ptr) Variable Input
|
||||
49: TypePointer UniformConstant 9(lunarStruct1)
|
||||
50(foo): 49(ptr) Variable UniformConstant
|
||||
6: TypeInt 32 1
|
||||
7: TypeFloat 32
|
||||
8(lunarStruct1): TypeStruct 6(int) 7(float)
|
||||
9(lunarStruct2): TypeStruct 6(int) 7(float) 8(lunarStruct1)
|
||||
10(lunarStruct3): TypeStruct 9(lunarStruct2) 6(int) 7(float) 8(lunarStruct1)
|
||||
11: TypePointer UniformConstant 10(lunarStruct3)
|
||||
12(foo3): 11(ptr) Variable UniformConstant
|
||||
13: 6(int) Constant 0
|
||||
14: TypePointer UniformConstant 6(int)
|
||||
17: TypeBool
|
||||
21: TypePointer Function 9(lunarStruct2)
|
||||
23: TypePointer UniformConstant 9(lunarStruct2)
|
||||
27(foo2): 23(ptr) Variable UniformConstant
|
||||
29: TypeVector 7(float) 4
|
||||
30: TypePointer Output 29(fvec4)
|
||||
31(gl_FragColor): 30(ptr) Variable Output
|
||||
32: 6(int) Constant 2
|
||||
33: 6(int) Constant 1
|
||||
34: TypePointer Function 7(float)
|
||||
37: TypeImage 7(float) 2D sampled format:Unknown
|
||||
38: TypeSampledImage 37
|
||||
39: TypePointer UniformConstant 38
|
||||
40(sampler): 39(ptr) Variable UniformConstant
|
||||
42: TypeVector 7(float) 2
|
||||
43: TypePointer Input 42(fvec2)
|
||||
44(coord): 43(ptr) Variable Input
|
||||
48: TypePointer UniformConstant 8(lunarStruct1)
|
||||
49(foo): 48(ptr) Variable UniformConstant
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
23(locals2): 22(ptr) Variable Function
|
||||
16: 15(ptr) AccessChain 13(foo3) 14 14
|
||||
17: 7(int) Load 16
|
||||
19: 18(bool) SGreaterThan 17 14
|
||||
SelectionMerge 21 None
|
||||
BranchConditional 19 20 27
|
||||
20: Label
|
||||
25: 24(ptr) AccessChain 13(foo3) 14
|
||||
26:10(lunarStruct2) Load 25
|
||||
Store 23(locals2) 26
|
||||
Branch 21
|
||||
27: Label
|
||||
29:10(lunarStruct2) Load 28(foo2)
|
||||
Store 23(locals2) 29
|
||||
Branch 21
|
||||
21: Label
|
||||
36: 35(ptr) AccessChain 23(locals2) 33 34
|
||||
37: 8(float) Load 36
|
||||
42: 39 Load 41(sampler)
|
||||
46: 43(fvec2) Load 45(coord)
|
||||
47: 30(fvec4) ImageSampleImplicitLod 42 46
|
||||
48: 30(fvec4) VectorTimesScalar 47 37
|
||||
Store 32(gl_FragColor) 48
|
||||
Branch 6
|
||||
6: Label
|
||||
22(locals2): 21(ptr) Variable Function
|
||||
15: 14(ptr) AccessChain 12(foo3) 13 13
|
||||
16: 6(int) Load 15
|
||||
18: 17(bool) SGreaterThan 16 13
|
||||
SelectionMerge 20 None
|
||||
BranchConditional 18 19 26
|
||||
19: Label
|
||||
24: 23(ptr) AccessChain 12(foo3) 13
|
||||
25:9(lunarStruct2) Load 24
|
||||
Store 22(locals2) 25
|
||||
Branch 20
|
||||
26: Label
|
||||
28:9(lunarStruct2) Load 27(foo2)
|
||||
Store 22(locals2) 28
|
||||
Branch 20
|
||||
20: Label
|
||||
35: 34(ptr) AccessChain 22(locals2) 32 33
|
||||
36: 7(float) Load 35
|
||||
41: 38 Load 40(sampler)
|
||||
45: 42(fvec2) Load 44(coord)
|
||||
46: 29(fvec4) ImageSampleImplicitLod 41 45
|
||||
47: 29(fvec4) VectorTimesScalar 46 36
|
||||
Store 31(gl_FragColor) 47
|
||||
Return
|
||||
FunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user