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:
John Kessenich 2015-09-14 20:58:02 -06:00
parent 5f5b205ce9
commit e770b3e6cf
74 changed files with 9648 additions and 9816 deletions

View file

@ -5,7 +5,7 @@ Linked vertex stage:
// Module Version 99
// Generated by (magic number): 51a00bb
// Id's are bound by 41
// Id's are bound by 40
Source ESSL 300
Capability Shader
@ -13,67 +13,65 @@ Linked vertex stage:
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main"
Name 4 "main"
Name 9 "i"
Name 12 "gl_VertexID"
Name 17 "j"
Name 24 "gl_Position"
Name 26 "ps"
Name 34 "gl_PointSize"
Name 40 "gl_InstanceID"
Decorate 9(i) RelaxedPrecision
Decorate 12(gl_VertexID) BuiltIn VertexId
Decorate 17(j) RelaxedPrecision
Decorate 24(gl_Position) Invariant
Decorate 24(gl_Position) BuiltIn Position
Decorate 26(ps) RelaxedPrecision
Decorate 34(gl_PointSize) BuiltIn PointSize
Decorate 40(gl_InstanceID) BuiltIn InstanceId
Decorate 40(gl_InstanceID) NoStaticUse
Name 8 "i"
Name 11 "gl_VertexID"
Name 16 "j"
Name 23 "gl_Position"
Name 25 "ps"
Name 33 "gl_PointSize"
Name 39 "gl_InstanceID"
Decorate 8(i) RelaxedPrecision
Decorate 11(gl_VertexID) BuiltIn VertexId
Decorate 16(j) RelaxedPrecision
Decorate 23(gl_Position) Invariant
Decorate 23(gl_Position) BuiltIn Position
Decorate 25(ps) RelaxedPrecision
Decorate 33(gl_PointSize) BuiltIn PointSize
Decorate 39(gl_InstanceID) BuiltIn InstanceId
Decorate 39(gl_InstanceID) NoStaticUse
2: TypeVoid
3: TypeFunction 2
7: TypeInt 32 1
8: TypePointer Function 7(int)
10: 7(int) Constant 4
11: TypePointer Input 7(int)
12(gl_VertexID): 11(ptr) Variable Input
15: 7(int) Constant 10
21: TypeFloat 32
22: TypeVector 21(float) 4
23: TypePointer Output 22(fvec4)
24(gl_Position): 23(ptr) Variable Output
25: TypePointer Input 21(float)
26(ps): 25(ptr) Variable Input
33: TypePointer Output 21(float)
34(gl_PointSize): 33(ptr) Variable Output
40(gl_InstanceID): 11(ptr) Variable Input
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 4
10: TypePointer Input 6(int)
11(gl_VertexID): 10(ptr) Variable Input
14: 6(int) Constant 10
20: TypeFloat 32
21: TypeVector 20(float) 4
22: TypePointer Output 21(fvec4)
23(gl_Position): 22(ptr) Variable Output
24: TypePointer Input 20(float)
25(ps): 24(ptr) Variable Input
32: TypePointer Output 20(float)
33(gl_PointSize): 32(ptr) Variable Output
39(gl_InstanceID): 10(ptr) Variable Input
4(main): 2 Function None 3
5: Label
9(i): 8(ptr) Variable Function
17(j): 8(ptr) Variable Function
13: 7(int) Load 12(gl_VertexID)
14: 7(int) IMul 10 13
16: 7(int) ISub 14 15
Store 9(i) 16
18: 7(int) Load 12(gl_VertexID)
19: 7(int) IMul 10 18
20: 7(int) ISub 19 15
Store 17(j) 20
27: 21(float) Load 26(ps)
28: 22(fvec4) CompositeConstruct 27 27 27 27
Store 24(gl_Position) 28
29: 7(int) Load 9(i)
30: 21(float) ConvertSToF 29
31: 22(fvec4) Load 24(gl_Position)
32: 22(fvec4) VectorTimesScalar 31 30
Store 24(gl_Position) 32
35: 21(float) Load 26(ps)
Store 34(gl_PointSize) 35
36: 7(int) Load 17(j)
37: 21(float) ConvertSToF 36
38: 21(float) Load 34(gl_PointSize)
39: 21(float) FMul 38 37
Store 34(gl_PointSize) 39
Branch 6
6: Label
8(i): 7(ptr) Variable Function
16(j): 7(ptr) Variable Function
12: 6(int) Load 11(gl_VertexID)
13: 6(int) IMul 9 12
15: 6(int) ISub 13 14
Store 8(i) 15
17: 6(int) Load 11(gl_VertexID)
18: 6(int) IMul 9 17
19: 6(int) ISub 18 14
Store 16(j) 19
26: 20(float) Load 25(ps)
27: 21(fvec4) CompositeConstruct 26 26 26 26
Store 23(gl_Position) 27
28: 6(int) Load 8(i)
29: 20(float) ConvertSToF 28
30: 21(fvec4) Load 23(gl_Position)
31: 21(fvec4) VectorTimesScalar 30 29
Store 23(gl_Position) 31
34: 20(float) Load 25(ps)
Store 33(gl_PointSize) 34
35: 6(int) Load 16(j)
36: 20(float) ConvertSToF 35
37: 20(float) Load 33(gl_PointSize)
38: 20(float) FMul 37 36
Store 33(gl_PointSize) 38
Return
FunctionEnd