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

@@ -7,7 +7,7 @@ Linked compute stage:
// Module Version 99
// Generated by (magic number): 51a00bb
// Id's are bound by 68
// Id's are bound by 67
Source ESSL 310
Capability Shader
@@ -15,107 +15,105 @@ Linked compute stage:
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
Name 4 "main"
Name 14 "outb"
MemberName 14(outb) 0 "f"
MemberName 14(outb) 1 "g"
MemberName 14(outb) 2 "h"
MemberName 14(outb) 3 "uns"
Name 16 "outbname"
Name 20 "s"
Name 25 "outbna"
MemberName 25(outbna) 0 "k"
MemberName 25(outbna) 1 "na"
Name 27 "outbnamena"
Name 44 "i"
Name 50 "outs"
MemberName 50(outs) 0 "s"
MemberName 50(outs) 1 "va"
Name 52 "outnames"
Name 55 "gl_LocalInvocationID"
Decorate 14(outb) GLSLShared
Decorate 14(outb) BufferBlock
Decorate 25(outbna) GLSLShared
Decorate 25(outbna) BufferBlock
Decorate 50(outs) GLSLShared
Decorate 50(outs) BufferBlock
Decorate 55(gl_LocalInvocationID) BuiltIn LocalInvocationId
Decorate 67 BuiltIn WorkgroupSize
Decorate 67 NoStaticUse
Name 13 "outb"
MemberName 13(outb) 0 "f"
MemberName 13(outb) 1 "g"
MemberName 13(outb) 2 "h"
MemberName 13(outb) 3 "uns"
Name 15 "outbname"
Name 19 "s"
Name 24 "outbna"
MemberName 24(outbna) 0 "k"
MemberName 24(outbna) 1 "na"
Name 26 "outbnamena"
Name 43 "i"
Name 49 "outs"
MemberName 49(outs) 0 "s"
MemberName 49(outs) 1 "va"
Name 51 "outnames"
Name 54 "gl_LocalInvocationID"
Decorate 13(outb) GLSLShared
Decorate 13(outb) BufferBlock
Decorate 24(outbna) GLSLShared
Decorate 24(outbna) BufferBlock
Decorate 49(outs) GLSLShared
Decorate 49(outs) BufferBlock
Decorate 54(gl_LocalInvocationID) BuiltIn LocalInvocationId
Decorate 66 BuiltIn WorkgroupSize
Decorate 66 NoStaticUse
2: TypeVoid
3: TypeFunction 2
7: TypeInt 32 0
8: 7(int) Constant 1
9: 7(int) Constant 1023
10: 7(int) Constant 0
11: TypeFloat 32
12: TypeVector 11(float) 3
13: TypeRuntimeArray 12(fvec3)
14(outb): TypeStruct 11(float) 11(float) 11(float) 13
15: TypePointer Uniform 14(outb)
16(outbname): 15(ptr) Variable Uniform
17: TypeInt 32 1
18: 17(int) Constant 0
19: TypePointer WorkgroupLocal 11(float)
20(s): 19(ptr) Variable WorkgroupLocal
22: TypePointer Uniform 11(float)
24: TypeVector 11(float) 4
25(outbna): TypeStruct 17(int) 24(fvec4)
26: TypePointer Uniform 25(outbna)
27(outbnamena): 26(ptr) Variable Uniform
28: 17(int) Constant 1
31: TypePointer Uniform 24(fvec4)
33: 17(int) Constant 3
34: 17(int) Constant 18
35: TypePointer Uniform 12(fvec3)
39: 17(int) Constant 17
40: 11(float) Constant 1077936128
41: 12(fvec3) ConstantComposite 40 40 40
43: TypePointer WorkgroupLocal 17(int)
44(i): 43(ptr) Variable WorkgroupLocal
49: TypeRuntimeArray 24(fvec4)
50(outs): TypeStruct 17(int) 49
51: TypePointer Uniform 50(outs)
52(outnames): 51(ptr) Variable Uniform
53: TypeVector 7(int) 3
54: TypePointer Input 53(ivec3)
55(gl_LocalInvocationID): 54(ptr) Variable Input
62: TypePointer Uniform 17(int)
64: 7(int) Constant 16
65: 7(int) Constant 32
66: 7(int) Constant 4
67: 53(ivec3) ConstantComposite 64 65 66
6: TypeInt 32 0
7: 6(int) Constant 1
8: 6(int) Constant 1023
9: 6(int) Constant 0
10: TypeFloat 32
11: TypeVector 10(float) 3
12: TypeRuntimeArray 11(fvec3)
13(outb): TypeStruct 10(float) 10(float) 10(float) 12
14: TypePointer Uniform 13(outb)
15(outbname): 14(ptr) Variable Uniform
16: TypeInt 32 1
17: 16(int) Constant 0
18: TypePointer WorkgroupLocal 10(float)
19(s): 18(ptr) Variable WorkgroupLocal
21: TypePointer Uniform 10(float)
23: TypeVector 10(float) 4
24(outbna): TypeStruct 16(int) 23(fvec4)
25: TypePointer Uniform 24(outbna)
26(outbnamena): 25(ptr) Variable Uniform
27: 16(int) Constant 1
30: TypePointer Uniform 23(fvec4)
32: 16(int) Constant 3
33: 16(int) Constant 18
34: TypePointer Uniform 11(fvec3)
38: 16(int) Constant 17
39: 10(float) Constant 1077936128
40: 11(fvec3) ConstantComposite 39 39 39
42: TypePointer WorkgroupLocal 16(int)
43(i): 42(ptr) Variable WorkgroupLocal
48: TypeRuntimeArray 23(fvec4)
49(outs): TypeStruct 16(int) 48
50: TypePointer Uniform 49(outs)
51(outnames): 50(ptr) Variable Uniform
52: TypeVector 6(int) 3
53: TypePointer Input 52(ivec3)
54(gl_LocalInvocationID): 53(ptr) Variable Input
61: TypePointer Uniform 16(int)
63: 6(int) Constant 16
64: 6(int) Constant 32
65: 6(int) Constant 4
66: 52(ivec3) ConstantComposite 63 64 65
4(main): 2 Function None 3
5: Label
MemoryBarrier 8 9
ControlBarrier 8 8 10
21: 11(float) Load 20(s)
23: 22(ptr) AccessChain 16(outbname) 18
Store 23 21
29: 11(float) Load 20(s)
30: 24(fvec4) CompositeConstruct 29 29 29 29
32: 31(ptr) AccessChain 27(outbnamena) 28
Store 32 30
36: 35(ptr) AccessChain 16(outbname) 33 34
37: 12(fvec3) Load 36
38: 11(float) CompositeExtract 37 0
Store 20(s) 38
42: 35(ptr) AccessChain 16(outbname) 33 39
Store 42 41
45: 17(int) Load 44(i)
46: 11(float) Load 20(s)
47: 12(fvec3) CompositeConstruct 46 46 46
48: 35(ptr) AccessChain 16(outbname) 33 45
Store 48 47
56: 53(ivec3) Load 55(gl_LocalInvocationID)
57: 7(int) CompositeExtract 56 0
58: 11(float) Load 20(s)
59: 24(fvec4) CompositeConstruct 58 58 58 58
60: 31(ptr) AccessChain 52(outnames) 28 57
Store 60 59
61: 17(int) ArrayLength 16(outbname)
63: 62(ptr) AccessChain 52(outnames) 18
Store 63 61
Branch 6
6: Label
MemoryBarrier 7 8
ControlBarrier 7 7 9
20: 10(float) Load 19(s)
22: 21(ptr) AccessChain 15(outbname) 17
Store 22 20
28: 10(float) Load 19(s)
29: 23(fvec4) CompositeConstruct 28 28 28 28
31: 30(ptr) AccessChain 26(outbnamena) 27
Store 31 29
35: 34(ptr) AccessChain 15(outbname) 32 33
36: 11(fvec3) Load 35
37: 10(float) CompositeExtract 36 0
Store 19(s) 37
41: 34(ptr) AccessChain 15(outbname) 32 38
Store 41 40
44: 16(int) Load 43(i)
45: 10(float) Load 19(s)
46: 11(fvec3) CompositeConstruct 45 45 45
47: 34(ptr) AccessChain 15(outbname) 32 44
Store 47 46
55: 52(ivec3) Load 54(gl_LocalInvocationID)
56: 6(int) CompositeExtract 55 0
57: 10(float) Load 19(s)
58: 23(fvec4) CompositeConstruct 57 57 57 57
59: 30(ptr) AccessChain 51(outnames) 27 56
Store 59 58
60: 16(int) ArrayLength 15(outbname)
62: 61(ptr) AccessChain 51(outnames) 17
Store 62 60
Return
FunctionEnd