Split loop header from condition testing for for/while loops.

This commit is contained in:
Dejan Mircevski 2016-01-20 11:51:43 -05:00
parent 7349eab099
commit 213bbbe4a7
14 changed files with 1905 additions and 1828 deletions

View File

@ -1391,12 +1391,22 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
{
auto blocks = builder.makeNewLoop();
builder.createBranch(&blocks.head);
// Spec requires back edges to target header blocks, and every header block
// must dominate its merge block. Make a header block first to ensure these
// conditions are met. By definition, it will contain OpLoopMerge, followed
// by a block-ending branch. But we don't want to put any other body/test
// instructions in it, since the body/test may have arbitrary instructions,
// including merges of its own.
builder.setBuildPoint(&blocks.head);
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, spv::LoopControlMaskNone);
if (node->testFirst() && node->getTest()) {
builder.setBuildPoint(&blocks.head);
spv::Block& test = builder.makeNewBlock();
builder.createBranch(&test);
builder.setBuildPoint(&test);
node->getTest()->traverse(this);
spv::Id condition =
builder.accessChainLoad(convertGlslangToSpvType(node->getTest()->getType()));
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, spv::LoopControlMaskNone);
builder.createConditionalBranch(condition, &blocks.body, &blocks.merge);
builder.setBuildPoint(&blocks.body);
@ -1411,14 +1421,6 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
node->getTerminal()->traverse(this);
builder.createBranch(&blocks.head);
} else {
// Spec requires back edges to target header blocks, and every header
// block must dominate its merge block. Make a header block first to
// ensure these conditions are met. By definition, it will contain
// OpLoopMerge, followed by a block-ending branch. But we don't want to
// put any other body instructions in it, since the body may have
// arbitrary instructions, including merges of its own.
builder.setBuildPoint(&blocks.head);
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, spv::LoopControlMaskNone);
builder.createBranch(&blocks.body);
breakForLoop.push(true);

View File

@ -8,66 +8,68 @@ Linked vertex stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 39
// Id's are bound by 40
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 24 27 33 38
EntryPoint Vertex 4 "main" 25 28 34 39
Source GLSL 130
Name 4 "main"
Name 8 "i"
Name 24 "colorOut"
Name 27 "color"
Name 33 "gl_Position"
Name 38 "gl_VertexID"
Decorate 33(gl_Position) BuiltIn Position
Decorate 38(gl_VertexID) BuiltIn VertexId
Name 25 "colorOut"
Name 28 "color"
Name 34 "gl_Position"
Name 39 "gl_VertexID"
Decorate 34(gl_Position) BuiltIn Position
Decorate 39(gl_VertexID) BuiltIn VertexId
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 1
15: 6(int) Constant 5
16: TypeBool
18: TypeFloat 32
19: TypeVector 18(float) 4
20: TypeInt 32 0
21: 20(int) Constant 6
22: TypeArray 19(fvec4) 21
23: TypePointer Output 22
24(colorOut): 23(ptr) Variable Output
26: TypePointer Input 19(fvec4)
27(color): 26(ptr) Variable Input
29: TypePointer Output 19(fvec4)
33(gl_Position): 29(ptr) Variable Output
34: 6(int) Constant 2
37: TypePointer Input 6(int)
38(gl_VertexID): 37(ptr) Variable Input
16: 6(int) Constant 5
17: TypeBool
19: TypeFloat 32
20: TypeVector 19(float) 4
21: TypeInt 32 0
22: 21(int) Constant 6
23: TypeArray 20(fvec4) 22
24: TypePointer Output 23
25(colorOut): 24(ptr) Variable Output
27: TypePointer Input 20(fvec4)
28(color): 27(ptr) Variable Input
30: TypePointer Output 20(fvec4)
34(gl_Position): 30(ptr) Variable Output
35: 6(int) Constant 2
38: TypePointer Input 6(int)
39(gl_VertexID): 38(ptr) Variable Input
4(main): 2 Function None 3
5: Label
8(i): 7(ptr) Variable Function
Store 8(i) 9
Branch 10
10: Label
14: 6(int) Load 8(i)
17: 16(bool) SLessThan 14 15
LoopMerge 12 13 None
BranchConditional 17 11 12
Branch 14
14: Label
15: 6(int) Load 8(i)
18: 17(bool) SLessThan 15 16
BranchConditional 18 11 12
11: Label
25: 6(int) Load 8(i)
28: 19(fvec4) Load 27(color)
30: 29(ptr) AccessChain 24(colorOut) 25
Store 30 28
26: 6(int) Load 8(i)
29: 20(fvec4) Load 28(color)
31: 30(ptr) AccessChain 25(colorOut) 26
Store 31 29
Branch 13
13: Label
31: 6(int) Load 8(i)
32: 6(int) IAdd 31 9
Store 8(i) 32
32: 6(int) Load 8(i)
33: 6(int) IAdd 32 9
Store 8(i) 33
Branch 10
12: Label
35: 29(ptr) AccessChain 24(colorOut) 34
36: 19(fvec4) Load 35
Store 33(gl_Position) 36
36: 30(ptr) AccessChain 25(colorOut) 35
37: 20(fvec4) Load 36
Store 34(gl_Position) 37
Return
FunctionEnd

View File

@ -5,86 +5,88 @@ Linked vertex stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 47
// Id's are bound by 48
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 45 46
EntryPoint Vertex 4 "main" 46 47
Source ESSL 300
Name 4 "main"
Name 8 "i"
Name 18 "A"
Name 26 "B"
Name 28 "C"
Name 35 "D"
Name 37 "E"
Name 38 "F"
Name 42 "G"
Name 45 "gl_VertexID"
Name 46 "gl_InstanceID"
Decorate 45(gl_VertexID) BuiltIn VertexId
Decorate 46(gl_InstanceID) BuiltIn InstanceId
Name 19 "A"
Name 27 "B"
Name 29 "C"
Name 36 "D"
Name 38 "E"
Name 39 "F"
Name 43 "G"
Name 46 "gl_VertexID"
Name 47 "gl_InstanceID"
Decorate 46(gl_VertexID) BuiltIn VertexId
Decorate 47(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 0
15: 6(int) Constant 10
16: TypeBool
19: 6(int) Constant 1
21: 6(int) Constant 2
30: 6(int) Constant 3
39: 6(int) Constant 12
43: 6(int) Constant 99
44: TypePointer Input 6(int)
45(gl_VertexID): 44(ptr) Variable Input
46(gl_InstanceID): 44(ptr) Variable Input
16: 6(int) Constant 10
17: TypeBool
20: 6(int) Constant 1
22: 6(int) Constant 2
31: 6(int) Constant 3
40: 6(int) Constant 12
44: 6(int) Constant 99
45: TypePointer Input 6(int)
46(gl_VertexID): 45(ptr) Variable Input
47(gl_InstanceID): 45(ptr) Variable Input
4(main): 2 Function None 3
5: Label
8(i): 7(ptr) Variable Function
18(A): 7(ptr) Variable Function
26(B): 7(ptr) Variable Function
28(C): 7(ptr) Variable Function
35(D): 7(ptr) Variable Function
37(E): 7(ptr) Variable Function
38(F): 7(ptr) Variable Function
42(G): 7(ptr) Variable Function
19(A): 7(ptr) Variable Function
27(B): 7(ptr) Variable Function
29(C): 7(ptr) Variable Function
36(D): 7(ptr) Variable Function
38(E): 7(ptr) Variable Function
39(F): 7(ptr) Variable Function
43(G): 7(ptr) Variable Function
Store 8(i) 9
Branch 10
10: Label
14: 6(int) Load 8(i)
17: 16(bool) SLessThan 14 15
LoopMerge 12 13 None
BranchConditional 17 11 12
Branch 14
14: Label
15: 6(int) Load 8(i)
18: 17(bool) SLessThan 15 16
BranchConditional 18 11 12
11: Label
Store 18(A) 19
20: 6(int) Load 8(i)
22: 6(int) SMod 20 21
23: 16(bool) IEqual 22 9
SelectionMerge 25 None
BranchConditional 23 24 25
24: Label
Store 26(B) 19
Store 19(A) 20
21: 6(int) Load 8(i)
23: 6(int) SMod 21 22
24: 17(bool) IEqual 23 9
SelectionMerge 26 None
BranchConditional 24 25 26
25: Label
Store 27(B) 20
Branch 13
25: Label
29: 6(int) Load 8(i)
31: 6(int) SMod 29 30
32: 16(bool) IEqual 31 9
SelectionMerge 34 None
BranchConditional 32 33 34
33: Label
Store 35(D) 19
26: Label
30: 6(int) Load 8(i)
32: 6(int) SMod 30 31
33: 17(bool) IEqual 32 9
SelectionMerge 35 None
BranchConditional 33 34 35
34: Label
Store 36(D) 20
Branch 12
34: Label
Store 38(F) 39
35: Label
Store 39(F) 40
Branch 13
13: Label
40: 6(int) Load 8(i)
41: 6(int) IAdd 40 19
Store 8(i) 41
41: 6(int) Load 8(i)
42: 6(int) IAdd 41 20
Store 8(i) 42
Branch 10
12: Label
Store 42(G) 43
Store 43(G) 44
Return
FunctionEnd

View File

@ -7,53 +7,55 @@ Linked vertex stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 27
// Id's are bound by 28
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 22 25 26
EntryPoint Vertex 4 "main" 23 26 27
Source GLSL 450
Name 4 "main"
Name 8 "i"
Name 22 "r"
Name 25 "gl_VertexID"
Name 26 "gl_InstanceID"
Decorate 22(r) Location 0
Decorate 25(gl_VertexID) BuiltIn VertexId
Decorate 26(gl_InstanceID) BuiltIn InstanceId
Name 23 "r"
Name 26 "gl_VertexID"
Name 27 "gl_InstanceID"
Decorate 23(r) Location 0
Decorate 26(gl_VertexID) BuiltIn VertexId
Decorate 27(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 0
15: 6(int) Constant 10
16: TypeBool
19: 6(int) Constant 1
21: TypePointer Output 6(int)
22(r): 21(ptr) Variable Output
24: TypePointer Input 6(int)
25(gl_VertexID): 24(ptr) Variable Input
26(gl_InstanceID): 24(ptr) Variable Input
16: 6(int) Constant 10
17: TypeBool
20: 6(int) Constant 1
22: TypePointer Output 6(int)
23(r): 22(ptr) Variable Output
25: TypePointer Input 6(int)
26(gl_VertexID): 25(ptr) Variable Input
27(gl_InstanceID): 25(ptr) Variable Input
4(main): 2 Function None 3
5: Label
8(i): 7(ptr) Variable Function
Store 8(i) 9
Branch 10
10: Label
14: 6(int) Load 8(i)
17: 16(bool) SLessThan 14 15
LoopMerge 12 13 None
BranchConditional 17 11 12
Branch 14
14: Label
15: 6(int) Load 8(i)
18: 17(bool) SLessThan 15 16
BranchConditional 18 11 12
11: Label
Branch 13
13: Label
18: 6(int) Load 8(i)
20: 6(int) IAdd 18 19
Store 8(i) 20
19: 6(int) Load 8(i)
21: 6(int) IAdd 19 20
Store 8(i) 21
Branch 10
12: Label
23: 6(int) Load 8(i)
Store 22(r) 23
24: 6(int) Load 8(i)
Store 23(r) 24
Return
FunctionEnd

View File

@ -5,50 +5,52 @@ Linked vertex stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 26
// Id's are bound by 27
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 24 25
EntryPoint Vertex 4 "main" 25 26
Source ESSL 300
Name 4 "main"
Name 8 "i"
Name 18 "j"
Name 24 "gl_VertexID"
Name 25 "gl_InstanceID"
Decorate 24(gl_VertexID) BuiltIn VertexId
Decorate 25(gl_InstanceID) BuiltIn InstanceId
Name 19 "j"
Name 25 "gl_VertexID"
Name 26 "gl_InstanceID"
Decorate 25(gl_VertexID) BuiltIn VertexId
Decorate 26(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 0
15: 6(int) Constant 10
16: TypeBool
19: 6(int) Constant 12
21: 6(int) Constant 1
23: TypePointer Input 6(int)
24(gl_VertexID): 23(ptr) Variable Input
25(gl_InstanceID): 23(ptr) Variable Input
16: 6(int) Constant 10
17: TypeBool
20: 6(int) Constant 12
22: 6(int) Constant 1
24: TypePointer Input 6(int)
25(gl_VertexID): 24(ptr) Variable Input
26(gl_InstanceID): 24(ptr) Variable Input
4(main): 2 Function None 3
5: Label
8(i): 7(ptr) Variable Function
18(j): 7(ptr) Variable Function
19(j): 7(ptr) Variable Function
Store 8(i) 9
Branch 10
10: Label
14: 6(int) Load 8(i)
17: 16(bool) SLessThan 14 15
LoopMerge 12 13 None
BranchConditional 17 11 12
Branch 14
14: Label
15: 6(int) Load 8(i)
18: 17(bool) SLessThan 15 16
BranchConditional 18 11 12
11: Label
Store 18(j) 19
Store 19(j) 20
Branch 13
13: Label
20: 6(int) Load 8(i)
22: 6(int) IAdd 20 21
Store 8(i) 22
21: 6(int) Load 8(i)
23: 6(int) IAdd 21 22
Store 8(i) 23
Branch 10
12: Label
Return

View File

@ -5,30 +5,30 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 127
// Id's are bound by 132
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 11 36 101
EntryPoint Fragment 4 "main" 11 37 105
ExecutionMode 4 OriginLowerLeft
Source GLSL 130
Name 4 "main"
Name 9 "color"
Name 11 "BaseColor"
Name 15 "i"
Name 23 "Count"
Name 28 "bigColor"
Name 36 "gl_FragColor"
Name 39 "sum"
Name 41 "i"
Name 52 "v4"
Name 62 "i"
Name 69 "tv4"
Name 86 "r"
Name 92 "i"
Name 101 "f"
Name 114 "i"
Name 24 "Count"
Name 29 "bigColor"
Name 37 "gl_FragColor"
Name 40 "sum"
Name 42 "i"
Name 54 "v4"
Name 64 "i"
Name 72 "tv4"
Name 89 "r"
Name 95 "i"
Name 105 "f"
Name 118 "i"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -39,166 +39,176 @@ Linked fragment stage:
13: TypeInt 32 1
14: TypePointer Function 13(int)
16: 13(int) Constant 0
22: TypePointer UniformConstant 13(int)
23(Count): 22(ptr) Variable UniformConstant
25: TypeBool
27: TypePointer UniformConstant 7(fvec4)
28(bigColor): 27(ptr) Variable UniformConstant
33: 13(int) Constant 1
35: TypePointer Output 7(fvec4)
36(gl_FragColor): 35(ptr) Variable Output
38: TypePointer Function 6(float)
40: 6(float) Constant 0
47: 13(int) Constant 4
49: TypeInt 32 0
50: TypeVector 49(int) 4
51: TypePointer UniformConstant 50(ivec4)
52(v4): 51(ptr) Variable UniformConstant
54: TypePointer UniformConstant 49(int)
74: 49(int) Constant 4
87: TypeVector 6(float) 3
100: TypePointer Input 6(float)
101(f): 100(ptr) Variable Input
103: 49(int) Constant 3
120: 13(int) Constant 16
23: TypePointer UniformConstant 13(int)
24(Count): 23(ptr) Variable UniformConstant
26: TypeBool
28: TypePointer UniformConstant 7(fvec4)
29(bigColor): 28(ptr) Variable UniformConstant
34: 13(int) Constant 1
36: TypePointer Output 7(fvec4)
37(gl_FragColor): 36(ptr) Variable Output
39: TypePointer Function 6(float)
41: 6(float) Constant 0
49: 13(int) Constant 4
51: TypeInt 32 0
52: TypeVector 51(int) 4
53: TypePointer UniformConstant 52(ivec4)
54(v4): 53(ptr) Variable UniformConstant
56: TypePointer UniformConstant 51(int)
77: 51(int) Constant 4
90: TypeVector 6(float) 3
104: TypePointer Input 6(float)
105(f): 104(ptr) Variable Input
107: 51(int) Constant 3
125: 13(int) Constant 16
4(main): 2 Function None 3
5: Label
9(color): 8(ptr) Variable Function
15(i): 14(ptr) Variable Function
39(sum): 38(ptr) Variable Function
41(i): 14(ptr) Variable Function
62(i): 14(ptr) Variable Function
69(tv4): 8(ptr) Variable Function
86(r): 8(ptr) Variable Function
92(i): 14(ptr) Variable Function
114(i): 14(ptr) Variable Function
40(sum): 39(ptr) Variable Function
42(i): 14(ptr) Variable Function
64(i): 14(ptr) Variable Function
72(tv4): 8(ptr) Variable Function
89(r): 8(ptr) Variable Function
95(i): 14(ptr) Variable Function
118(i): 14(ptr) Variable Function
12: 7(fvec4) Load 11(BaseColor)
Store 9(color) 12
Store 15(i) 16
Branch 17
17: Label
21: 13(int) Load 15(i)
24: 13(int) Load 23(Count)
26: 25(bool) SLessThan 21 24
LoopMerge 19 20 None
BranchConditional 26 18 19
Branch 21
21: Label
22: 13(int) Load 15(i)
25: 13(int) Load 24(Count)
27: 26(bool) SLessThan 22 25
BranchConditional 27 18 19
18: Label
29: 7(fvec4) Load 28(bigColor)
30: 7(fvec4) Load 9(color)
31: 7(fvec4) FAdd 30 29
Store 9(color) 31
30: 7(fvec4) Load 29(bigColor)
31: 7(fvec4) Load 9(color)
32: 7(fvec4) FAdd 31 30
Store 9(color) 32
Branch 20
20: Label
32: 13(int) Load 15(i)
34: 13(int) IAdd 32 33
Store 15(i) 34
33: 13(int) Load 15(i)
35: 13(int) IAdd 33 34
Store 15(i) 35
Branch 17
19: Label
37: 7(fvec4) Load 9(color)
Store 36(gl_FragColor) 37
Store 39(sum) 40
Store 41(i) 16
Branch 42
42: Label
46: 13(int) Load 41(i)
48: 25(bool) SLessThan 46 47
LoopMerge 44 45 None
BranchConditional 48 43 44
43: Label
53: 13(int) Load 41(i)
55: 54(ptr) AccessChain 52(v4) 53
56: 49(int) Load 55
57: 6(float) ConvertUToF 56
58: 6(float) Load 39(sum)
59: 6(float) FAdd 58 57
Store 39(sum) 59
Branch 45
45: Label
60: 13(int) Load 41(i)
61: 13(int) IAdd 60 33
Store 41(i) 61
Branch 42
44: Label
Store 62(i) 16
Branch 63
63: Label
67: 13(int) Load 62(i)
68: 25(bool) SLessThan 67 47
LoopMerge 65 66 None
BranchConditional 68 64 65
64: Label
70: 13(int) Load 62(i)
71: 13(int) Load 62(i)
72: 54(ptr) AccessChain 52(v4) 71
73: 49(int) Load 72
75: 49(int) IMul 73 74
76: 6(float) ConvertUToF 75
77: 38(ptr) AccessChain 69(tv4) 70
Store 77 76
Branch 66
66: Label
78: 13(int) Load 62(i)
79: 13(int) IAdd 78 33
Store 62(i) 79
Branch 63
38: 7(fvec4) Load 9(color)
Store 37(gl_FragColor) 38
Store 40(sum) 41
Store 42(i) 16
Branch 43
43: Label
LoopMerge 45 46 None
Branch 47
47: Label
48: 13(int) Load 42(i)
50: 26(bool) SLessThan 48 49
BranchConditional 50 44 45
44: Label
55: 13(int) Load 42(i)
57: 56(ptr) AccessChain 54(v4) 55
58: 51(int) Load 57
59: 6(float) ConvertUToF 58
60: 6(float) Load 40(sum)
61: 6(float) FAdd 60 59
Store 40(sum) 61
Branch 46
46: Label
62: 13(int) Load 42(i)
63: 13(int) IAdd 62 34
Store 42(i) 63
Branch 43
45: Label
Store 64(i) 16
Branch 65
65: Label
80: 6(float) Load 39(sum)
81: 7(fvec4) CompositeConstruct 80 80 80 80
82: 7(fvec4) Load 69(tv4)
83: 7(fvec4) FAdd 81 82
84: 7(fvec4) Load 36(gl_FragColor)
85: 7(fvec4) FAdd 84 83
Store 36(gl_FragColor) 85
88: 7(fvec4) Load 11(BaseColor)
89: 87(fvec3) VectorShuffle 88 88 0 1 2
90: 7(fvec4) Load 86(r)
91: 7(fvec4) VectorShuffle 90 89 4 5 6 3
Store 86(r) 91
Store 92(i) 16
Branch 93
93: Label
97: 13(int) Load 92(i)
98: 13(int) Load 23(Count)
99: 25(bool) SLessThan 97 98
LoopMerge 95 96 None
BranchConditional 99 94 95
94: Label
102: 6(float) Load 101(f)
104: 38(ptr) AccessChain 86(r) 103
Store 104 102
LoopMerge 67 68 None
Branch 69
69: Label
70: 13(int) Load 64(i)
71: 26(bool) SLessThan 70 49
BranchConditional 71 66 67
66: Label
73: 13(int) Load 64(i)
74: 13(int) Load 64(i)
75: 56(ptr) AccessChain 54(v4) 74
76: 51(int) Load 75
78: 51(int) IMul 76 77
79: 6(float) ConvertUToF 78
80: 39(ptr) AccessChain 72(tv4) 73
Store 80 79
Branch 68
68: Label
81: 13(int) Load 64(i)
82: 13(int) IAdd 81 34
Store 64(i) 82
Branch 65
67: Label
83: 6(float) Load 40(sum)
84: 7(fvec4) CompositeConstruct 83 83 83 83
85: 7(fvec4) Load 72(tv4)
86: 7(fvec4) FAdd 84 85
87: 7(fvec4) Load 37(gl_FragColor)
88: 7(fvec4) FAdd 87 86
Store 37(gl_FragColor) 88
91: 7(fvec4) Load 11(BaseColor)
92: 90(fvec3) VectorShuffle 91 91 0 1 2
93: 7(fvec4) Load 89(r)
94: 7(fvec4) VectorShuffle 93 92 4 5 6 3
Store 89(r) 94
Store 95(i) 16
Branch 96
96: Label
LoopMerge 98 99 None
Branch 100
100: Label
101: 13(int) Load 95(i)
102: 13(int) Load 24(Count)
103: 26(bool) SLessThan 101 102
BranchConditional 103 97 98
97: Label
106: 6(float) Load 105(f)
108: 39(ptr) AccessChain 89(r) 107
Store 108 106
Branch 99
99: Label
109: 13(int) Load 95(i)
110: 13(int) IAdd 109 34
Store 95(i) 110
Branch 96
96: Label
105: 13(int) Load 92(i)
106: 13(int) IAdd 105 33
Store 92(i) 106
Branch 93
95: Label
107: 7(fvec4) Load 86(r)
108: 87(fvec3) VectorShuffle 107 107 0 1 2
109: 7(fvec4) Load 36(gl_FragColor)
110: 87(fvec3) VectorShuffle 109 109 0 1 2
111: 87(fvec3) FAdd 110 108
112: 7(fvec4) Load 36(gl_FragColor)
113: 7(fvec4) VectorShuffle 112 111 4 5 6 3
Store 36(gl_FragColor) 113
Store 114(i) 16
Branch 115
115: Label
119: 13(int) Load 114(i)
121: 25(bool) SLessThan 119 120
LoopMerge 117 118 None
BranchConditional 121 116 117
116: Label
122: 6(float) Load 101(f)
123: 7(fvec4) Load 36(gl_FragColor)
124: 7(fvec4) VectorTimesScalar 123 122
Store 36(gl_FragColor) 124
Branch 118
118: Label
125: 13(int) Load 114(i)
126: 13(int) IAdd 125 47
Store 114(i) 126
Branch 115
117: Label
98: Label
111: 7(fvec4) Load 89(r)
112: 90(fvec3) VectorShuffle 111 111 0 1 2
113: 7(fvec4) Load 37(gl_FragColor)
114: 90(fvec3) VectorShuffle 113 113 0 1 2
115: 90(fvec3) FAdd 114 112
116: 7(fvec4) Load 37(gl_FragColor)
117: 7(fvec4) VectorShuffle 116 115 4 5 6 3
Store 37(gl_FragColor) 117
Store 118(i) 16
Branch 119
119: Label
LoopMerge 121 122 None
Branch 123
123: Label
124: 13(int) Load 118(i)
126: 26(bool) SLessThan 124 125
BranchConditional 126 120 121
120: Label
127: 6(float) Load 105(f)
128: 7(fvec4) Load 37(gl_FragColor)
129: 7(fvec4) VectorTimesScalar 128 127
Store 37(gl_FragColor) 129
Branch 122
122: Label
130: 13(int) Load 118(i)
131: 13(int) IAdd 130 49
Store 118(i) 131
Branch 119
121: Label
Return
FunctionEnd

View File

@ -8,12 +8,12 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 137
// Id's are bound by 138
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 40 97 107
EntryPoint Fragment 4 "main" 40 98 108
ExecutionMode 4 OriginLowerLeft
Source GLSL 130
Name 4 "main"
@ -38,14 +38,14 @@ Linked fragment stage:
Name 68 "x"
Name 70 "localArray"
Name 75 "i"
Name 83 "a"
Name 89 "condition"
Name 97 "color"
Name 107 "gl_FragColor"
Name 127 "samp2D"
Name 133 "foo"
Name 134 "foo2"
Name 136 "uFloatArray"
Name 84 "a"
Name 90 "condition"
Name 98 "color"
Name 108 "gl_FragColor"
Name 128 "samp2D"
Name 134 "foo"
Name 135 "foo2"
Name 137 "uFloatArray"
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
@ -80,26 +80,26 @@ Linked fragment stage:
48: TypePointer Function 47
52: TypePointer Function 6(int)
69: 6(int) Constant 5
81: 6(int) Constant 16
85: 7(float) Constant 0
89(condition): 20(ptr) Variable UniformConstant
95: 6(int) Constant 3
96: TypePointer Input 9(fvec4)
97(color): 96(ptr) Variable Input
99: TypePointer Function 9(fvec4)
101: 32(int) Constant 1
104: 32(int) Constant 2
106: TypePointer Output 9(fvec4)
107(gl_FragColor): 106(ptr) Variable Output
124: TypeImage 7(float) 2D sampled format:Unknown
125: TypeSampledImage 124
126: TypePointer UniformConstant 125
127(samp2D): 126(ptr) Variable UniformConstant
132: TypePointer UniformConstant 8(s1)
133(foo): 132(ptr) Variable UniformConstant
134(foo2): 17(ptr) Variable UniformConstant
135: TypePointer UniformConstant 34
136(uFloatArray): 135(ptr) Variable UniformConstant
82: 6(int) Constant 16
86: 7(float) Constant 0
90(condition): 20(ptr) Variable UniformConstant
96: 6(int) Constant 3
97: TypePointer Input 9(fvec4)
98(color): 97(ptr) Variable Input
100: TypePointer Function 9(fvec4)
102: 32(int) Constant 1
105: 32(int) Constant 2
107: TypePointer Output 9(fvec4)
108(gl_FragColor): 107(ptr) Variable Output
125: TypeImage 7(float) 2D sampled format:Unknown
126: TypeSampledImage 125
127: TypePointer UniformConstant 126
128(samp2D): 127(ptr) Variable UniformConstant
133: TypePointer UniformConstant 8(s1)
134(foo): 133(ptr) Variable UniformConstant
135(foo2): 17(ptr) Variable UniformConstant
136: TypePointer UniformConstant 34
137(uFloatArray): 136(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
12(locals2): 11(ptr) Variable Function
@ -108,7 +108,7 @@ Linked fragment stage:
68(x): 52(ptr) Variable Function
70(localArray): 35(ptr) Variable Function
75(i): 52(ptr) Variable Function
83(a): 35(ptr) Variable Function
84(a): 35(ptr) Variable Function
18: 17(ptr) AccessChain 15(foo3) 16
19: 10(s2) Load 18
Store 12(locals2) 19
@ -161,57 +161,59 @@ Linked fragment stage:
Store 75(i) 16
Branch 76
76: Label
80: 6(int) Load 75(i)
82: 23(bool) SLessThan 80 81
LoopMerge 78 79 None
BranchConditional 82 77 78
Branch 80
80: Label
81: 6(int) Load 75(i)
83: 23(bool) SLessThan 81 82
BranchConditional 83 77 78
77: Label
84: 6(int) Load 75(i)
86: 30(ptr) AccessChain 83(a) 84
Store 86 85
85: 6(int) Load 75(i)
87: 30(ptr) AccessChain 84(a) 85
Store 87 86
Branch 79
79: Label
87: 6(int) Load 75(i)
88: 6(int) IAdd 87 28
Store 75(i) 88
88: 6(int) Load 75(i)
89: 6(int) IAdd 88 28
Store 75(i) 89
Branch 76
78: Label
90: 6(int) Load 89(condition)
91: 23(bool) IEqual 90 28
SelectionMerge 93 None
BranchConditional 91 92 93
92: Label
94: 34 Load 70(localArray)
Store 83(a) 94
Branch 93
93: Label
98: 9(fvec4) Load 97(color)
100: 99(ptr) AccessChain 12(locals2) 95
Store 100 98
102: 42(ptr) AccessChain 40(coord) 101
103: 7(float) Load 102
105: 30(ptr) AccessChain 12(locals2) 95 104
Store 105 103
108: 99(ptr) AccessChain 12(locals2) 95
109: 9(fvec4) Load 108
110: 30(ptr) AccessChain 36(localFArray) 37
111: 7(float) Load 110
112: 30(ptr) AccessChain 12(locals2) 27 28
113: 7(float) Load 112
114: 7(float) FAdd 111 113
115: 6(int) Load 68(x)
116: 30(ptr) AccessChain 70(localArray) 115
117: 7(float) Load 116
118: 7(float) FAdd 114 117
119: 6(int) Load 68(x)
120: 30(ptr) AccessChain 83(a) 119
121: 7(float) Load 120
122: 7(float) FAdd 118 121
123: 9(fvec4) VectorTimesScalar 109 122
128: 125 Load 127(samp2D)
129: 38(fvec2) Load 40(coord)
130: 9(fvec4) ImageSampleImplicitLod 128 129
131: 9(fvec4) FMul 123 130
Store 107(gl_FragColor) 131
91: 6(int) Load 90(condition)
92: 23(bool) IEqual 91 28
SelectionMerge 94 None
BranchConditional 92 93 94
93: Label
95: 34 Load 70(localArray)
Store 84(a) 95
Branch 94
94: Label
99: 9(fvec4) Load 98(color)
101: 100(ptr) AccessChain 12(locals2) 96
Store 101 99
103: 42(ptr) AccessChain 40(coord) 102
104: 7(float) Load 103
106: 30(ptr) AccessChain 12(locals2) 96 105
Store 106 104
109: 100(ptr) AccessChain 12(locals2) 96
110: 9(fvec4) Load 109
111: 30(ptr) AccessChain 36(localFArray) 37
112: 7(float) Load 111
113: 30(ptr) AccessChain 12(locals2) 27 28
114: 7(float) Load 113
115: 7(float) FAdd 112 114
116: 6(int) Load 68(x)
117: 30(ptr) AccessChain 70(localArray) 116
118: 7(float) Load 117
119: 7(float) FAdd 115 118
120: 6(int) Load 68(x)
121: 30(ptr) AccessChain 84(a) 120
122: 7(float) Load 121
123: 7(float) FAdd 119 122
124: 9(fvec4) VectorTimesScalar 110 123
129: 126 Load 128(samp2D)
130: 38(fvec2) Load 40(coord)
131: 9(fvec4) ImageSampleImplicitLod 129 130
132: 9(fvec4) FMul 124 131
Store 108(gl_FragColor) 132
Return
FunctionEnd

File diff suppressed because it is too large Load Diff

View File

@ -7,12 +7,12 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 187
// Id's are bound by 188
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 11 140
EntryPoint Fragment 4 "main" 11 141
ExecutionMode 4 OriginLowerLeft
Source GLSL 130
Name 4 "main"
@ -20,51 +20,51 @@ Linked fragment stage:
Name 11 "BaseColor"
Name 18 "bigColor4"
Name 28 "d4"
Name 80 "d13"
Name 140 "gl_FragColor"
Name 142 "bigColor"
Name 143 "bigColor1_1"
Name 144 "bigColor1_2"
Name 145 "bigColor1_3"
Name 146 "bigColor2"
Name 147 "bigColor3"
Name 148 "bigColor5"
Name 149 "bigColor6"
Name 150 "bigColor7"
Name 151 "bigColor8"
Name 152 "d"
Name 153 "d2"
Name 154 "d3"
Name 155 "d5"
Name 156 "d6"
Name 157 "d7"
Name 158 "d8"
Name 159 "d9"
Name 160 "d10"
Name 161 "d11"
Name 162 "d12"
Name 163 "d14"
Name 164 "d15"
Name 165 "d16"
Name 166 "d17"
Name 167 "d18"
Name 168 "d19"
Name 169 "d20"
Name 170 "d21"
Name 171 "d22"
Name 172 "d23"
Name 173 "d24"
Name 174 "d25"
Name 175 "d26"
Name 176 "d27"
Name 177 "d28"
Name 178 "d29"
Name 179 "d30"
Name 180 "d31"
Name 181 "d32"
Name 182 "d33"
Name 183 "d34"
Name 186 "Count"
Name 81 "d13"
Name 141 "gl_FragColor"
Name 143 "bigColor"
Name 144 "bigColor1_1"
Name 145 "bigColor1_2"
Name 146 "bigColor1_3"
Name 147 "bigColor2"
Name 148 "bigColor3"
Name 149 "bigColor5"
Name 150 "bigColor6"
Name 151 "bigColor7"
Name 152 "bigColor8"
Name 153 "d"
Name 154 "d2"
Name 155 "d3"
Name 156 "d5"
Name 157 "d6"
Name 158 "d7"
Name 159 "d8"
Name 160 "d9"
Name 161 "d10"
Name 162 "d11"
Name 163 "d12"
Name 164 "d14"
Name 165 "d15"
Name 166 "d16"
Name 167 "d17"
Name 168 "d18"
Name 169 "d19"
Name 170 "d20"
Name 171 "d21"
Name 172 "d22"
Name 173 "d23"
Name 174 "d24"
Name 175 "d25"
Name 176 "d26"
Name 177 "d27"
Name 178 "d28"
Name 179 "d29"
Name 180 "d30"
Name 181 "d31"
Name 182 "d32"
Name 183 "d33"
Name 184 "d34"
Name 187 "Count"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -84,55 +84,55 @@ Linked fragment stage:
35: 22(int) Constant 2
48: 6(float) Constant 1065353216
51: 22(int) Constant 1
77: 22(int) Constant 3
80(d13): 27(ptr) Variable UniformConstant
139: TypePointer Output 7(fvec4)
140(gl_FragColor): 139(ptr) Variable Output
142(bigColor): 17(ptr) Variable UniformConstant
143(bigColor1_1): 17(ptr) Variable UniformConstant
144(bigColor1_2): 17(ptr) Variable UniformConstant
145(bigColor1_3): 17(ptr) Variable UniformConstant
146(bigColor2): 17(ptr) Variable UniformConstant
147(bigColor3): 17(ptr) Variable UniformConstant
148(bigColor5): 17(ptr) Variable UniformConstant
149(bigColor6): 17(ptr) Variable UniformConstant
150(bigColor7): 17(ptr) Variable UniformConstant
151(bigColor8): 17(ptr) Variable UniformConstant
152(d): 27(ptr) Variable UniformConstant
153(d2): 27(ptr) Variable UniformConstant
154(d3): 27(ptr) Variable UniformConstant
155(d5): 27(ptr) Variable UniformConstant
156(d6): 27(ptr) Variable UniformConstant
157(d7): 27(ptr) Variable UniformConstant
158(d8): 27(ptr) Variable UniformConstant
159(d9): 27(ptr) Variable UniformConstant
160(d10): 27(ptr) Variable UniformConstant
161(d11): 27(ptr) Variable UniformConstant
162(d12): 27(ptr) Variable UniformConstant
163(d14): 27(ptr) Variable UniformConstant
164(d15): 27(ptr) Variable UniformConstant
165(d16): 27(ptr) Variable UniformConstant
166(d17): 27(ptr) Variable UniformConstant
167(d18): 27(ptr) Variable UniformConstant
168(d19): 27(ptr) Variable UniformConstant
169(d20): 27(ptr) Variable UniformConstant
170(d21): 27(ptr) Variable UniformConstant
171(d22): 27(ptr) Variable UniformConstant
172(d23): 27(ptr) Variable UniformConstant
173(d24): 27(ptr) Variable UniformConstant
174(d25): 27(ptr) Variable UniformConstant
175(d26): 27(ptr) Variable UniformConstant
176(d27): 27(ptr) Variable UniformConstant
177(d28): 27(ptr) Variable UniformConstant
178(d29): 27(ptr) Variable UniformConstant
179(d30): 27(ptr) Variable UniformConstant
180(d31): 27(ptr) Variable UniformConstant
181(d32): 27(ptr) Variable UniformConstant
182(d33): 27(ptr) Variable UniformConstant
183(d34): 27(ptr) Variable UniformConstant
184: TypeInt 32 1
185: TypePointer UniformConstant 184(int)
186(Count): 185(ptr) Variable UniformConstant
78: 22(int) Constant 3
81(d13): 27(ptr) Variable UniformConstant
140: TypePointer Output 7(fvec4)
141(gl_FragColor): 140(ptr) Variable Output
143(bigColor): 17(ptr) Variable UniformConstant
144(bigColor1_1): 17(ptr) Variable UniformConstant
145(bigColor1_2): 17(ptr) Variable UniformConstant
146(bigColor1_3): 17(ptr) Variable UniformConstant
147(bigColor2): 17(ptr) Variable UniformConstant
148(bigColor3): 17(ptr) Variable UniformConstant
149(bigColor5): 17(ptr) Variable UniformConstant
150(bigColor6): 17(ptr) Variable UniformConstant
151(bigColor7): 17(ptr) Variable UniformConstant
152(bigColor8): 17(ptr) Variable UniformConstant
153(d): 27(ptr) Variable UniformConstant
154(d2): 27(ptr) Variable UniformConstant
155(d3): 27(ptr) Variable UniformConstant
156(d5): 27(ptr) Variable UniformConstant
157(d6): 27(ptr) Variable UniformConstant
158(d7): 27(ptr) Variable UniformConstant
159(d8): 27(ptr) Variable UniformConstant
160(d9): 27(ptr) Variable UniformConstant
161(d10): 27(ptr) Variable UniformConstant
162(d11): 27(ptr) Variable UniformConstant
163(d12): 27(ptr) Variable UniformConstant
164(d14): 27(ptr) Variable UniformConstant
165(d15): 27(ptr) Variable UniformConstant
166(d16): 27(ptr) Variable UniformConstant
167(d17): 27(ptr) Variable UniformConstant
168(d18): 27(ptr) Variable UniformConstant
169(d19): 27(ptr) Variable UniformConstant
170(d20): 27(ptr) Variable UniformConstant
171(d21): 27(ptr) Variable UniformConstant
172(d22): 27(ptr) Variable UniformConstant
173(d23): 27(ptr) Variable UniformConstant
174(d24): 27(ptr) Variable UniformConstant
175(d25): 27(ptr) Variable UniformConstant
176(d26): 27(ptr) Variable UniformConstant
177(d27): 27(ptr) Variable UniformConstant
178(d28): 27(ptr) Variable UniformConstant
179(d29): 27(ptr) Variable UniformConstant
180(d30): 27(ptr) Variable UniformConstant
181(d31): 27(ptr) Variable UniformConstant
182(d32): 27(ptr) Variable UniformConstant
183(d33): 27(ptr) Variable UniformConstant
184(d34): 27(ptr) Variable UniformConstant
185: TypeInt 32 1
186: TypePointer UniformConstant 185(int)
187(Count): 186(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
9(color): 8(ptr) Variable Function
@ -207,95 +207,97 @@ Linked fragment stage:
15: Label
Branch 73
73: Label
78: 24(ptr) AccessChain 9(color) 77
79: 6(float) Load 78
81: 6(float) Load 80(d13)
82: 30(bool) FOrdLessThan 79 81
LoopMerge 75 76 None
BranchConditional 82 74 75
Branch 77
77: Label
79: 24(ptr) AccessChain 9(color) 78
80: 6(float) Load 79
82: 6(float) Load 81(d13)
83: 30(bool) FOrdLessThan 80 82
BranchConditional 83 74 75
74: Label
83: 24(ptr) AccessChain 9(color) 35
84: 6(float) Load 83
85: 6(float) Load 80(d13)
86: 30(bool) FOrdLessThan 84 85
SelectionMerge 88 None
BranchConditional 86 87 92
87: Label
89: 7(fvec4) Load 9(color)
90: 7(fvec4) CompositeConstruct 48 48 48 48
91: 7(fvec4) FAdd 89 90
Store 9(color) 91
Branch 88
92: Label
93: 7(fvec4) Load 9(color)
94: 7(fvec4) CompositeConstruct 48 48 48 48
95: 7(fvec4) FSub 93 94
Store 9(color) 95
Branch 88
88: Label
96: 7(fvec4) Load 18(bigColor4)
97: 7(fvec4) Load 9(color)
98: 7(fvec4) FAdd 97 96
Store 9(color) 98
99: 24(ptr) AccessChain 9(color) 23
100: 6(float) Load 99
101: 6(float) Load 28(d4)
102: 30(bool) FOrdLessThan 100 101
SelectionMerge 104 None
BranchConditional 102 103 104
103: Label
105: 24(ptr) AccessChain 9(color) 35
106: 6(float) Load 105
107: 6(float) FAdd 106 34
108: 24(ptr) AccessChain 9(color) 35
Store 108 107
84: 24(ptr) AccessChain 9(color) 35
85: 6(float) Load 84
86: 6(float) Load 81(d13)
87: 30(bool) FOrdLessThan 85 86
SelectionMerge 89 None
BranchConditional 87 88 93
88: Label
90: 7(fvec4) Load 9(color)
91: 7(fvec4) CompositeConstruct 48 48 48 48
92: 7(fvec4) FAdd 90 91
Store 9(color) 92
Branch 89
93: Label
94: 7(fvec4) Load 9(color)
95: 7(fvec4) CompositeConstruct 48 48 48 48
96: 7(fvec4) FSub 94 95
Store 9(color) 96
Branch 89
89: Label
97: 7(fvec4) Load 18(bigColor4)
98: 7(fvec4) Load 9(color)
99: 7(fvec4) FAdd 98 97
Store 9(color) 99
100: 24(ptr) AccessChain 9(color) 23
101: 6(float) Load 100
102: 6(float) Load 28(d4)
103: 30(bool) FOrdLessThan 101 102
SelectionMerge 105 None
BranchConditional 103 104 105
104: Label
106: 24(ptr) AccessChain 9(color) 35
107: 6(float) Load 106
108: 6(float) FAdd 107 34
109: 24(ptr) AccessChain 9(color) 35
110: 6(float) Load 109
111: 6(float) Load 28(d4)
112: 30(bool) FOrdLessThan 110 111
SelectionMerge 114 None
BranchConditional 112 113 114
113: Label
115: 24(ptr) AccessChain 9(color) 23
116: 6(float) Load 115
117: 6(float) FAdd 116 48
Store 115 117
Store 109 108
110: 24(ptr) AccessChain 9(color) 35
111: 6(float) Load 110
112: 6(float) Load 28(d4)
113: 30(bool) FOrdLessThan 111 112
SelectionMerge 115 None
BranchConditional 113 114 115
114: Label
116: 24(ptr) AccessChain 9(color) 23
117: 6(float) Load 116
118: 6(float) FAdd 117 48
Store 116 118
Branch 76
114: Label
Branch 104
104: Label
119: 24(ptr) AccessChain 9(color) 51
120: 6(float) Load 119
121: 6(float) Load 28(d4)
122: 30(bool) FOrdLessThan 120 121
SelectionMerge 124 None
BranchConditional 122 123 130
123: Label
125: 6(float) Load 28(d4)
126: 24(ptr) AccessChain 9(color) 51
127: 6(float) Load 126
128: 6(float) FAdd 127 125
129: 24(ptr) AccessChain 9(color) 51
Store 129 128
Branch 124
130: Label
131: 6(float) Load 28(d4)
132: 24(ptr) AccessChain 9(color) 23
133: 6(float) Load 132
134: 6(float) FAdd 133 131
135: 24(ptr) AccessChain 9(color) 23
Store 135 134
Branch 124
124: Label
115: Label
Branch 105
105: Label
120: 24(ptr) AccessChain 9(color) 51
121: 6(float) Load 120
122: 6(float) Load 28(d4)
123: 30(bool) FOrdLessThan 121 122
SelectionMerge 125 None
BranchConditional 123 124 131
124: Label
126: 6(float) Load 28(d4)
127: 24(ptr) AccessChain 9(color) 51
128: 6(float) Load 127
129: 6(float) FAdd 128 126
130: 24(ptr) AccessChain 9(color) 51
Store 130 129
Branch 125
131: Label
132: 6(float) Load 28(d4)
133: 24(ptr) AccessChain 9(color) 23
134: 6(float) Load 133
135: 6(float) FAdd 134 132
136: 24(ptr) AccessChain 9(color) 23
Store 136 135
Branch 125
125: Label
Branch 76
76: Label
Branch 73
75: Label
136: 7(fvec4) Load 9(color)
137: 7(fvec4) CompositeConstruct 48 48 48 48
138: 7(fvec4) FAdd 136 137
Store 9(color) 138
141: 7(fvec4) Load 9(color)
Store 140(gl_FragColor) 141
137: 7(fvec4) Load 9(color)
138: 7(fvec4) CompositeConstruct 48 48 48 48
139: 7(fvec4) FAdd 137 138
Store 9(color) 139
142: 7(fvec4) Load 9(color)
Store 141(gl_FragColor) 142
Return
FunctionEnd

View File

@ -10,12 +10,12 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 267
// Id's are bound by 269
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 75 225
EntryPoint Fragment 4 "main" 75 227
ExecutionMode 4 OriginLowerLeft
Source ESSL 310
Name 4 "main"
@ -33,24 +33,24 @@ Linked fragment stage:
Name 75 "x"
Name 129 "d"
Name 155 "i"
Name 174 "j"
Name 225 "color"
Name 231 "v"
Name 232 "param"
Name 175 "j"
Name 227 "color"
Name 233 "v"
Name 234 "param"
Name 236 "param"
Name 244 "param"
Name 238 "param"
Name 246 "param"
Name 248 "param"
Name 250 "param"
Decorate 60(local) RelaxedPrecision
Decorate 62(c) RelaxedPrecision
Decorate 73(f) RelaxedPrecision
Decorate 75(x) RelaxedPrecision
Decorate 129(d) RelaxedPrecision
Decorate 155(i) RelaxedPrecision
Decorate 174(j) RelaxedPrecision
Decorate 225(color) RelaxedPrecision
Decorate 231(v) RelaxedPrecision
Decorate 175(j) RelaxedPrecision
Decorate 227(color) RelaxedPrecision
Decorate 233(v) RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -71,31 +71,31 @@ Linked fragment stage:
75(x): 74(ptr) Variable Input
129(d): 61(ptr) Variable UniformConstant
156: 9(int) Constant 0
162: 9(int) Constant 10
163: TypeBool
175: 9(int) Constant 20
181: 9(int) Constant 30
186: 6(float) Constant 1120429670
206: 6(float) Constant 1079739679
224: TypePointer Output 6(float)
225(color): 224(ptr) Variable Output
230: TypePointer UniformConstant 7(fvec4)
231(v): 230(ptr) Variable UniformConstant
239: TypeInt 32 0
240: 239(int) Constant 1
251: 239(int) Constant 2
163: 9(int) Constant 10
164: TypeBool
176: 9(int) Constant 20
183: 9(int) Constant 30
188: 6(float) Constant 1120429670
208: 6(float) Constant 1079739679
226: TypePointer Output 6(float)
227(color): 226(ptr) Variable Output
232: TypePointer UniformConstant 7(fvec4)
233(v): 232(ptr) Variable UniformConstant
241: TypeInt 32 0
242: 241(int) Constant 1
253: 241(int) Constant 2
4(main): 2 Function None 3
5: Label
60(local): 10(ptr) Variable Function
73(f): 72(ptr) Variable Function
155(i): 10(ptr) Variable Function
174(j): 10(ptr) Variable Function
232(param): 8(ptr) Variable Function
175(j): 10(ptr) Variable Function
234(param): 8(ptr) Variable Function
236(param): 10(ptr) Variable Function
244(param): 8(ptr) Variable Function
236(param): 8(ptr) Variable Function
238(param): 10(ptr) Variable Function
246(param): 8(ptr) Variable Function
248(param): 10(ptr) Variable Function
248(param): 8(ptr) Variable Function
250(param): 10(ptr) Variable Function
63: 9(int) Load 62(c)
Store 60(local) 63
64: 9(int) Load 60(local)
@ -218,134 +218,138 @@ Linked fragment stage:
Store 155(i) 156
Branch 157
157: Label
161: 9(int) Load 155(i)
164: 163(bool) SLessThan 161 162
LoopMerge 159 160 None
BranchConditional 164 158 159
Branch 161
161: Label
162: 9(int) Load 155(i)
165: 164(bool) SLessThan 162 163
BranchConditional 165 158 159
158: Label
165: 9(int) Load 62(c)
SelectionMerge 169 None
Switch 165 168
case 1: 166
case 2: 167
168: Label
200: 6(float) Load 75(x)
201: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 200
202: 6(float) Load 73(f)
203: 6(float) FAdd 202 201
Store 73(f) 203
Branch 169
166: Label
170: 6(float) Load 75(x)
171: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 170
172: 6(float) Load 73(f)
173: 6(float) FAdd 172 171
Store 73(f) 173
Store 174(j) 175
Branch 176
176: Label
180: 9(int) Load 174(j)
182: 163(bool) SLessThan 180 181
LoopMerge 178 179 None
BranchConditional 182 177 178
177: Label
183: 6(float) Load 73(f)
184: 6(float) FAdd 183 48
Store 73(f) 184
185: 6(float) Load 73(f)
187: 163(bool) FOrdLessThan 185 186
SelectionMerge 189 None
BranchConditional 187 188 189
188: Label
Branch 178
189: Label
Branch 179
179: Label
191: 9(int) Load 174(j)
192: 9(int) IAdd 191 65
Store 174(j) 192
Branch 176
178: Label
Branch 169
166: 9(int) Load 62(c)
SelectionMerge 170 None
Switch 166 169
case 1: 167
case 2: 168
169: Label
202: 6(float) Load 75(x)
203: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 202
204: 6(float) Load 73(f)
205: 6(float) FAdd 204 203
Store 73(f) 205
Branch 170
167: Label
194: 6(float) Load 75(x)
195: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 194
196: 6(float) Load 73(f)
197: 6(float) FAdd 196 195
Store 73(f) 197
Branch 169
169: Label
205: 6(float) Load 73(f)
207: 163(bool) FOrdLessThan 205 206
SelectionMerge 209 None
BranchConditional 207 208 209
208: Label
171: 6(float) Load 75(x)
172: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 171
173: 6(float) Load 73(f)
174: 6(float) FAdd 173 172
Store 73(f) 174
Store 175(j) 176
Branch 177
177: Label
LoopMerge 179 180 None
Branch 181
181: Label
182: 9(int) Load 175(j)
184: 164(bool) SLessThan 182 183
BranchConditional 184 178 179
178: Label
185: 6(float) Load 73(f)
186: 6(float) FAdd 185 48
Store 73(f) 186
187: 6(float) Load 73(f)
189: 164(bool) FOrdLessThan 187 188
SelectionMerge 191 None
BranchConditional 189 190 191
190: Label
Branch 179
191: Label
Branch 180
180: Label
193: 9(int) Load 175(j)
194: 9(int) IAdd 193 65
Store 175(j) 194
Branch 177
179: Label
Branch 170
168: Label
196: 6(float) Load 75(x)
197: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 196
198: 6(float) Load 73(f)
199: 6(float) FAdd 198 197
Store 73(f) 199
Branch 170
170: Label
207: 6(float) Load 73(f)
209: 164(bool) FOrdLessThan 207 208
SelectionMerge 211 None
BranchConditional 209 210 211
210: Label
Branch 159
209: Label
211: Label
Branch 160
160: Label
211: 9(int) Load 155(i)
212: 9(int) IAdd 211 65
Store 155(i) 212
213: 9(int) Load 155(i)
214: 9(int) IAdd 213 65
Store 155(i) 214
Branch 157
159: Label
213: 9(int) Load 62(c)
SelectionMerge 216 None
Switch 213 216
case 1: 214
case 2: 215
214: Label
217: 6(float) Load 75(x)
218: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 217
219: 6(float) Load 73(f)
220: 6(float) FAdd 219 218
Store 73(f) 220
Branch 216
215: Label
Branch 216
216: Label
226: 6(float) Load 73(f)
227: 9(int) Load 60(local)
228: 6(float) ConvertSToF 227
229: 6(float) FAdd 226 228
Store 225(color) 229
233: 7(fvec4) Load 231(v)
Store 232(param) 233
235: 7(fvec4) Load 231(v)
215: 9(int) Load 62(c)
SelectionMerge 218 None
Switch 215 218
case 1: 216
case 2: 217
216: Label
219: 6(float) Load 75(x)
220: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 219
221: 6(float) Load 73(f)
222: 6(float) FAdd 221 220
Store 73(f) 222
Branch 218
217: Label
Branch 218
218: Label
228: 6(float) Load 73(f)
229: 9(int) Load 60(local)
230: 6(float) ConvertSToF 229
231: 6(float) FAdd 228 230
Store 227(color) 231
235: 7(fvec4) Load 233(v)
Store 234(param) 235
237: 9(int) Load 62(c)
237: 7(fvec4) Load 233(v)
Store 236(param) 237
238: 7(fvec4) FunctionCall 15(foo1(vf4;vf4;i1;) 232(param) 234(param) 236(param)
241: 6(float) CompositeExtract 238 1
242: 6(float) Load 225(color)
243: 6(float) FAdd 242 241
Store 225(color) 243
245: 7(fvec4) Load 231(v)
Store 244(param) 245
247: 7(fvec4) Load 231(v)
239: 9(int) Load 62(c)
Store 238(param) 239
240: 7(fvec4) FunctionCall 15(foo1(vf4;vf4;i1;) 234(param) 236(param) 238(param)
243: 6(float) CompositeExtract 240 1
244: 6(float) Load 227(color)
245: 6(float) FAdd 244 243
Store 227(color) 245
247: 7(fvec4) Load 233(v)
Store 246(param) 247
249: 9(int) Load 62(c)
249: 7(fvec4) Load 233(v)
Store 248(param) 249
250: 7(fvec4) FunctionCall 20(foo2(vf4;vf4;i1;) 244(param) 246(param) 248(param)
252: 6(float) CompositeExtract 250 2
253: 6(float) Load 225(color)
254: 6(float) FAdd 253 252
Store 225(color) 254
255: 9(int) Load 62(c)
SelectionMerge 258 None
Switch 255 257
case 0: 256
257: Label
Branch 258
256: Label
Branch 258
258: Label
262: 9(int) Load 62(c)
SelectionMerge 264 None
Switch 262 263
263: Label
Branch 264
264: Label
251: 9(int) Load 62(c)
Store 250(param) 251
252: 7(fvec4) FunctionCall 20(foo2(vf4;vf4;i1;) 246(param) 248(param) 250(param)
254: 6(float) CompositeExtract 252 2
255: 6(float) Load 227(color)
256: 6(float) FAdd 255 254
Store 227(color) 256
257: 9(int) Load 62(c)
SelectionMerge 260 None
Switch 257 259
case 0: 258
259: Label
Branch 260
258: Label
Branch 260
260: Label
264: 9(int) Load 62(c)
SelectionMerge 266 None
Switch 264 265
265: Label
Branch 266
266: Label
Return
FunctionEnd
15(foo1(vf4;vf4;i1;): 7(fvec4) Function None 11

View File

@ -5,78 +5,80 @@ Linked vertex stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 43
// Id's are bound by 44
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 41 42
EntryPoint Vertex 4 "main" 42 43
Source ESSL 300
Name 4 "main"
Name 8 "i"
Name 18 "A"
Name 26 "B"
Name 28 "C"
Name 38 "D"
Name 41 "gl_VertexID"
Name 42 "gl_InstanceID"
Decorate 41(gl_VertexID) BuiltIn VertexId
Decorate 42(gl_InstanceID) BuiltIn InstanceId
Name 19 "A"
Name 27 "B"
Name 29 "C"
Name 39 "D"
Name 42 "gl_VertexID"
Name 43 "gl_InstanceID"
Decorate 42(gl_VertexID) BuiltIn VertexId
Decorate 43(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 0
15: 6(int) Constant 10
16: TypeBool
19: 6(int) Constant 1
21: 6(int) Constant 2
30: 6(int) Constant 5
39: 6(int) Constant 3
40: TypePointer Input 6(int)
41(gl_VertexID): 40(ptr) Variable Input
42(gl_InstanceID): 40(ptr) Variable Input
16: 6(int) Constant 10
17: TypeBool
20: 6(int) Constant 1
22: 6(int) Constant 2
31: 6(int) Constant 5
40: 6(int) Constant 3
41: TypePointer Input 6(int)
42(gl_VertexID): 41(ptr) Variable Input
43(gl_InstanceID): 41(ptr) Variable Input
4(main): 2 Function None 3
5: Label
8(i): 7(ptr) Variable Function
18(A): 7(ptr) Variable Function
26(B): 7(ptr) Variable Function
28(C): 7(ptr) Variable Function
38(D): 7(ptr) Variable Function
19(A): 7(ptr) Variable Function
27(B): 7(ptr) Variable Function
29(C): 7(ptr) Variable Function
39(D): 7(ptr) Variable Function
Store 8(i) 9
Branch 10
10: Label
14: 6(int) Load 8(i)
17: 16(bool) SLessThan 14 15
LoopMerge 12 13 None
BranchConditional 17 11 12
Branch 14
14: Label
15: 6(int) Load 8(i)
18: 17(bool) SLessThan 15 16
BranchConditional 18 11 12
11: Label
Store 18(A) 19
20: 6(int) Load 8(i)
22: 6(int) SMod 20 21
23: 16(bool) IEqual 22 9
SelectionMerge 25 None
BranchConditional 23 24 25
24: Label
Store 26(B) 21
Store 19(A) 20
21: 6(int) Load 8(i)
23: 6(int) SMod 21 22
24: 17(bool) IEqual 23 9
SelectionMerge 26 None
BranchConditional 24 25 26
25: Label
Store 27(B) 22
Branch 13
25: Label
29: 6(int) Load 8(i)
31: 6(int) SMod 29 30
32: 16(bool) IEqual 31 9
SelectionMerge 34 None
BranchConditional 32 33 34
33: Label
Store 26(B) 21
26: Label
30: 6(int) Load 8(i)
32: 6(int) SMod 30 31
33: 17(bool) IEqual 32 9
SelectionMerge 35 None
BranchConditional 33 34 35
34: Label
Store 27(B) 22
Branch 12
34: Label
36: 6(int) Load 8(i)
37: 6(int) IAdd 36 19
Store 8(i) 37
35: Label
37: 6(int) Load 8(i)
38: 6(int) IAdd 37 20
Store 8(i) 38
Branch 13
13: Label
Branch 10
12: Label
Store 38(D) 39
Store 39(D) 40
Return
FunctionEnd

View File

@ -5,44 +5,46 @@ Linked vertex stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 24
// Id's are bound by 25
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 22 23
EntryPoint Vertex 4 "main" 23 24
Source ESSL 300
Name 4 "main"
Name 8 "i"
Name 22 "gl_VertexID"
Name 23 "gl_InstanceID"
Decorate 22(gl_VertexID) BuiltIn VertexId
Decorate 23(gl_InstanceID) BuiltIn InstanceId
Name 23 "gl_VertexID"
Name 24 "gl_InstanceID"
Decorate 23(gl_VertexID) BuiltIn VertexId
Decorate 24(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 0
15: 6(int) Constant 10
16: TypeBool
19: 6(int) Constant 1
21: TypePointer Input 6(int)
22(gl_VertexID): 21(ptr) Variable Input
23(gl_InstanceID): 21(ptr) Variable Input
16: 6(int) Constant 10
17: TypeBool
20: 6(int) Constant 1
22: TypePointer Input 6(int)
23(gl_VertexID): 22(ptr) Variable Input
24(gl_InstanceID): 22(ptr) Variable Input
4(main): 2 Function None 3
5: Label
8(i): 7(ptr) Variable Function
Store 8(i) 9
Branch 10
10: Label
14: 6(int) Load 8(i)
17: 16(bool) SLessThan 14 15
LoopMerge 12 13 None
BranchConditional 17 11 12
Branch 14
14: Label
15: 6(int) Load 8(i)
18: 17(bool) SLessThan 15 16
BranchConditional 18 11 12
11: Label
18: 6(int) Load 8(i)
20: 6(int) IAdd 18 19
Store 8(i) 20
19: 6(int) Load 8(i)
21: 6(int) IAdd 19 20
Store 8(i) 21
Branch 13
13: Label
Branch 10

View File

@ -5,20 +5,20 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 35
// Id's are bound by 36
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 11 33
EntryPoint Fragment 4 "main" 11 34
ExecutionMode 4 OriginLowerLeft
Source GLSL 110
Name 4 "main"
Name 9 "color"
Name 11 "BaseColor"
Name 23 "d"
Name 28 "bigColor"
Name 33 "gl_FragColor"
Name 24 "d"
Name 29 "bigColor"
Name 34 "gl_FragColor"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -26,16 +26,16 @@ Linked fragment stage:
8: TypePointer Function 7(fvec4)
10: TypePointer Input 7(fvec4)
11(BaseColor): 10(ptr) Variable Input
17: TypeInt 32 0
18: 17(int) Constant 0
19: TypePointer Function 6(float)
22: TypePointer UniformConstant 6(float)
23(d): 22(ptr) Variable UniformConstant
25: TypeBool
27: TypePointer UniformConstant 7(fvec4)
28(bigColor): 27(ptr) Variable UniformConstant
32: TypePointer Output 7(fvec4)
33(gl_FragColor): 32(ptr) Variable Output
18: TypeInt 32 0
19: 18(int) Constant 0
20: TypePointer Function 6(float)
23: TypePointer UniformConstant 6(float)
24(d): 23(ptr) Variable UniformConstant
26: TypeBool
28: TypePointer UniformConstant 7(fvec4)
29(bigColor): 28(ptr) Variable UniformConstant
33: TypePointer Output 7(fvec4)
34(gl_FragColor): 33(ptr) Variable Output
4(main): 2 Function None 3
5: Label
9(color): 8(ptr) Variable Function
@ -43,22 +43,24 @@ Linked fragment stage:
Store 9(color) 12
Branch 13
13: Label
20: 19(ptr) AccessChain 9(color) 18
21: 6(float) Load 20
24: 6(float) Load 23(d)
26: 25(bool) FOrdLessThan 21 24
LoopMerge 15 16 None
BranchConditional 26 14 15
Branch 17
17: Label
21: 20(ptr) AccessChain 9(color) 19
22: 6(float) Load 21
25: 6(float) Load 24(d)
27: 26(bool) FOrdLessThan 22 25
BranchConditional 27 14 15
14: Label
29: 7(fvec4) Load 28(bigColor)
30: 7(fvec4) Load 9(color)
31: 7(fvec4) FAdd 30 29
Store 9(color) 31
30: 7(fvec4) Load 29(bigColor)
31: 7(fvec4) Load 9(color)
32: 7(fvec4) FAdd 31 30
Store 9(color) 32
Branch 16
16: Label
Branch 13
15: Label
34: 7(fvec4) Load 9(color)
Store 33(gl_FragColor) 34
35: 7(fvec4) Load 9(color)
Store 34(gl_FragColor) 35
Return
FunctionEnd

View File

@ -2,8 +2,5 @@
layout(location=0) out highp int r;
void main() {
int i;
// This infinite loop results in bad SPIR-V generated, since the merge block
// is dropped as unreachable. It is still useful for testing the rest of the
// code generation.
for (i=0; ; i++) { r = i; }
}