Fix back-branch target for do-while loops.

To ensure back branches always go to a header block, create a header
block even for !testFirst loops.  Then unify common code between the
testFirst/!testFirst cases.

Generate the header-block code first, so update golden files.

Realize that certain infinite loops generate invalid SPIR-V, so put a
TODO to instead abort code generation in such cases.

Change-Id: I1e173c8f73daad186cfc666b7d72bd563ed7665d
This commit is contained in:
Dejan Mircevski 2016-01-11 15:57:11 -05:00
parent c8fbbab419
commit 832c65c33b
20 changed files with 2062 additions and 2029 deletions

View File

@ -1342,19 +1342,17 @@ void TGlslangToSpvTraverser::visitConstantUnion(glslang::TIntermConstantUnion* n
bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIntermLoop* node) bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIntermLoop* node)
{ {
auto blocks = builder.makeNewLoop(); auto blocks = builder.makeNewLoop();
builder.createBranch(&blocks.head);
if (node->testFirst() && node->getTest()) { if (node->testFirst() && node->getTest()) {
spv::Block& head = builder.makeNewBlock(); builder.setBuildPoint(&blocks.head);
builder.createBranch(&head);
builder.setBuildPoint(&head);
node->getTest()->traverse(this); node->getTest()->traverse(this);
spv::Id condition = spv::Id condition =
builder.accessChainLoad(convertGlslangToSpvType(node->getTest()->getType())); builder.accessChainLoad(convertGlslangToSpvType(node->getTest()->getType()));
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, spv::LoopControlMaskNone); builder.createLoopMerge(&blocks.merge, &blocks.continue_target, spv::LoopControlMaskNone);
builder.createConditionalBranch(condition, &blocks.body, &blocks.merge); builder.createConditionalBranch(condition, &blocks.body, &blocks.merge);
breakForLoop.push(true);
builder.setBuildPoint(&blocks.body); builder.setBuildPoint(&blocks.body);
breakForLoop.push(true);
if (node->getBody()) if (node->getBody())
node->getBody()->traverse(this); node->getBody()->traverse(this);
builder.createBranch(&blocks.continue_target); builder.createBranch(&blocks.continue_target);
@ -1363,8 +1361,14 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
builder.setBuildPoint(&blocks.continue_target); builder.setBuildPoint(&blocks.continue_target);
if (node->getTerminal()) if (node->getTerminal())
node->getTerminal()->traverse(this); node->getTerminal()->traverse(this);
builder.createBranch(&head); builder.createBranch(&blocks.head);
} else { } else {
// Spec requires back edges to target header blocks, and every header
// block must dominate its merge block. Create an empty header block
// here to ensure these conditions are met even when body contains
// non-trivial control flow.
builder.setBuildPoint(&blocks.head);
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, spv::LoopControlMaskNone);
builder.createBranch(&blocks.body); builder.createBranch(&blocks.body);
breakForLoop.push(true); breakForLoop.push(true);
@ -1381,14 +1385,17 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
node->getTest()->traverse(this); node->getTest()->traverse(this);
spv::Id condition = spv::Id condition =
builder.accessChainLoad(convertGlslangToSpvType(node->getTest()->getType())); builder.accessChainLoad(convertGlslangToSpvType(node->getTest()->getType()));
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, builder.createConditionalBranch(condition, &blocks.head, &blocks.merge);
spv::LoopControlMaskNone);
builder.createConditionalBranch(condition, &blocks.body, &blocks.merge);
} else { } else {
builder.createBranch(&blocks.body); // TODO: unless there was a break instruction somewhere in the body,
// this is an infinite loop, so we should abort code generation with
// a warning. As it stands now, nothing will jump to the merge
// block, and it may be dropped as unreachable by the SPIR-V dumper.
// That, in turn, will result in a non-existing %ID in the LoopMerge
// above.
builder.createBranch(&blocks.head);
} }
} }
builder.setBuildPoint(&blocks.merge); builder.setBuildPoint(&blocks.merge);
builder.closeLoop(); builder.closeLoop();
return false; return false;

View File

@ -1763,7 +1763,7 @@ Block& Builder::makeNewBlock()
Builder::LoopBlocks& Builder::makeNewLoop() Builder::LoopBlocks& Builder::makeNewLoop()
{ {
loops.push({makeNewBlock(), makeNewBlock(), makeNewBlock()}); loops.push({makeNewBlock(), makeNewBlock(), makeNewBlock(), makeNewBlock()});
return loops.top(); return loops.top();
} }

View File

@ -374,7 +374,7 @@ public:
void endSwitch(std::vector<Block*>& segmentBB); void endSwitch(std::vector<Block*>& segmentBB);
struct LoopBlocks { struct LoopBlocks {
Block &body, &merge, &continue_target; Block &head, &body, &merge, &continue_target;
}; };
// Start a new loop and prepare the builder to generate code for it. Until // Start a new loop and prepare the builder to generate code for it. Until

View File

@ -48,26 +48,26 @@ Linked vertex stage:
5: Label 5: Label
8(i): 7(ptr) Variable Function 8(i): 7(ptr) Variable Function
Store 8(i) 9 Store 8(i) 9
Branch 13 Branch 10
10: Label 10: Label
25: 6(int) Load 8(i) 14: 6(int) Load 8(i)
28: 19(fvec4) Load 27(color) 17: 16(bool) SLessThan 14 15
30: 29(ptr) AccessChain 24(colorOut) 25 LoopMerge 12 13 None
Store 30 28 BranchConditional 17 11 12
Branch 12 11: Label
11: Label 25: 6(int) Load 8(i)
28: 19(fvec4) Load 27(color)
30: 29(ptr) AccessChain 24(colorOut) 25
Store 30 28
Branch 13
12: Label
35: 29(ptr) AccessChain 24(colorOut) 34 35: 29(ptr) AccessChain 24(colorOut) 34
36: 19(fvec4) Load 35 36: 19(fvec4) Load 35
Store 33(gl_Position) 36 Store 33(gl_Position) 36
Return Return
12: Label 13: Label
31: 6(int) Load 8(i) 31: 6(int) Load 8(i)
32: 6(int) IAdd 31 9 32: 6(int) IAdd 31 9
Store 8(i) 32 Store 8(i) 32
Branch 13 Branch 10
13: Label FunctionEnd
14: 6(int) Load 8(i)
17: 16(bool) SLessThan 14 15
LoopMerge 11 12 None
BranchConditional 17 10 11
FunctionEnd

View File

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

View File

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

View File

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

View File

@ -51,46 +51,46 @@ Linked vertex stage:
38(F): 7(ptr) Variable Function 38(F): 7(ptr) Variable Function
42(G): 7(ptr) Variable Function 42(G): 7(ptr) Variable Function
Store 8(i) 9 Store 8(i) 9
Branch 13 Branch 10
10: Label 10: Label
Store 18(A) 19 14: 6(int) Load 8(i)
20: 6(int) Load 8(i) 17: 16(bool) SLessThan 14 15
22: 6(int) SMod 20 21 LoopMerge 12 13 None
23: 16(bool) IEqual 22 9 BranchConditional 17 11 12
SelectionMerge 25 None
BranchConditional 23 24 25
11: Label 11: Label
Store 42(G) 43 Store 18(A) 19
Return 20: 6(int) Load 8(i)
12: Label 22: 6(int) SMod 20 21
40: 6(int) Load 8(i) 23: 16(bool) IEqual 22 9
41: 6(int) IAdd 40 19 SelectionMerge 25 None
Store 8(i) 41 BranchConditional 23 24 25
Branch 13 12: Label
13: Label Store 42(G) 43
14: 6(int) Load 8(i) Return
17: 16(bool) SLessThan 14 15 13: Label
LoopMerge 11 12 None 40: 6(int) Load 8(i)
BranchConditional 17 10 11 41: 6(int) IAdd 40 19
Store 8(i) 41
Branch 10
24: Label 24: Label
Store 26(B) 19 Store 26(B) 19
Branch 12 Branch 13
27: Label 27: Label
Store 28(C) 19 Store 28(C) 19
Branch 25 Branch 25
25: Label 25: Label
29: 6(int) Load 8(i) 29: 6(int) Load 8(i)
31: 6(int) SMod 29 30 31: 6(int) SMod 29 30
32: 16(bool) IEqual 31 9 32: 16(bool) IEqual 31 9
SelectionMerge 34 None SelectionMerge 34 None
BranchConditional 32 33 34 BranchConditional 32 33 34
33: Label 33: Label
Store 35(D) 19 Store 35(D) 19
Branch 11
36: Label
Store 37(E) 19
Branch 34
34: Label
Store 38(F) 39
Branch 12 Branch 12
FunctionEnd 36: Label
Store 37(E) 19
Branch 34
34: Label
Store 38(F) 39
Branch 13
FunctionEnd

View File

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

View File

@ -1,50 +1,53 @@
spv.for-notest.vert spv.for-notest.vert
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing. Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
Linked vertex stage: Linked vertex stage:
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 22 // Id's are bound by 23
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 14 20 21 EntryPoint Vertex 4 "main" 15 21 22
Source GLSL 450 Source GLSL 450
Name 4 "main" Name 4 "main"
Name 8 "i" Name 8 "i"
Name 14 "r" Name 15 "r"
Name 20 "gl_VertexID" Name 21 "gl_VertexID"
Name 21 "gl_InstanceID" Name 22 "gl_InstanceID"
Decorate 14(r) Location 0 Decorate 15(r) Location 0
Decorate 20(gl_VertexID) BuiltIn VertexId Decorate 21(gl_VertexID) BuiltIn VertexId
Decorate 21(gl_InstanceID) BuiltIn InstanceId Decorate 22(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 1 6: TypeInt 32 1
7: TypePointer Function 6(int) 7: TypePointer Function 6(int)
9: 6(int) Constant 0 9: 6(int) Constant 0
13: TypePointer Output 6(int) 14: TypePointer Output 6(int)
14(r): 13(ptr) Variable Output 15(r): 14(ptr) Variable Output
17: 6(int) Constant 1 18: 6(int) Constant 1
19: TypePointer Input 6(int) 20: TypePointer Input 6(int)
20(gl_VertexID): 19(ptr) Variable Input 21(gl_VertexID): 20(ptr) Variable Input
21(gl_InstanceID): 19(ptr) Variable Input 22(gl_InstanceID): 20(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
8(i): 7(ptr) Variable Function 8(i): 7(ptr) Variable Function
Store 8(i) 9 Store 8(i) 9
Branch 10 Branch 10
10: Label 10: Label
15: 6(int) Load 8(i) LoopMerge 12 13 None
Store 14(r) 15 Branch 11
Branch 12 11: Label
12: Label 16: 6(int) Load 8(i)
16: 6(int) Load 8(i) Store 15(r) 16
18: 6(int) IAdd 16 17 Branch 13
Store 8(i) 18 13: Label
Branch 10 17: 6(int) Load 8(i)
FunctionEnd 19: 6(int) IAdd 17 18
Store 8(i) 19
Branch 10
FunctionEnd

View File

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

View File

@ -75,31 +75,36 @@ Linked fragment stage:
12: 7(fvec4) Load 11(BaseColor) 12: 7(fvec4) Load 11(BaseColor)
Store 9(color) 12 Store 9(color) 12
Store 15(i) 16 Store 15(i) 16
Branch 20 Branch 17
17: Label 17: Label
29: 7(fvec4) Load 28(bigColor) 21: 13(int) Load 15(i)
30: 7(fvec4) Load 9(color) 24: 13(int) Load 23(Count)
31: 7(fvec4) FAdd 30 29 26: 25(bool) SLessThan 21 24
Store 9(color) 31 LoopMerge 19 20 None
Branch 19 BranchConditional 26 18 19
18: Label 18: Label
29: 7(fvec4) Load 28(bigColor)
30: 7(fvec4) Load 9(color)
31: 7(fvec4) FAdd 30 29
Store 9(color) 31
Branch 20
19: Label
37: 7(fvec4) Load 9(color) 37: 7(fvec4) Load 9(color)
Store 36(gl_FragColor) 37 Store 36(gl_FragColor) 37
Store 39(sum) 40 Store 39(sum) 40
Store 41(i) 16 Store 41(i) 16
Branch 45 Branch 42
19: Label 20: Label
32: 13(int) Load 15(i) 32: 13(int) Load 15(i)
34: 13(int) IAdd 32 33 34: 13(int) IAdd 32 33
Store 15(i) 34 Store 15(i) 34
Branch 20 Branch 17
20: Label 42: Label
21: 13(int) Load 15(i) 46: 13(int) Load 41(i)
24: 13(int) Load 23(Count) 48: 25(bool) SLessThan 46 47
26: 25(bool) SLessThan 21 24 LoopMerge 44 45 None
LoopMerge 18 19 None BranchConditional 48 43 44
BranchConditional 26 17 18 43: Label
42: Label
53: 13(int) Load 41(i) 53: 13(int) Load 41(i)
55: 54(ptr) AccessChain 52(v4) 53 55: 54(ptr) AccessChain 52(v4) 53
56: 49(int) Load 55 56: 49(int) Load 55
@ -107,98 +112,93 @@ Linked fragment stage:
58: 6(float) Load 39(sum) 58: 6(float) Load 39(sum)
59: 6(float) FAdd 58 57 59: 6(float) FAdd 58 57
Store 39(sum) 59 Store 39(sum) 59
Branch 44
43: Label
Store 62(i) 16
Branch 66
44: Label
60: 13(int) Load 41(i)
61: 13(int) IAdd 60 33
Store 41(i) 61
Branch 45 Branch 45
45: Label 44: Label
46: 13(int) Load 41(i) Store 62(i) 16
48: 25(bool) SLessThan 46 47 Branch 63
LoopMerge 43 44 None 45: Label
BranchConditional 48 42 43 60: 13(int) Load 41(i)
63: Label 61: 13(int) IAdd 60 33
70: 13(int) Load 62(i) Store 41(i) 61
71: 13(int) Load 62(i) Branch 42
72: 54(ptr) AccessChain 52(v4) 71 63: Label
73: 49(int) Load 72 67: 13(int) Load 62(i)
75: 49(int) IMul 73 74 68: 25(bool) SLessThan 67 47
76: 6(float) ConvertUToF 75 LoopMerge 65 66 None
77: 38(ptr) AccessChain 69(tv4) 70 BranchConditional 68 64 65
Store 77 76 64: Label
Branch 65 70: 13(int) Load 62(i)
64: Label 71: 13(int) Load 62(i)
80: 6(float) Load 39(sum) 72: 54(ptr) AccessChain 52(v4) 71
81: 7(fvec4) CompositeConstruct 80 80 80 80 73: 49(int) Load 72
82: 7(fvec4) Load 69(tv4) 75: 49(int) IMul 73 74
83: 7(fvec4) FAdd 81 82 76: 6(float) ConvertUToF 75
84: 7(fvec4) Load 36(gl_FragColor) 77: 38(ptr) AccessChain 69(tv4) 70
85: 7(fvec4) FAdd 84 83 Store 77 76
Store 36(gl_FragColor) 85 Branch 66
88: 7(fvec4) Load 11(BaseColor) 65: Label
89: 87(fvec3) VectorShuffle 88 88 0 1 2 80: 6(float) Load 39(sum)
90: 7(fvec4) Load 86(r) 81: 7(fvec4) CompositeConstruct 80 80 80 80
91: 7(fvec4) VectorShuffle 90 89 4 5 6 3 82: 7(fvec4) Load 69(tv4)
Store 86(r) 91 83: 7(fvec4) FAdd 81 82
Store 92(i) 16 84: 7(fvec4) Load 36(gl_FragColor)
Branch 96 85: 7(fvec4) FAdd 84 83
65: Label Store 36(gl_FragColor) 85
78: 13(int) Load 62(i) 88: 7(fvec4) Load 11(BaseColor)
79: 13(int) IAdd 78 33 89: 87(fvec3) VectorShuffle 88 88 0 1 2
Store 62(i) 79 90: 7(fvec4) Load 86(r)
Branch 66 91: 7(fvec4) VectorShuffle 90 89 4 5 6 3
66: Label Store 86(r) 91
67: 13(int) Load 62(i) Store 92(i) 16
68: 25(bool) SLessThan 67 47 Branch 93
LoopMerge 64 65 None 66: Label
BranchConditional 68 63 64 78: 13(int) Load 62(i)
93: Label 79: 13(int) IAdd 78 33
102: 6(float) Load 101(f) Store 62(i) 79
104: 38(ptr) AccessChain 86(r) 103 Branch 63
Store 104 102 93: Label
Branch 95 97: 13(int) Load 92(i)
94: Label 98: 13(int) Load 23(Count)
107: 7(fvec4) Load 86(r) 99: 25(bool) SLessThan 97 98
108: 87(fvec3) VectorShuffle 107 107 0 1 2 LoopMerge 95 96 None
109: 7(fvec4) Load 36(gl_FragColor) BranchConditional 99 94 95
110: 87(fvec3) VectorShuffle 109 109 0 1 2 94: Label
111: 87(fvec3) FAdd 110 108 102: 6(float) Load 101(f)
112: 7(fvec4) Load 36(gl_FragColor) 104: 38(ptr) AccessChain 86(r) 103
113: 7(fvec4) VectorShuffle 112 111 4 5 6 3 Store 104 102
Store 36(gl_FragColor) 113 Branch 96
Store 114(i) 16 95: Label
Branch 118 107: 7(fvec4) Load 86(r)
95: Label 108: 87(fvec3) VectorShuffle 107 107 0 1 2
105: 13(int) Load 92(i) 109: 7(fvec4) Load 36(gl_FragColor)
106: 13(int) IAdd 105 33 110: 87(fvec3) VectorShuffle 109 109 0 1 2
Store 92(i) 106 111: 87(fvec3) FAdd 110 108
Branch 96 112: 7(fvec4) Load 36(gl_FragColor)
96: Label 113: 7(fvec4) VectorShuffle 112 111 4 5 6 3
97: 13(int) Load 92(i) Store 36(gl_FragColor) 113
98: 13(int) Load 23(Count) Store 114(i) 16
99: 25(bool) SLessThan 97 98 Branch 115
LoopMerge 94 95 None 96: Label
BranchConditional 99 93 94 105: 13(int) Load 92(i)
115: Label 106: 13(int) IAdd 105 33
122: 6(float) Load 101(f) Store 92(i) 106
123: 7(fvec4) Load 36(gl_FragColor) Branch 93
124: 7(fvec4) VectorTimesScalar 123 122 115: Label
Store 36(gl_FragColor) 124 119: 13(int) Load 114(i)
Branch 117 121: 25(bool) SLessThan 119 120
116: Label LoopMerge 117 118 None
Return BranchConditional 121 116 117
117: Label 116: Label
125: 13(int) Load 114(i) 122: 6(float) Load 101(f)
126: 13(int) IAdd 125 47 123: 7(fvec4) Load 36(gl_FragColor)
Store 114(i) 126 124: 7(fvec4) VectorTimesScalar 123 122
Branch 118 Store 36(gl_FragColor) 124
118: Label Branch 118
119: 13(int) Load 114(i) 117: Label
121: 25(bool) SLessThan 119 120 Return
LoopMerge 116 117 None 118: Label
BranchConditional 121 115 116 125: 13(int) Load 114(i)
FunctionEnd 126: 13(int) IAdd 125 47
Store 114(i) 126
Branch 115
FunctionEnd

View File

@ -159,59 +159,59 @@ Linked fragment stage:
74: 30(ptr) AccessChain 70(localArray) 71 74: 30(ptr) AccessChain 70(localArray) 71
Store 74 73 Store 74 73
Store 75(i) 16 Store 75(i) 16
Branch 79 Branch 76
76: Label 76: Label
84: 6(int) Load 75(i) 80: 6(int) Load 75(i)
86: 30(ptr) AccessChain 83(a) 84 82: 23(bool) SLessThan 80 81
Store 86 85 LoopMerge 78 79 None
Branch 78 BranchConditional 82 77 78
77: Label 77: Label
84: 6(int) Load 75(i)
86: 30(ptr) AccessChain 83(a) 84
Store 86 85
Branch 79
78: Label
90: 6(int) Load 89(condition) 90: 6(int) Load 89(condition)
91: 23(bool) IEqual 90 28 91: 23(bool) IEqual 90 28
SelectionMerge 93 None SelectionMerge 93 None
BranchConditional 91 92 93 BranchConditional 91 92 93
78: Label 79: Label
87: 6(int) Load 75(i) 87: 6(int) Load 75(i)
88: 6(int) IAdd 87 28 88: 6(int) IAdd 87 28
Store 75(i) 88 Store 75(i) 88
Branch 79 Branch 76
79: Label 92: Label
80: 6(int) Load 75(i) 94: 34 Load 70(localArray)
82: 23(bool) SLessThan 80 81 Store 83(a) 94
LoopMerge 77 78 None Branch 93
BranchConditional 82 76 77 93: Label
92: Label 98: 9(fvec4) Load 97(color)
94: 34 Load 70(localArray) 100: 99(ptr) AccessChain 12(locals2) 95
Store 83(a) 94 Store 100 98
Branch 93 102: 42(ptr) AccessChain 40(coord) 101
93: Label 103: 7(float) Load 102
98: 9(fvec4) Load 97(color) 105: 30(ptr) AccessChain 12(locals2) 95 104
100: 99(ptr) AccessChain 12(locals2) 95 Store 105 103
Store 100 98 108: 99(ptr) AccessChain 12(locals2) 95
102: 42(ptr) AccessChain 40(coord) 101 109: 9(fvec4) Load 108
103: 7(float) Load 102 110: 30(ptr) AccessChain 36(localFArray) 37
105: 30(ptr) AccessChain 12(locals2) 95 104 111: 7(float) Load 110
Store 105 103 112: 30(ptr) AccessChain 12(locals2) 27 28
108: 99(ptr) AccessChain 12(locals2) 95 113: 7(float) Load 112
109: 9(fvec4) Load 108 114: 7(float) FAdd 111 113
110: 30(ptr) AccessChain 36(localFArray) 37 115: 6(int) Load 68(x)
111: 7(float) Load 110 116: 30(ptr) AccessChain 70(localArray) 115
112: 30(ptr) AccessChain 12(locals2) 27 28 117: 7(float) Load 116
113: 7(float) Load 112 118: 7(float) FAdd 114 117
114: 7(float) FAdd 111 113 119: 6(int) Load 68(x)
115: 6(int) Load 68(x) 120: 30(ptr) AccessChain 83(a) 119
116: 30(ptr) AccessChain 70(localArray) 115 121: 7(float) Load 120
117: 7(float) Load 116 122: 7(float) FAdd 118 121
118: 7(float) FAdd 114 117 123: 9(fvec4) VectorTimesScalar 109 122
119: 6(int) Load 68(x) 128: 125 Load 127(samp2D)
120: 30(ptr) AccessChain 83(a) 119 129: 38(fvec2) Load 40(coord)
121: 7(float) Load 120 130: 9(fvec4) ImageSampleImplicitLod 128 129
122: 7(float) FAdd 118 121 131: 9(fvec4) FMul 123 130
123: 9(fvec4) VectorTimesScalar 109 122 Store 107(gl_FragColor) 131
128: 125 Load 127(samp2D) Return
129: 38(fvec2) Load 40(coord) FunctionEnd
130: 9(fvec4) ImageSampleImplicitLod 128 129
131: 9(fvec4) FMul 123 130
Store 107(gl_FragColor) 131
Return
FunctionEnd

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -216,29 +216,29 @@ Linked fragment stage:
Branch 121 Branch 121
121: Label 121: Label
Store 153(i) 154 Store 153(i) 154
Branch 158 Branch 155
155: Label 155: Label
163: 9(int) Load 60(c) 159: 9(int) Load 153(i)
SelectionMerge 167 None 162: 161(bool) SLessThan 159 160
Switch 163 166 LoopMerge 157 158 None
case 1: 164 BranchConditional 162 156 157
case 2: 165
156: Label 156: Label
211: 9(int) Load 60(c) 163: 9(int) Load 60(c)
SelectionMerge 214 None SelectionMerge 167 None
Switch 211 214 Switch 163 166
case 1: 212 case 1: 164
case 2: 213 case 2: 165
157: Label 157: Label
209: 9(int) Load 153(i) 211: 9(int) Load 60(c)
210: 9(int) IAdd 209 63 SelectionMerge 214 None
Store 153(i) 210 Switch 211 214
Branch 158 case 1: 212
158: Label case 2: 213
159: 9(int) Load 153(i) 158: Label
162: 161(bool) SLessThan 159 160 209: 9(int) Load 153(i)
LoopMerge 156 157 None 210: 9(int) IAdd 209 63
BranchConditional 162 155 156 Store 153(i) 210
Branch 155
164: Label 164: Label
168: 6(float) Load 73(x) 168: 6(float) Load 73(x)
169: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 168 169: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 168
@ -246,159 +246,159 @@ Linked fragment stage:
171: 6(float) FAdd 170 169 171: 6(float) FAdd 170 169
Store 71(f) 171 Store 71(f) 171
Store 172(j) 173 Store 172(j) 173
Branch 177 Branch 174
174: Label 174: Label
181: 6(float) Load 71(f) 178: 9(int) Load 172(j)
182: 6(float) FAdd 181 47 180: 161(bool) SLessThan 178 179
Store 71(f) 182 LoopMerge 176 177 None
183: 6(float) Load 71(f) BranchConditional 180 175 176
185: 161(bool) FOrdLessThan 183 184
SelectionMerge 187 None
BranchConditional 185 186 187
175: Label 175: Label
Branch 167 181: 6(float) Load 71(f)
176: Label 182: 6(float) FAdd 181 47
189: 9(int) Load 172(j) Store 71(f) 182
190: 9(int) IAdd 189 63 183: 6(float) Load 71(f)
Store 172(j) 190 185: 161(bool) FOrdLessThan 183 184
Branch 177 SelectionMerge 187 None
177: Label BranchConditional 185 186 187
178: 9(int) Load 172(j) 176: Label
180: 161(bool) SLessThan 178 179 Branch 167
LoopMerge 175 176 None 177: Label
BranchConditional 180 174 175 189: 9(int) Load 172(j)
190: 9(int) IAdd 189 63
Store 172(j) 190
Branch 174
186: Label 186: Label
Branch 175
187: Label
Branch 176 Branch 176
165: Label 187: Label
192: 6(float) Load 73(x) Branch 177
193: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 192 165: Label
194: 6(float) Load 71(f) 192: 6(float) Load 73(x)
195: 6(float) FAdd 194 193 193: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 192
Store 71(f) 195 194: 6(float) Load 71(f)
Branch 167 195: 6(float) FAdd 194 193
166: Label Store 71(f) 195
198: 6(float) Load 73(x) Branch 167
199: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 198 166: Label
200: 6(float) Load 71(f) 198: 6(float) Load 73(x)
201: 6(float) FAdd 200 199 199: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 198
Store 71(f) 201 200: 6(float) Load 71(f)
Branch 167 201: 6(float) FAdd 200 199
167: Label Store 71(f) 201
203: 6(float) Load 71(f) Branch 167
205: 161(bool) FOrdLessThan 203 204 167: Label
SelectionMerge 207 None 203: 6(float) Load 71(f)
BranchConditional 205 206 207 205: 161(bool) FOrdLessThan 203 204
206: Label SelectionMerge 207 None
Branch 156 BranchConditional 205 206 207
207: Label 206: Label
Branch 157 Branch 157
212: Label 207: Label
215: 6(float) Load 73(x) Branch 158
216: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 215 212: Label
217: 6(float) Load 71(f) 215: 6(float) Load 73(x)
218: 6(float) FAdd 217 216 216: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 215
Store 71(f) 218 217: 6(float) Load 71(f)
Branch 214 218: 6(float) FAdd 217 216
213: Label Store 71(f) 218
Branch 214 Branch 214
214: Label 213: Label
224: 6(float) Load 71(f) Branch 214
225: 9(int) Load 58(local) 214: Label
226: 6(float) ConvertSToF 225 224: 6(float) Load 71(f)
227: 6(float) FAdd 224 226 225: 9(int) Load 58(local)
Store 223(color) 227 226: 6(float) ConvertSToF 225
231: 7(fvec4) Load 229(v) 227: 6(float) FAdd 224 226
Store 230(param) 231 Store 223(color) 227
233: 7(fvec4) Load 229(v) 231: 7(fvec4) Load 229(v)
Store 232(param) 233 Store 230(param) 231
235: 9(int) Load 60(c) 233: 7(fvec4) Load 229(v)
Store 234(param) 235 Store 232(param) 233
236: 7(fvec4) FunctionCall 15(foo1(vf4;vf4;i1;) 230(param) 232(param) 234(param) 235: 9(int) Load 60(c)
239: 6(float) CompositeExtract 236 1 Store 234(param) 235
240: 6(float) Load 223(color) 236: 7(fvec4) FunctionCall 15(foo1(vf4;vf4;i1;) 230(param) 232(param) 234(param)
241: 6(float) FAdd 240 239 239: 6(float) CompositeExtract 236 1
Store 223(color) 241 240: 6(float) Load 223(color)
243: 7(fvec4) Load 229(v) 241: 6(float) FAdd 240 239
Store 242(param) 243 Store 223(color) 241
245: 7(fvec4) Load 229(v) 243: 7(fvec4) Load 229(v)
Store 244(param) 245 Store 242(param) 243
247: 9(int) Load 60(c) 245: 7(fvec4) Load 229(v)
Store 246(param) 247 Store 244(param) 245
248: 7(fvec4) FunctionCall 20(foo2(vf4;vf4;i1;) 242(param) 244(param) 246(param) 247: 9(int) Load 60(c)
250: 6(float) CompositeExtract 248 2 Store 246(param) 247
251: 6(float) Load 223(color) 248: 7(fvec4) FunctionCall 20(foo2(vf4;vf4;i1;) 242(param) 244(param) 246(param)
252: 6(float) FAdd 251 250 250: 6(float) CompositeExtract 248 2
Store 223(color) 252 251: 6(float) Load 223(color)
253: 9(int) Load 60(c) 252: 6(float) FAdd 251 250
SelectionMerge 256 None Store 223(color) 252
Switch 253 255 253: 9(int) Load 60(c)
case 0: 254 SelectionMerge 256 None
254: Label Switch 253 255
Branch 256 case 0: 254
255: Label 254: Label
Branch 256 Branch 256
256: Label 255: Label
260: 9(int) Load 60(c) Branch 256
SelectionMerge 262 None 256: Label
Switch 260 261 260: 9(int) Load 60(c)
261: Label SelectionMerge 262 None
Branch 262 Switch 260 261
262: Label 261: Label
Return Branch 262
FunctionEnd 262: Label
15(foo1(vf4;vf4;i1;): 7(fvec4) Function None 11 Return
12(v1): 8(ptr) FunctionParameter FunctionEnd
13(v2): 8(ptr) FunctionParameter 15(foo1(vf4;vf4;i1;): 7(fvec4) Function None 11
14(i1): 10(ptr) FunctionParameter 12(v1): 8(ptr) FunctionParameter
16: Label 13(v2): 8(ptr) FunctionParameter
22: 9(int) Load 14(i1) 14(i1): 10(ptr) FunctionParameter
SelectionMerge 26 None 16: Label
Switch 22 26 22: 9(int) Load 14(i1)
case 0: 23 SelectionMerge 26 None
case 2: 24 Switch 22 26
case 1: 24 case 0: 23
case 3: 25 case 2: 24
23: Label case 1: 24
27: 7(fvec4) Load 12(v1) case 3: 25
ReturnValue 27 23: Label
24: Label 27: 7(fvec4) Load 12(v1)
29: 7(fvec4) Load 13(v2) ReturnValue 27
ReturnValue 29 24: Label
25: Label 29: 7(fvec4) Load 13(v2)
31: 7(fvec4) Load 12(v1) ReturnValue 29
32: 7(fvec4) Load 13(v2) 25: Label
33: 7(fvec4) FMul 31 32 31: 7(fvec4) Load 12(v1)
ReturnValue 33 32: 7(fvec4) Load 13(v2)
26: Label 33: 7(fvec4) FMul 31 32
ReturnValue 37 ReturnValue 33
FunctionEnd 26: Label
20(foo2(vf4;vf4;i1;): 7(fvec4) Function None 11 ReturnValue 37
17(v1): 8(ptr) FunctionParameter FunctionEnd
18(v2): 8(ptr) FunctionParameter 20(foo2(vf4;vf4;i1;): 7(fvec4) Function None 11
19(i1): 10(ptr) FunctionParameter 17(v1): 8(ptr) FunctionParameter
21: Label 18(v2): 8(ptr) FunctionParameter
39: 9(int) Load 19(i1) 19(i1): 10(ptr) FunctionParameter
SelectionMerge 44 None 21: Label
Switch 39 44 39: 9(int) Load 19(i1)
case 0: 40 SelectionMerge 44 None
case 2: 41 Switch 39 44
case 1: 42 case 0: 40
case 3: 43 case 2: 41
40: Label case 1: 42
45: 7(fvec4) Load 17(v1) case 3: 43
ReturnValue 45 40: Label
41: Label 45: 7(fvec4) Load 17(v1)
ReturnValue 48 ReturnValue 45
42: Label 41: Label
50: 7(fvec4) Load 18(v2) ReturnValue 48
ReturnValue 50 42: Label
43: Label 50: 7(fvec4) Load 18(v2)
52: 7(fvec4) Load 17(v1) ReturnValue 50
53: 7(fvec4) Load 18(v2) 43: Label
54: 7(fvec4) FMul 52 53 52: 7(fvec4) Load 17(v1)
ReturnValue 54 53: 7(fvec4) Load 18(v2)
44: Label 54: 7(fvec4) FMul 52 53
ReturnValue 37 ReturnValue 54
FunctionEnd 44: Label
ReturnValue 37
FunctionEnd

View File

@ -44,45 +44,45 @@ Linked vertex stage:
28(C): 7(ptr) Variable Function 28(C): 7(ptr) Variable Function
38(D): 7(ptr) Variable Function 38(D): 7(ptr) Variable Function
Store 8(i) 9 Store 8(i) 9
Branch 13 Branch 10
10: Label 10: Label
Store 18(A) 19 14: 6(int) Load 8(i)
20: 6(int) Load 8(i) 17: 16(bool) SLessThan 14 15
22: 6(int) SMod 20 21 LoopMerge 12 13 None
23: 16(bool) IEqual 22 9 BranchConditional 17 11 12
SelectionMerge 25 None
BranchConditional 23 24 25
11: Label 11: Label
Store 38(D) 39 Store 18(A) 19
Return 20: 6(int) Load 8(i)
12: Label 22: 6(int) SMod 20 21
Branch 13 23: 16(bool) IEqual 22 9
13: Label SelectionMerge 25 None
14: 6(int) Load 8(i) BranchConditional 23 24 25
17: 16(bool) SLessThan 14 15 12: Label
LoopMerge 11 12 None Store 38(D) 39
BranchConditional 17 10 11 Return
13: Label
Branch 10
24: Label 24: Label
Store 26(B) 21 Store 26(B) 21
Branch 12 Branch 13
27: Label 27: Label
Store 28(C) 21 Store 28(C) 21
Branch 25 Branch 25
25: Label 25: Label
29: 6(int) Load 8(i) 29: 6(int) Load 8(i)
31: 6(int) SMod 29 30 31: 6(int) SMod 29 30
32: 16(bool) IEqual 31 9 32: 16(bool) IEqual 31 9
SelectionMerge 34 None SelectionMerge 34 None
BranchConditional 32 33 34 BranchConditional 32 33 34
33: Label 33: Label
Store 26(B) 21 Store 26(B) 21
Branch 11
35: Label
Store 28(C) 21
Branch 34
34: Label
36: 6(int) Load 8(i)
37: 6(int) IAdd 36 19
Store 8(i) 37
Branch 12 Branch 12
FunctionEnd 35: Label
Store 28(C) 21
Branch 34
34: Label
36: 6(int) Load 8(i)
37: 6(int) IAdd 36 19
Store 8(i) 37
Branch 13
FunctionEnd

View File

@ -33,19 +33,19 @@ Linked vertex stage:
5: Label 5: Label
8(i): 7(ptr) Variable Function 8(i): 7(ptr) Variable Function
Store 8(i) 9 Store 8(i) 9
Branch 13 Branch 10
10: Label 10: Label
18: 6(int) Load 8(i)
20: 6(int) IAdd 18 19
Store 8(i) 20
Branch 12
11: Label
Return
12: Label
Branch 13
13: Label
14: 6(int) Load 8(i) 14: 6(int) Load 8(i)
17: 16(bool) SLessThan 14 15 17: 16(bool) SLessThan 14 15
LoopMerge 11 12 None LoopMerge 12 13 None
BranchConditional 17 10 11 BranchConditional 17 11 12
FunctionEnd 11: Label
18: 6(int) Load 8(i)
20: 6(int) IAdd 18 19
Store 8(i) 20
Branch 13
12: Label
Return
13: Label
Branch 10
FunctionEnd

View File

@ -41,24 +41,24 @@ Linked fragment stage:
9(color): 8(ptr) Variable Function 9(color): 8(ptr) Variable Function
12: 7(fvec4) Load 11(BaseColor) 12: 7(fvec4) Load 11(BaseColor)
Store 9(color) 12 Store 9(color) 12
Branch 16 Branch 13
13: Label 13: Label
29: 7(fvec4) Load 28(bigColor)
30: 7(fvec4) Load 9(color)
31: 7(fvec4) FAdd 30 29
Store 9(color) 31
Branch 15
14: Label
34: 7(fvec4) Load 9(color)
Store 33(gl_FragColor) 34
Return
15: Label
Branch 16
16: Label
20: 19(ptr) AccessChain 9(color) 18 20: 19(ptr) AccessChain 9(color) 18
21: 6(float) Load 20 21: 6(float) Load 20
24: 6(float) Load 23(d) 24: 6(float) Load 23(d)
26: 25(bool) FOrdLessThan 21 24 26: 25(bool) FOrdLessThan 21 24
LoopMerge 14 15 None LoopMerge 15 16 None
BranchConditional 26 13 14 BranchConditional 26 14 15
FunctionEnd 14: Label
29: 7(fvec4) Load 28(bigColor)
30: 7(fvec4) Load 9(color)
31: 7(fvec4) FAdd 30 29
Store 9(color) 31
Branch 16
15: Label
34: 7(fvec4) Load 9(color)
Store 33(gl_FragColor) 34
Return
16: Label
Branch 13
FunctionEnd

View File

@ -2,5 +2,8 @@
layout(location=0) out highp int r; layout(location=0) out highp int r;
void main() { void main() {
int i; 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; } for (i=0; ; i++) { r = i; }
} }