Commit 7349eab0 by John Kessenich

Merge pull request #136 from dekimir/no-block-removal

SPV: Don't remove SPIR-V blocks before codegen, use new InReadableOrder instead.
parents 33782795 ed55bcd9
...@@ -1412,9 +1412,11 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn ...@@ -1412,9 +1412,11 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
builder.createBranch(&blocks.head); builder.createBranch(&blocks.head);
} else { } else {
// Spec requires back edges to target header blocks, and every header // Spec requires back edges to target header blocks, and every header
// block must dominate its merge block. Create an empty header block // block must dominate its merge block. Make a header block first to
// here to ensure these conditions are met even when body contains // ensure these conditions are met. By definition, it will contain
// non-trivial control flow. // 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.setBuildPoint(&blocks.head);
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, spv::LoopControlMaskNone); builder.createLoopMerge(&blocks.merge, &blocks.continue_target, spv::LoopControlMaskNone);
builder.createBranch(&blocks.body); builder.createBranch(&blocks.body);
...@@ -1435,12 +1437,9 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn ...@@ -1435,12 +1437,9 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
builder.accessChainLoad(convertGlslangToSpvType(node->getTest()->getType())); builder.accessChainLoad(convertGlslangToSpvType(node->getTest()->getType()));
builder.createConditionalBranch(condition, &blocks.head, &blocks.merge); builder.createConditionalBranch(condition, &blocks.head, &blocks.merge);
} else { } else {
// TODO: unless there was a break instruction somewhere in the body, // TODO: unless there was a break/return/discard instruction
// this is an infinite loop, so we should abort code generation with // somewhere in the body, this is an infinite loop, so we should
// a warning. As it stands now, nothing will jump to the merge // issue a warning.
// 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.createBranch(&blocks.head);
} }
} }
......
...@@ -855,24 +855,10 @@ void Builder::leaveFunction() ...@@ -855,24 +855,10 @@ void Builder::leaveFunction()
// If our function did not contain a return, add a return void now. // If our function did not contain a return, add a return void now.
if (! block->isTerminated()) { if (! block->isTerminated()) {
if (function.getReturnType() == makeVoidType())
// Whether we're in an unreachable (non-entry) block. makeReturn(true);
bool unreachable = function.getEntryBlock() != block && block->getPredecessors().empty(); else {
makeReturn(true, createUndefined(function.getReturnType()));
if (unreachable) {
// Given that this block is at the end of a function, it must be right after an
// explicit return, just remove it.
function.removeBlock(block);
} else {
// We'll add a return instruction at the end of the current block,
// which for a non-void function is really error recovery (?), as the source
// being translated should have had an explicit return, which would have been
// followed by an unreachable block, which was handled above.
if (function.getReturnType() == makeVoidType())
makeReturn(true);
else {
makeReturn(true, createUndefined(function.getReturnType()));
}
} }
} }
} }
......
...@@ -205,12 +205,6 @@ public: ...@@ -205,12 +205,6 @@ public:
void dump(std::vector<unsigned int>& out) const void dump(std::vector<unsigned int>& out) const
{ {
// skip the degenerate unreachable blocks
// TODO: code gen: skip all unreachable blocks (transitive closure)
// (but, until that's done safer to keep non-degenerate unreachable blocks, in case others depend on something)
if (unreachable && instructions.size() <= 2)
return;
instructions[0]->dump(out); instructions[0]->dump(out);
for (int i = 0; i < (int)localVariables.size(); ++i) for (int i = 0; i < (int)localVariables.size(); ++i)
localVariables[i]->dump(out); localVariables[i]->dump(out);
......
...@@ -5,7 +5,7 @@ Linked fragment stage: ...@@ -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 47 // Id's are bound by 48
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
......
...@@ -5,7 +5,7 @@ Linked fragment stage: ...@@ -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 100 // Id's are bound by 101
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
...@@ -23,40 +23,40 @@ Linked fragment stage: ...@@ -23,40 +23,40 @@ Linked fragment stage:
Name 43 "k" Name 43 "k"
Name 55 "sampR" Name 55 "sampR"
Name 63 "sampB" Name 63 "sampB"
Name 86 "samp2Da" Name 87 "samp2Da"
Name 91 "bn" Name 92 "bn"
MemberName 91(bn) 0 "matra" MemberName 92(bn) 0 "matra"
MemberName 91(bn) 1 "matca" MemberName 92(bn) 1 "matca"
MemberName 91(bn) 2 "matr" MemberName 92(bn) 2 "matr"
MemberName 91(bn) 3 "matc" MemberName 92(bn) 3 "matc"
MemberName 91(bn) 4 "matrdef" MemberName 92(bn) 4 "matrdef"
Name 93 "" Name 94 ""
Name 96 "bi" Name 97 "bi"
MemberName 96(bi) 0 "v" MemberName 97(bi) 0 "v"
Name 99 "bname" Name 100 "bname"
Decorate 16(gl_FrontFacing) BuiltIn FrontFacing Decorate 16(gl_FrontFacing) BuiltIn FrontFacing
Decorate 33(gl_ClipDistance) BuiltIn ClipDistance Decorate 33(gl_ClipDistance) BuiltIn ClipDistance
Decorate 89 ArrayStride 64
Decorate 90 ArrayStride 64 Decorate 90 ArrayStride 64
MemberDecorate 91(bn) 0 RowMajor Decorate 91 ArrayStride 64
MemberDecorate 91(bn) 0 Offset 0 MemberDecorate 92(bn) 0 RowMajor
MemberDecorate 91(bn) 0 MatrixStride 16 MemberDecorate 92(bn) 0 Offset 0
MemberDecorate 91(bn) 1 ColMajor MemberDecorate 92(bn) 0 MatrixStride 16
MemberDecorate 91(bn) 1 Offset 256 MemberDecorate 92(bn) 1 ColMajor
MemberDecorate 91(bn) 1 MatrixStride 16 MemberDecorate 92(bn) 1 Offset 256
MemberDecorate 91(bn) 2 RowMajor MemberDecorate 92(bn) 1 MatrixStride 16
MemberDecorate 91(bn) 2 Offset 512 MemberDecorate 92(bn) 2 RowMajor
MemberDecorate 91(bn) 2 MatrixStride 16 MemberDecorate 92(bn) 2 Offset 512
MemberDecorate 91(bn) 3 ColMajor MemberDecorate 92(bn) 2 MatrixStride 16
MemberDecorate 91(bn) 3 Offset 576 MemberDecorate 92(bn) 3 ColMajor
MemberDecorate 91(bn) 3 MatrixStride 16 MemberDecorate 92(bn) 3 Offset 576
MemberDecorate 91(bn) 4 RowMajor MemberDecorate 92(bn) 3 MatrixStride 16
MemberDecorate 91(bn) 4 Offset 640 MemberDecorate 92(bn) 4 RowMajor
MemberDecorate 91(bn) 4 MatrixStride 16 MemberDecorate 92(bn) 4 Offset 640
Decorate 91(bn) Block MemberDecorate 92(bn) 4 MatrixStride 16
Decorate 95 ArrayStride 16 Decorate 92(bn) Block
MemberDecorate 96(bi) 0 Offset 0 Decorate 96 ArrayStride 16
Decorate 96(bi) Block MemberDecorate 97(bi) 0 Offset 0
Decorate 97(bi) Block
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
...@@ -100,24 +100,24 @@ Linked fragment stage: ...@@ -100,24 +100,24 @@ Linked fragment stage:
69: TypeVector 6(float) 2 69: TypeVector 6(float) 2
72: 6(float) Constant 1120403456 72: 6(float) Constant 1120403456
74: 29(int) Constant 3 74: 29(int) Constant 3
82: TypeImage 6(float) 2D sampled format:Unknown 83: TypeImage 6(float) 2D sampled format:Unknown
83: TypeSampledImage 82 84: TypeSampledImage 83
84: TypeArray 83 74 85: TypeArray 84 74
85: TypePointer UniformConstant 84 86: TypePointer UniformConstant 85
86(samp2Da): 85(ptr) Variable UniformConstant 87(samp2Da): 86(ptr) Variable UniformConstant
87: TypeMatrix 26(fvec4) 4 88: TypeMatrix 26(fvec4) 4
88: 29(int) Constant 4 89: 29(int) Constant 4
89: TypeArray 87 88 90: TypeArray 88 89
90: TypeArray 87 88 91: TypeArray 88 89
91(bn): TypeStruct 89 90 87 87 87 92(bn): TypeStruct 90 91 88 88 88
92: TypePointer Uniform 91(bn) 93: TypePointer Uniform 92(bn)
93: 92(ptr) Variable Uniform 94: 93(ptr) Variable Uniform
94: TypeVector 6(float) 3 95: TypeVector 6(float) 3
95: TypeArray 94(fvec3) 50 96: TypeArray 95(fvec3) 50
96(bi): TypeStruct 95 97(bi): TypeStruct 96
97: TypeArray 96(bi) 88 98: TypeArray 97(bi) 89
98: TypePointer Uniform 97 99: TypePointer Uniform 98
99(bname): 98(ptr) Variable Uniform 100(bname): 99(ptr) Variable Uniform
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
13: 12(ptr) Variable Function 13: 12(ptr) Variable Function
......
...@@ -7,86 +7,86 @@ Linked vertex stage: ...@@ -7,86 +7,86 @@ Linked vertex stage:
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 49 // Id's are bound by 50
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 23 47 48 EntryPoint Vertex 4 "main" 24 48 49
Source GLSL 450 Source GLSL 450
Name 4 "main" Name 4 "main"
Name 10 "foo(b1;" Name 10 "foo(b1;"
Name 9 "b" Name 9 "b"
Name 21 "gl_PerVertex" Name 22 "gl_PerVertex"
MemberName 21(gl_PerVertex) 0 "gl_Position" MemberName 22(gl_PerVertex) 0 "gl_Position"
MemberName 21(gl_PerVertex) 1 "gl_PointSize" MemberName 22(gl_PerVertex) 1 "gl_PointSize"
MemberName 21(gl_PerVertex) 2 "gl_ClipDistance" MemberName 22(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 21(gl_PerVertex) 3 "gl_CullDistance" MemberName 22(gl_PerVertex) 3 "gl_CullDistance"
Name 23 "" Name 24 ""
Name 28 "ubname" Name 29 "ubname"
MemberName 28(ubname) 0 "b" MemberName 29(ubname) 0 "b"
Name 30 "ubinst" Name 31 "ubinst"
Name 31 "param" Name 32 "param"
Name 47 "gl_VertexID" Name 48 "gl_VertexID"
Name 48 "gl_InstanceID" Name 49 "gl_InstanceID"
MemberDecorate 21(gl_PerVertex) 0 BuiltIn Position MemberDecorate 22(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 21(gl_PerVertex) 1 BuiltIn PointSize MemberDecorate 22(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 21(gl_PerVertex) 2 BuiltIn ClipDistance MemberDecorate 22(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 21(gl_PerVertex) 3 BuiltIn CullDistance MemberDecorate 22(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 21(gl_PerVertex) Block Decorate 22(gl_PerVertex) Block
Decorate 28(ubname) GLSLShared Decorate 29(ubname) GLSLShared
Decorate 28(ubname) Block Decorate 29(ubname) Block
Decorate 47(gl_VertexID) BuiltIn VertexId Decorate 48(gl_VertexID) BuiltIn VertexId
Decorate 48(gl_InstanceID) BuiltIn InstanceId Decorate 49(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeBool 6: TypeBool
7: TypePointer Function 6(bool) 7: TypePointer Function 6(bool)
8: TypeFunction 6(bool) 7(ptr) 8: TypeFunction 6(bool) 7(ptr)
13: 6(bool) ConstantFalse 13: 6(bool) ConstantFalse
16: TypeFloat 32 17: TypeFloat 32
17: TypeVector 16(float) 4 18: TypeVector 17(float) 4
18: TypeInt 32 0 19: TypeInt 32 0
19: 18(int) Constant 1 20: 19(int) Constant 1
20: TypeArray 16(float) 19 21: TypeArray 17(float) 20
21(gl_PerVertex): TypeStruct 17(fvec4) 16(float) 20 20 22(gl_PerVertex): TypeStruct 18(fvec4) 17(float) 21 21
22: TypePointer Output 21(gl_PerVertex) 23: TypePointer Output 22(gl_PerVertex)
23: 22(ptr) Variable Output 24: 23(ptr) Variable Output
24: TypeInt 32 1 25: TypeInt 32 1
25: 24(int) Constant 0 26: 25(int) Constant 0
26: TypePointer Function 17(fvec4) 27: TypePointer Function 18(fvec4)
28(ubname): TypeStruct 6(bool) 29(ubname): TypeStruct 6(bool)
29: TypePointer Uniform 28(ubname) 30: TypePointer Uniform 29(ubname)
30(ubinst): 29(ptr) Variable Uniform 31(ubinst): 30(ptr) Variable Uniform
32: TypePointer Uniform 6(bool) 33: TypePointer Uniform 6(bool)
38: 16(float) Constant 0 39: 17(float) Constant 0
39: 17(fvec4) ConstantComposite 38 38 38 38 40: 18(fvec4) ConstantComposite 39 39 39 39
41: 16(float) Constant 1065353216 42: 17(float) Constant 1065353216
42: 17(fvec4) ConstantComposite 41 41 41 41 43: 18(fvec4) ConstantComposite 42 42 42 42
44: TypePointer Output 17(fvec4) 45: TypePointer Output 18(fvec4)
46: TypePointer Input 24(int) 47: TypePointer Input 25(int)
47(gl_VertexID): 46(ptr) Variable Input 48(gl_VertexID): 47(ptr) Variable Input
48(gl_InstanceID): 46(ptr) Variable Input 49(gl_InstanceID): 47(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
27: 26(ptr) Variable Function 28: 27(ptr) Variable Function
31(param): 7(ptr) Variable Function 32(param): 7(ptr) Variable Function
33: 32(ptr) AccessChain 30(ubinst) 25 34: 33(ptr) AccessChain 31(ubinst) 26
34: 6(bool) Load 33 35: 6(bool) Load 34
Store 31(param) 34 Store 32(param) 35
35: 6(bool) FunctionCall 10(foo(b1;) 31(param) 36: 6(bool) FunctionCall 10(foo(b1;) 32(param)
SelectionMerge 37 None SelectionMerge 38 None
BranchConditional 35 36 40 BranchConditional 36 37 41
36: Label 37: Label
Store 27 39 Store 28 40
Branch 37 Branch 38
40: Label 41: Label
Store 27 42 Store 28 43
Branch 37 Branch 38
37: Label 38: Label
43: 17(fvec4) Load 27 44: 18(fvec4) Load 28
45: 44(ptr) AccessChain 23 25 46: 45(ptr) AccessChain 24 26
Store 45 43 Store 46 44
Return Return
FunctionEnd FunctionEnd
10(foo(b1;): 6(bool) Function None 8 10(foo(b1;): 6(bool) Function None 8
......
...@@ -50,4 +50,6 @@ Linked vertex stage: ...@@ -50,4 +50,6 @@ Linked vertex stage:
19: 6(int) IAdd 17 18 19: 6(int) IAdd 17 18
Store 8(i) 19 Store 8(i) 19
Branch 10 Branch 10
12: Label
Return
FunctionEnd FunctionEnd
...@@ -5,7 +5,7 @@ Linked fragment stage: ...@@ -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 60 // Id's are bound by 61
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
...@@ -24,13 +24,13 @@ Linked fragment stage: ...@@ -24,13 +24,13 @@ Linked fragment stage:
Name 27 "f" Name 27 "f"
Name 30 "gl_FragColor" Name 30 "gl_FragColor"
Name 36 "d" Name 36 "d"
Name 59 "bigColor" Name 60 "bigColor"
Decorate 18(color) RelaxedPrecision Decorate 18(color) RelaxedPrecision
Decorate 20(BaseColor) RelaxedPrecision Decorate 20(BaseColor) RelaxedPrecision
Decorate 27(f) RelaxedPrecision Decorate 27(f) RelaxedPrecision
Decorate 30(gl_FragColor) RelaxedPrecision Decorate 30(gl_FragColor) RelaxedPrecision
Decorate 36(d) RelaxedPrecision Decorate 36(d) RelaxedPrecision
Decorate 59(bigColor) RelaxedPrecision Decorate 60(bigColor) RelaxedPrecision
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
8: TypeFloat 32 8: TypeFloat 32
...@@ -52,8 +52,8 @@ Linked fragment stage: ...@@ -52,8 +52,8 @@ Linked fragment stage:
49: TypeInt 32 0 49: TypeInt 32 0
50: 49(int) Constant 0 50: 49(int) Constant 0
53: 49(int) Constant 1 53: 49(int) Constant 1
58: TypePointer UniformConstant 12(fvec4) 59: TypePointer UniformConstant 12(fvec4)
59(bigColor): 58(ptr) Variable UniformConstant 60(bigColor): 59(ptr) Variable UniformConstant
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
18(color): 13(ptr) Variable Function 18(color): 13(ptr) Variable Function
......
...@@ -7,12 +7,12 @@ Linked fragment stage: ...@@ -7,12 +7,12 @@ Linked fragment stage:
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 76 // Id's are bound by 77
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 57 68 EntryPoint Fragment 4 "main" 58 69
ExecutionMode 4 OriginLowerLeft ExecutionMode 4 OriginLowerLeft
Source GLSL 130 Source GLSL 130
Name 4 "main" Name 4 "main"
...@@ -22,14 +22,14 @@ Linked fragment stage: ...@@ -22,14 +22,14 @@ Linked fragment stage:
Name 16 "unreachableReturn(" Name 16 "unreachableReturn("
Name 18 "missingReturn(" Name 18 "missingReturn("
Name 21 "h" Name 21 "h"
Name 34 "d" Name 35 "d"
Name 55 "color" Name 56 "color"
Name 57 "BaseColor" Name 58 "BaseColor"
Name 58 "param" Name 59 "param"
Name 63 "f" Name 64 "f"
Name 65 "g" Name 66 "g"
Name 68 "gl_FragColor" Name 69 "gl_FragColor"
Name 75 "bigColor" Name 76 "bigColor"
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
...@@ -44,42 +44,42 @@ Linked fragment stage: ...@@ -44,42 +44,42 @@ Linked fragment stage:
24: 23(int) Constant 0 24: 23(int) Constant 0
25: TypePointer Function 6(float) 25: TypePointer Function 6(float)
28: 23(int) Constant 1 28: 23(int) Constant 1
33: TypePointer UniformConstant 6(float) 34: TypePointer UniformConstant 6(float)
34(d): 33(ptr) Variable UniformConstant 35(d): 34(ptr) Variable UniformConstant
36: 6(float) Constant 1082549862 37: 6(float) Constant 1082549862
37: TypeBool 38: TypeBool
41: 6(float) Constant 1067030938 42: 6(float) Constant 1067030938
44: 6(float) Constant 1083179008 45: 6(float) Constant 1083179008
52: 6(float) Constant 1081711002 53: 6(float) Constant 1081711002
56: TypePointer Input 7(fvec4) 57: TypePointer Input 7(fvec4)
57(BaseColor): 56(ptr) Variable Input 58(BaseColor): 57(ptr) Variable Input
67: TypePointer Output 7(fvec4) 68: TypePointer Output 7(fvec4)
68(gl_FragColor): 67(ptr) Variable Output 69(gl_FragColor): 68(ptr) Variable Output
74: TypePointer UniformConstant 7(fvec4) 75: TypePointer UniformConstant 7(fvec4)
75(bigColor): 74(ptr) Variable UniformConstant 76(bigColor): 75(ptr) Variable UniformConstant
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
55(color): 8(ptr) Variable Function 56(color): 8(ptr) Variable Function
58(param): 8(ptr) Variable Function 59(param): 8(ptr) Variable Function
63(f): 25(ptr) Variable Function 64(f): 25(ptr) Variable Function
65(g): 25(ptr) Variable Function 66(g): 25(ptr) Variable Function
Store 21(h) 22 Store 21(h) 22
59: 7(fvec4) Load 57(BaseColor) 60: 7(fvec4) Load 58(BaseColor)
Store 58(param) 59 Store 59(param) 60
60: 6(float) FunctionCall 11(foo(vf4;) 58(param) 61: 6(float) FunctionCall 11(foo(vf4;) 59(param)
61: 7(fvec4) CompositeConstruct 60 60 60 60 62: 7(fvec4) CompositeConstruct 61 61 61 61
Store 55(color) 61 Store 56(color) 62
62: 2 FunctionCall 13(bar() 63: 2 FunctionCall 13(bar()
64: 6(float) FunctionCall 16(unreachableReturn() 65: 6(float) FunctionCall 16(unreachableReturn()
Store 63(f) 64 Store 64(f) 65
66: 6(float) FunctionCall 18(missingReturn() 67: 6(float) FunctionCall 18(missingReturn()
Store 65(g) 66 Store 66(g) 67
69: 7(fvec4) Load 55(color) 70: 7(fvec4) Load 56(color)
70: 6(float) Load 63(f) 71: 6(float) Load 64(f)
71: 7(fvec4) VectorTimesScalar 69 70 72: 7(fvec4) VectorTimesScalar 70 71
72: 6(float) Load 21(h) 73: 6(float) Load 21(h)
73: 7(fvec4) VectorTimesScalar 71 72 74: 7(fvec4) VectorTimesScalar 72 73
Store 68(gl_FragColor) 73 Store 69(gl_FragColor) 74
Return Return
FunctionEnd FunctionEnd
11(foo(vf4;): 6(float) Function None 9 11(foo(vf4;): 6(float) Function None 9
...@@ -98,29 +98,29 @@ Linked fragment stage: ...@@ -98,29 +98,29 @@ Linked fragment stage:
FunctionEnd FunctionEnd
16(unreachableReturn(): 6(float) Function None 15 16(unreachableReturn(): 6(float) Function None 15
17: Label 17: Label
35: 6(float) Load 34(d) 36: 6(float) Load 35(d)
38: 37(bool) FOrdLessThan 35 36 39: 38(bool) FOrdLessThan 36 37
SelectionMerge 40 None SelectionMerge 41 None
BranchConditional 38 39 43 BranchConditional 39 40 44
39: Label 40: Label
ReturnValue 41 ReturnValue 42
43: Label 44: Label
ReturnValue 44 ReturnValue 45
40: Label 41: Label
46: 6(float) Undef 47: 6(float) Undef
ReturnValue 46 ReturnValue 47
FunctionEnd FunctionEnd
18(missingReturn(): 6(float) Function None 15 18(missingReturn(): 6(float) Function None 15
19: Label 19: Label
47: 6(float) Load 34(d) 48: 6(float) Load 35(d)
48: 37(bool) FOrdLessThan 47 44 49: 38(bool) FOrdLessThan 48 45
SelectionMerge 50 None SelectionMerge 51 None
BranchConditional 48 49 50 BranchConditional 49 50 51
49: Label 50: Label
51: 6(float) Load 34(d) 52: 6(float) Load 35(d)
Store 21(h) 51 Store 21(h) 52
ReturnValue 52 ReturnValue 53
50: Label 51: Label
54: 6(float) Undef 55: 6(float) Undef
ReturnValue 54 ReturnValue 55
FunctionEnd FunctionEnd
...@@ -5,12 +5,12 @@ Linked vertex stage: ...@@ -5,12 +5,12 @@ Linked vertex stage:
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 93 // Id's are bound by 96
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 69 73 92 EntryPoint Vertex 4 "main" 72 76 95
Source GLSL 130 Source GLSL 130
Name 4 "main" Name 4 "main"
Name 14 "xf(mf33;vf3;" Name 14 "xf(mf33;vf3;"
...@@ -21,18 +21,18 @@ Linked vertex stage: ...@@ -21,18 +21,18 @@ Linked vertex stage:
Name 26 "mxv(mf44;vf3;" Name 26 "mxv(mf44;vf3;"
Name 24 "m4" Name 24 "m4"
Name 25 "v" Name 25 "v"
Name 63 "param" Name 65 "param"
Name 69 "gl_Position" Name 72 "gl_Position"
Name 71 "m4" Name 74 "m4"
Name 73 "v3" Name 76 "v3"
Name 74 "param" Name 77 "param"
Name 76 "param" Name 79 "param"
Name 80 "m3" Name 83 "m3"
Name 81 "param" Name 84 "param"
Name 83 "param" Name 86 "param"
Name 92 "gl_VertexID" Name 95 "gl_VertexID"
Decorate 69(gl_Position) BuiltIn Position Decorate 72(gl_Position) BuiltIn Position
Decorate 92(gl_VertexID) BuiltIn VertexId Decorate 95(gl_VertexID) BuiltIn VertexId
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
...@@ -46,45 +46,45 @@ Linked vertex stage: ...@@ -46,45 +46,45 @@ Linked vertex stage:
18: TypePointer Function 17 18: TypePointer Function 17
19: TypeFunction 8 18(ptr) 19: TypeFunction 8 18(ptr)
23: TypeFunction 7(fvec3) 18(ptr) 10(ptr) 23: TypeFunction 7(fvec3) 18(ptr) 10(ptr)
32: TypeInt 32 1 33: TypeInt 32 1
33: 32(int) Constant 0 34: 33(int) Constant 0
34: TypePointer Function 16(fvec4) 35: TypePointer Function 16(fvec4)
38: 32(int) Constant 1 39: 33(int) Constant 1
42: 32(int) Constant 2 43: 33(int) Constant 2
46: 6(float) Constant 1065353216 47: 6(float) Constant 1065353216
47: 6(float) Constant 0 48: 6(float) Constant 0
68: TypePointer Output 16(fvec4) 71: TypePointer Output 16(fvec4)
69(gl_Position): 68(ptr) Variable Output 72(gl_Position): 71(ptr) Variable Output
70: TypePointer UniformConstant 17 73: TypePointer UniformConstant 17
71(m4): 70(ptr) Variable UniformConstant 74(m4): 73(ptr) Variable UniformConstant
72: TypePointer Input 7(fvec3) 75: TypePointer Input 7(fvec3)
73(v3): 72(ptr) Variable Input 76(v3): 75(ptr) Variable Input
79: TypePointer UniformConstant 8 82: TypePointer UniformConstant 8
80(m3): 79(ptr) Variable UniformConstant 83(m3): 82(ptr) Variable UniformConstant
91: TypePointer Input 32(int) 94: TypePointer Input 33(int)
92(gl_VertexID): 91(ptr) Variable Input 95(gl_VertexID): 94(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
74(param): 18(ptr) Variable Function 77(param): 18(ptr) Variable Function
76(param): 10(ptr) Variable Function 79(param): 10(ptr) Variable Function
81(param): 9(ptr) Variable Function 84(param): 9(ptr) Variable Function
83(param): 10(ptr) Variable Function 86(param): 10(ptr) Variable Function
75: 17 Load 71(m4) 78: 17 Load 74(m4)
Store 74(param) 75 Store 77(param) 78
77: 7(fvec3) Load 73(v3) 80: 7(fvec3) Load 76(v3)
Store 76(param) 77 Store 79(param) 80
78: 7(fvec3) FunctionCall 26(mxv(mf44;vf3;) 74(param) 76(param) 81: 7(fvec3) FunctionCall 26(mxv(mf44;vf3;) 77(param) 79(param)
82: 8 Load 80(m3) 85: 8 Load 83(m3)
Store 81(param) 82 Store 84(param) 85
84: 7(fvec3) Load 73(v3) 87: 7(fvec3) Load 76(v3)
Store 83(param) 84 Store 86(param) 87
85: 7(fvec3) FunctionCall 14(xf(mf33;vf3;) 81(param) 83(param) 88: 7(fvec3) FunctionCall 14(xf(mf33;vf3;) 84(param) 86(param)
86: 7(fvec3) FAdd 78 85 89: 7(fvec3) FAdd 81 88
87: 6(float) CompositeExtract 86 0 90: 6(float) CompositeExtract 89 0
88: 6(float) CompositeExtract 86 1 91: 6(float) CompositeExtract 89 1
89: 6(float) CompositeExtract 86 2 92: 6(float) CompositeExtract 89 2
90: 16(fvec4) CompositeConstruct 87 88 89 46 93: 16(fvec4) CompositeConstruct 90 91 92 47
Store 69(gl_Position) 90 Store 72(gl_Position) 93
Return Return
FunctionEnd FunctionEnd
14(xf(mf33;vf3;): 7(fvec3) Function None 11 14(xf(mf33;vf3;): 7(fvec3) Function None 11
...@@ -99,39 +99,39 @@ Linked vertex stage: ...@@ -99,39 +99,39 @@ Linked vertex stage:
21(Mat3(mf44;): 8 Function None 19 21(Mat3(mf44;): 8 Function None 19
20(m): 18(ptr) FunctionParameter 20(m): 18(ptr) FunctionParameter
22: Label 22: Label
35: 34(ptr) AccessChain 20(m) 33 36: 35(ptr) AccessChain 20(m) 34
36: 16(fvec4) Load 35 37: 16(fvec4) Load 36
37: 7(fvec3) VectorShuffle 36 36 0 1 2 38: 7(fvec3) VectorShuffle 37 37 0 1 2
39: 34(ptr) AccessChain 20(m) 38 40: 35(ptr) AccessChain 20(m) 39
40: 16(fvec4) Load 39 41: 16(fvec4) Load 40
41: 7(fvec3) VectorShuffle 40 40 0 1 2 42: 7(fvec3) VectorShuffle 41 41 0 1 2
43: 34(ptr) AccessChain 20(m) 42 44: 35(ptr) AccessChain 20(m) 43
44: 16(fvec4) Load 43 45: 16(fvec4) Load 44
45: 7(fvec3) VectorShuffle 44 44 0 1 2 46: 7(fvec3) VectorShuffle 45 45 0 1 2
48: 6(float) CompositeExtract 37 0 49: 6(float) CompositeExtract 38 0
49: 6(float) CompositeExtract 37 1 50: 6(float) CompositeExtract 38 1
50: 6(float) CompositeExtract 37 2 51: 6(float) CompositeExtract 38 2
51: 6(float) CompositeExtract 41 0 52: 6(float) CompositeExtract 42 0
52: 6(float) CompositeExtract 41 1 53: 6(float) CompositeExtract 42 1
53: 6(float) CompositeExtract 41 2 54: 6(float) CompositeExtract 42 2
54: 6(float) CompositeExtract 45 0 55: 6(float) CompositeExtract 46 0
55: 6(float) CompositeExtract 45 1 56: 6(float) CompositeExtract 46 1
56: 6(float) CompositeExtract 45 2 57: 6(float) CompositeExtract 46 2
57: 7(fvec3) CompositeConstruct 48 49 50 58: 7(fvec3) CompositeConstruct 49 50 51
58: 7(fvec3) CompositeConstruct 51 52 53 59: 7(fvec3) CompositeConstruct 52 53 54
59: 7(fvec3) CompositeConstruct 54 55 56 60: 7(fvec3) CompositeConstruct 55 56 57
60: 8 CompositeConstruct 57 58 59 61: 8 CompositeConstruct 58 59 60
ReturnValue 60 ReturnValue 61
FunctionEnd FunctionEnd
26(mxv(mf44;vf3;): 7(fvec3) Function None 23 26(mxv(mf44;vf3;): 7(fvec3) Function None 23
24(m4): 18(ptr) FunctionParameter 24(m4): 18(ptr) FunctionParameter
25(v): 10(ptr) FunctionParameter 25(v): 10(ptr) FunctionParameter
27: Label 27: Label
63(param): 18(ptr) Variable Function 65(param): 18(ptr) Variable Function
62: 7(fvec3) Load 25(v) 64: 7(fvec3) Load 25(v)
64: 17 Load 24(m4) 66: 17 Load 24(m4)
Store 63(param) 64 Store 65(param) 66
65: 8 FunctionCall 21(Mat3(mf44;) 63(param) 67: 8 FunctionCall 21(Mat3(mf44;) 65(param)
66: 7(fvec3) VectorTimesMatrix 62 65 68: 7(fvec3) VectorTimesMatrix 64 67
ReturnValue 66 ReturnValue 68
FunctionEnd FunctionEnd
...@@ -7,20 +7,20 @@ Linked fragment stage: ...@@ -7,20 +7,20 @@ Linked fragment 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 Fragment 4 "main" 12 16 EntryPoint Fragment 4 "main" 12 17
ExecutionMode 4 OriginLowerLeft ExecutionMode 4 OriginLowerLeft
Source GLSL 150 Source GLSL 150
Name 4 "main" Name 4 "main"
Name 9 "foo(" Name 9 "foo("
Name 12 "BaseColor" Name 12 "BaseColor"
Name 16 "gl_FragColor" Name 17 "gl_FragColor"
Name 19 "bigColor" Name 20 "bigColor"
Name 21 "d" Name 22 "d"
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
...@@ -28,16 +28,16 @@ Linked fragment stage: ...@@ -28,16 +28,16 @@ Linked fragment stage:
8: TypeFunction 7(fvec4) 8: TypeFunction 7(fvec4)
11: TypePointer Input 7(fvec4) 11: TypePointer Input 7(fvec4)
12(BaseColor): 11(ptr) Variable Input 12(BaseColor): 11(ptr) Variable Input
15: TypePointer Output 7(fvec4) 16: TypePointer Output 7(fvec4)
16(gl_FragColor): 15(ptr) Variable Output 17(gl_FragColor): 16(ptr) Variable Output
18: TypePointer UniformConstant 7(fvec4) 19: TypePointer UniformConstant 7(fvec4)
19(bigColor): 18(ptr) Variable UniformConstant 20(bigColor): 19(ptr) Variable UniformConstant
20: TypePointer UniformConstant 6(float) 21: TypePointer UniformConstant 6(float)
21(d): 20(ptr) Variable UniformConstant 22(d): 21(ptr) Variable UniformConstant
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
17: 7(fvec4) FunctionCall 9(foo() 18: 7(fvec4) FunctionCall 9(foo()
Store 16(gl_FragColor) 17 Store 17(gl_FragColor) 18
Return Return
FunctionEnd FunctionEnd
9(foo(): 7(fvec4) Function None 8 9(foo(): 7(fvec4) Function None 8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment