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 23
|
||||
// Id's are bound by 22
|
||||
|
||||
Source GLSL 150
|
||||
Capability Shader
|
||||
@@ -16,38 +16,36 @@ Linked fragment stage:
|
||||
EntryPoint Fragment 4 "main"
|
||||
ExecutionMode 4 OriginLowerLeft
|
||||
Name 4 "main"
|
||||
Name 10 "foo("
|
||||
Name 13 "BaseColor"
|
||||
Name 17 "gl_FragColor"
|
||||
Name 20 "bigColor"
|
||||
Name 22 "d"
|
||||
Decorate 13(BaseColor) Smooth
|
||||
Decorate 17(gl_FragColor) BuiltIn FragColor
|
||||
Decorate 20(bigColor) NoStaticUse
|
||||
Decorate 22(d) NoStaticUse
|
||||
Name 9 "foo("
|
||||
Name 12 "BaseColor"
|
||||
Name 16 "gl_FragColor"
|
||||
Name 19 "bigColor"
|
||||
Name 21 "d"
|
||||
Decorate 12(BaseColor) Smooth
|
||||
Decorate 16(gl_FragColor) BuiltIn FragColor
|
||||
Decorate 19(bigColor) NoStaticUse
|
||||
Decorate 21(d) NoStaticUse
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
7: TypeFloat 32
|
||||
8: TypeVector 7(float) 4
|
||||
9: TypeFunction 8(fvec4)
|
||||
12: TypePointer Input 8(fvec4)
|
||||
13(BaseColor): 12(ptr) Variable Input
|
||||
16: TypePointer Output 8(fvec4)
|
||||
17(gl_FragColor): 16(ptr) Variable Output
|
||||
19: TypePointer UniformConstant 8(fvec4)
|
||||
20(bigColor): 19(ptr) Variable UniformConstant
|
||||
21: TypePointer UniformConstant 7(float)
|
||||
22(d): 21(ptr) Variable UniformConstant
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypeFunction 7(fvec4)
|
||||
11: TypePointer Input 7(fvec4)
|
||||
12(BaseColor): 11(ptr) Variable Input
|
||||
15: TypePointer Output 7(fvec4)
|
||||
16(gl_FragColor): 15(ptr) Variable Output
|
||||
18: TypePointer UniformConstant 7(fvec4)
|
||||
19(bigColor): 18(ptr) Variable UniformConstant
|
||||
20: TypePointer UniformConstant 6(float)
|
||||
21(d): 20(ptr) Variable UniformConstant
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
18: 8(fvec4) FunctionCall 10(foo()
|
||||
Store 17(gl_FragColor) 18
|
||||
Branch 6
|
||||
6: Label
|
||||
17: 7(fvec4) FunctionCall 9(foo()
|
||||
Store 16(gl_FragColor) 17
|
||||
Return
|
||||
FunctionEnd
|
||||
10(foo(): 8(fvec4) Function None 9
|
||||
11: Label
|
||||
14: 8(fvec4) Load 13(BaseColor)
|
||||
ReturnValue 14
|
||||
9(foo(): 7(fvec4) Function None 8
|
||||
10: Label
|
||||
13: 7(fvec4) Load 12(BaseColor)
|
||||
ReturnValue 13
|
||||
FunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user