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 56
|
||||
// Id's are bound by 55
|
||||
|
||||
Source GLSL 110
|
||||
Capability Shader
|
||||
@@ -14,78 +14,76 @@ Linked fragment stage:
|
||||
EntryPoint Fragment 4 "main"
|
||||
ExecutionMode 4 OriginLowerLeft
|
||||
Name 4 "main"
|
||||
Name 9 "blendscale"
|
||||
Name 13 "v"
|
||||
Name 17 "texSampler2D"
|
||||
Name 21 "t"
|
||||
Name 24 "scale"
|
||||
Name 31 "w"
|
||||
Name 35 "texSampler3D"
|
||||
Name 39 "coords"
|
||||
Name 45 "gl_FragColor"
|
||||
Name 48 "u"
|
||||
Name 51 "blend"
|
||||
Decorate 21(t) Smooth
|
||||
Decorate 39(coords) Smooth
|
||||
Decorate 45(gl_FragColor) BuiltIn FragColor
|
||||
Name 8 "blendscale"
|
||||
Name 12 "v"
|
||||
Name 16 "texSampler2D"
|
||||
Name 20 "t"
|
||||
Name 23 "scale"
|
||||
Name 30 "w"
|
||||
Name 34 "texSampler3D"
|
||||
Name 38 "coords"
|
||||
Name 44 "gl_FragColor"
|
||||
Name 47 "u"
|
||||
Name 50 "blend"
|
||||
Decorate 20(t) Smooth
|
||||
Decorate 38(coords) Smooth
|
||||
Decorate 44(gl_FragColor) BuiltIn FragColor
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
7: TypeFloat 32
|
||||
8: TypePointer Function 7(float)
|
||||
10: 7(float) Constant 1071971828
|
||||
11: TypeVector 7(float) 4
|
||||
12: TypePointer Function 11(fvec4)
|
||||
14: TypeImage 7(float) 2D sampled format:Unknown
|
||||
15: TypeSampledImage 14
|
||||
16: TypePointer UniformConstant 15
|
||||
17(texSampler2D): 16(ptr) Variable UniformConstant
|
||||
19: TypeVector 7(float) 2
|
||||
20: TypePointer Input 19(fvec2)
|
||||
21(t): 20(ptr) Variable Input
|
||||
23: TypePointer UniformConstant 19(fvec2)
|
||||
24(scale): 23(ptr) Variable UniformConstant
|
||||
32: TypeImage 7(float) 3D sampled format:Unknown
|
||||
33: TypeSampledImage 32
|
||||
34: TypePointer UniformConstant 33
|
||||
35(texSampler3D): 34(ptr) Variable UniformConstant
|
||||
37: TypeVector 7(float) 3
|
||||
38: TypePointer Input 37(fvec3)
|
||||
39(coords): 38(ptr) Variable Input
|
||||
44: TypePointer Output 11(fvec4)
|
||||
45(gl_FragColor): 44(ptr) Variable Output
|
||||
47: TypePointer UniformConstant 11(fvec4)
|
||||
48(u): 47(ptr) Variable UniformConstant
|
||||
50: TypePointer UniformConstant 7(float)
|
||||
51(blend): 50(ptr) Variable UniformConstant
|
||||
6: TypeFloat 32
|
||||
7: TypePointer Function 6(float)
|
||||
9: 6(float) Constant 1071971828
|
||||
10: TypeVector 6(float) 4
|
||||
11: TypePointer Function 10(fvec4)
|
||||
13: TypeImage 6(float) 2D sampled format:Unknown
|
||||
14: TypeSampledImage 13
|
||||
15: TypePointer UniformConstant 14
|
||||
16(texSampler2D): 15(ptr) Variable UniformConstant
|
||||
18: TypeVector 6(float) 2
|
||||
19: TypePointer Input 18(fvec2)
|
||||
20(t): 19(ptr) Variable Input
|
||||
22: TypePointer UniformConstant 18(fvec2)
|
||||
23(scale): 22(ptr) Variable UniformConstant
|
||||
31: TypeImage 6(float) 3D sampled format:Unknown
|
||||
32: TypeSampledImage 31
|
||||
33: TypePointer UniformConstant 32
|
||||
34(texSampler3D): 33(ptr) Variable UniformConstant
|
||||
36: TypeVector 6(float) 3
|
||||
37: TypePointer Input 36(fvec3)
|
||||
38(coords): 37(ptr) Variable Input
|
||||
43: TypePointer Output 10(fvec4)
|
||||
44(gl_FragColor): 43(ptr) Variable Output
|
||||
46: TypePointer UniformConstant 10(fvec4)
|
||||
47(u): 46(ptr) Variable UniformConstant
|
||||
49: TypePointer UniformConstant 6(float)
|
||||
50(blend): 49(ptr) Variable UniformConstant
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
9(blendscale): 8(ptr) Variable Function
|
||||
13(v): 12(ptr) Variable Function
|
||||
31(w): 12(ptr) Variable Function
|
||||
Store 9(blendscale) 10
|
||||
18: 15 Load 17(texSampler2D)
|
||||
22: 19(fvec2) Load 21(t)
|
||||
25: 19(fvec2) Load 24(scale)
|
||||
26: 19(fvec2) FAdd 22 25
|
||||
27: 19(fvec2) Load 24(scale)
|
||||
28: 19(fvec2) FDiv 26 27
|
||||
29: 11(fvec4) ImageSampleImplicitLod 18 28
|
||||
30: 11(fvec4) VectorShuffle 29 29 3 2 1 0
|
||||
Store 13(v) 30
|
||||
36: 33 Load 35(texSampler3D)
|
||||
40: 37(fvec3) Load 39(coords)
|
||||
41: 11(fvec4) ImageSampleImplicitLod 36 40
|
||||
42: 11(fvec4) Load 13(v)
|
||||
43: 11(fvec4) FAdd 41 42
|
||||
Store 31(w) 43
|
||||
46: 11(fvec4) Load 31(w)
|
||||
49: 11(fvec4) Load 48(u)
|
||||
52: 7(float) Load 51(blend)
|
||||
53: 7(float) Load 9(blendscale)
|
||||
54: 7(float) FMul 52 53
|
||||
55: 11(fvec4) ExtInst 1(GLSL.std.450) 46(Mix) 46 49 54
|
||||
Store 45(gl_FragColor) 55
|
||||
Branch 6
|
||||
6: Label
|
||||
8(blendscale): 7(ptr) Variable Function
|
||||
12(v): 11(ptr) Variable Function
|
||||
30(w): 11(ptr) Variable Function
|
||||
Store 8(blendscale) 9
|
||||
17: 14 Load 16(texSampler2D)
|
||||
21: 18(fvec2) Load 20(t)
|
||||
24: 18(fvec2) Load 23(scale)
|
||||
25: 18(fvec2) FAdd 21 24
|
||||
26: 18(fvec2) Load 23(scale)
|
||||
27: 18(fvec2) FDiv 25 26
|
||||
28: 10(fvec4) ImageSampleImplicitLod 17 27
|
||||
29: 10(fvec4) VectorShuffle 28 28 3 2 1 0
|
||||
Store 12(v) 29
|
||||
35: 32 Load 34(texSampler3D)
|
||||
39: 36(fvec3) Load 38(coords)
|
||||
40: 10(fvec4) ImageSampleImplicitLod 35 39
|
||||
41: 10(fvec4) Load 12(v)
|
||||
42: 10(fvec4) FAdd 40 41
|
||||
Store 30(w) 42
|
||||
45: 10(fvec4) Load 30(w)
|
||||
48: 10(fvec4) Load 47(u)
|
||||
51: 6(float) Load 50(blend)
|
||||
52: 6(float) Load 8(blendscale)
|
||||
53: 6(float) FMul 51 52
|
||||
54: 10(fvec4) ExtInst 1(GLSL.std.450) 46(Mix) 45 48 53
|
||||
Store 44(gl_FragColor) 54
|
||||
Return
|
||||
FunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user