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
builder.createBranch(&blocks.head);
} 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.
// 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);
......@@ -1435,12 +1437,9 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
builder.accessChainLoad(convertGlslangToSpvType(node->getTest()->getType()));
builder.createConditionalBranch(condition, &blocks.head, &blocks.merge);
} else {
// 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.
// TODO: unless there was a break/return/discard instruction
// somewhere in the body, this is an infinite loop, so we should
// issue a warning.
builder.createBranch(&blocks.head);
}
}
......
......@@ -855,24 +855,10 @@ void Builder::leaveFunction()
// If our function did not contain a return, add a return void now.
if (! block->isTerminated()) {
// Whether we're in an unreachable (non-entry) block.
bool unreachable = function.getEntryBlock() != block && block->getPredecessors().empty();
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()));
}
if (function.getReturnType() == makeVoidType())
makeReturn(true);
else {
makeReturn(true, createUndefined(function.getReturnType()));
}
}
}
......
......@@ -205,12 +205,6 @@ public:
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);
for (int i = 0; i < (int)localVariables.size(); ++i)
localVariables[i]->dump(out);
......
......@@ -5,7 +5,7 @@ Linked fragment 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"
......
......@@ -5,7 +5,7 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 100
// Id's are bound by 101
Capability Shader
1: ExtInstImport "GLSL.std.450"
......@@ -23,40 +23,40 @@ Linked fragment stage:
Name 43 "k"
Name 55 "sampR"
Name 63 "sampB"
Name 86 "samp2Da"
Name 91 "bn"
MemberName 91(bn) 0 "matra"
MemberName 91(bn) 1 "matca"
MemberName 91(bn) 2 "matr"
MemberName 91(bn) 3 "matc"
MemberName 91(bn) 4 "matrdef"
Name 93 ""
Name 96 "bi"
MemberName 96(bi) 0 "v"
Name 99 "bname"
Name 87 "samp2Da"
Name 92 "bn"
MemberName 92(bn) 0 "matra"
MemberName 92(bn) 1 "matca"
MemberName 92(bn) 2 "matr"
MemberName 92(bn) 3 "matc"
MemberName 92(bn) 4 "matrdef"
Name 94 ""
Name 97 "bi"
MemberName 97(bi) 0 "v"
Name 100 "bname"
Decorate 16(gl_FrontFacing) BuiltIn FrontFacing
Decorate 33(gl_ClipDistance) BuiltIn ClipDistance
Decorate 89 ArrayStride 64
Decorate 90 ArrayStride 64
MemberDecorate 91(bn) 0 RowMajor
MemberDecorate 91(bn) 0 Offset 0
MemberDecorate 91(bn) 0 MatrixStride 16
MemberDecorate 91(bn) 1 ColMajor
MemberDecorate 91(bn) 1 Offset 256
MemberDecorate 91(bn) 1 MatrixStride 16
MemberDecorate 91(bn) 2 RowMajor
MemberDecorate 91(bn) 2 Offset 512
MemberDecorate 91(bn) 2 MatrixStride 16
MemberDecorate 91(bn) 3 ColMajor
MemberDecorate 91(bn) 3 Offset 576
MemberDecorate 91(bn) 3 MatrixStride 16
MemberDecorate 91(bn) 4 RowMajor
MemberDecorate 91(bn) 4 Offset 640
MemberDecorate 91(bn) 4 MatrixStride 16
Decorate 91(bn) Block
Decorate 95 ArrayStride 16
MemberDecorate 96(bi) 0 Offset 0
Decorate 96(bi) Block
Decorate 91 ArrayStride 64
MemberDecorate 92(bn) 0 RowMajor
MemberDecorate 92(bn) 0 Offset 0
MemberDecorate 92(bn) 0 MatrixStride 16
MemberDecorate 92(bn) 1 ColMajor
MemberDecorate 92(bn) 1 Offset 256
MemberDecorate 92(bn) 1 MatrixStride 16
MemberDecorate 92(bn) 2 RowMajor
MemberDecorate 92(bn) 2 Offset 512
MemberDecorate 92(bn) 2 MatrixStride 16
MemberDecorate 92(bn) 3 ColMajor
MemberDecorate 92(bn) 3 Offset 576
MemberDecorate 92(bn) 3 MatrixStride 16
MemberDecorate 92(bn) 4 RowMajor
MemberDecorate 92(bn) 4 Offset 640
MemberDecorate 92(bn) 4 MatrixStride 16
Decorate 92(bn) Block
Decorate 96 ArrayStride 16
MemberDecorate 97(bi) 0 Offset 0
Decorate 97(bi) Block
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
......@@ -100,24 +100,24 @@ Linked fragment stage:
69: TypeVector 6(float) 2
72: 6(float) Constant 1120403456
74: 29(int) Constant 3
82: TypeImage 6(float) 2D sampled format:Unknown
83: TypeSampledImage 82
84: TypeArray 83 74
85: TypePointer UniformConstant 84
86(samp2Da): 85(ptr) Variable UniformConstant
87: TypeMatrix 26(fvec4) 4
88: 29(int) Constant 4
89: TypeArray 87 88
90: TypeArray 87 88
91(bn): TypeStruct 89 90 87 87 87
92: TypePointer Uniform 91(bn)
93: 92(ptr) Variable Uniform
94: TypeVector 6(float) 3
95: TypeArray 94(fvec3) 50
96(bi): TypeStruct 95
97: TypeArray 96(bi) 88
98: TypePointer Uniform 97
99(bname): 98(ptr) Variable Uniform
83: TypeImage 6(float) 2D sampled format:Unknown
84: TypeSampledImage 83
85: TypeArray 84 74
86: TypePointer UniformConstant 85
87(samp2Da): 86(ptr) Variable UniformConstant
88: TypeMatrix 26(fvec4) 4
89: 29(int) Constant 4
90: TypeArray 88 89
91: TypeArray 88 89
92(bn): TypeStruct 90 91 88 88 88
93: TypePointer Uniform 92(bn)
94: 93(ptr) Variable Uniform
95: TypeVector 6(float) 3
96: TypeArray 95(fvec3) 50
97(bi): TypeStruct 96
98: TypeArray 97(bi) 89
99: TypePointer Uniform 98
100(bname): 99(ptr) Variable Uniform
4(main): 2 Function None 3
5: Label
13: 12(ptr) Variable Function
......
......@@ -7,86 +7,86 @@ Linked vertex stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 49
// Id's are bound by 50
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 23 47 48
EntryPoint Vertex 4 "main" 24 48 49
Source GLSL 450
Name 4 "main"
Name 10 "foo(b1;"
Name 9 "b"
Name 21 "gl_PerVertex"
MemberName 21(gl_PerVertex) 0 "gl_Position"
MemberName 21(gl_PerVertex) 1 "gl_PointSize"
MemberName 21(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 21(gl_PerVertex) 3 "gl_CullDistance"
Name 23 ""
Name 28 "ubname"
MemberName 28(ubname) 0 "b"
Name 30 "ubinst"
Name 31 "param"
Name 47 "gl_VertexID"
Name 48 "gl_InstanceID"
MemberDecorate 21(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 21(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 21(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 21(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 21(gl_PerVertex) Block
Decorate 28(ubname) GLSLShared
Decorate 28(ubname) Block
Decorate 47(gl_VertexID) BuiltIn VertexId
Decorate 48(gl_InstanceID) BuiltIn InstanceId
Name 22 "gl_PerVertex"
MemberName 22(gl_PerVertex) 0 "gl_Position"
MemberName 22(gl_PerVertex) 1 "gl_PointSize"
MemberName 22(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 22(gl_PerVertex) 3 "gl_CullDistance"
Name 24 ""
Name 29 "ubname"
MemberName 29(ubname) 0 "b"
Name 31 "ubinst"
Name 32 "param"
Name 48 "gl_VertexID"
Name 49 "gl_InstanceID"
MemberDecorate 22(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 22(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 22(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 22(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 22(gl_PerVertex) Block
Decorate 29(ubname) GLSLShared
Decorate 29(ubname) Block
Decorate 48(gl_VertexID) BuiltIn VertexId
Decorate 49(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid
3: TypeFunction 2
6: TypeBool
7: TypePointer Function 6(bool)
8: TypeFunction 6(bool) 7(ptr)
13: 6(bool) ConstantFalse
16: TypeFloat 32
17: TypeVector 16(float) 4
18: TypeInt 32 0
19: 18(int) Constant 1
20: TypeArray 16(float) 19
21(gl_PerVertex): TypeStruct 17(fvec4) 16(float) 20 20
22: TypePointer Output 21(gl_PerVertex)
23: 22(ptr) Variable Output
24: TypeInt 32 1
25: 24(int) Constant 0
26: TypePointer Function 17(fvec4)
28(ubname): TypeStruct 6(bool)
29: TypePointer Uniform 28(ubname)
30(ubinst): 29(ptr) Variable Uniform
32: TypePointer Uniform 6(bool)
38: 16(float) Constant 0
39: 17(fvec4) ConstantComposite 38 38 38 38
41: 16(float) Constant 1065353216
42: 17(fvec4) ConstantComposite 41 41 41 41
44: TypePointer Output 17(fvec4)
46: TypePointer Input 24(int)
47(gl_VertexID): 46(ptr) Variable Input
48(gl_InstanceID): 46(ptr) Variable Input
17: TypeFloat 32
18: TypeVector 17(float) 4
19: TypeInt 32 0
20: 19(int) Constant 1
21: TypeArray 17(float) 20
22(gl_PerVertex): TypeStruct 18(fvec4) 17(float) 21 21
23: TypePointer Output 22(gl_PerVertex)
24: 23(ptr) Variable Output
25: TypeInt 32 1
26: 25(int) Constant 0
27: TypePointer Function 18(fvec4)
29(ubname): TypeStruct 6(bool)
30: TypePointer Uniform 29(ubname)
31(ubinst): 30(ptr) Variable Uniform
33: TypePointer Uniform 6(bool)
39: 17(float) Constant 0
40: 18(fvec4) ConstantComposite 39 39 39 39
42: 17(float) Constant 1065353216
43: 18(fvec4) ConstantComposite 42 42 42 42
45: TypePointer Output 18(fvec4)
47: TypePointer Input 25(int)
48(gl_VertexID): 47(ptr) Variable Input
49(gl_InstanceID): 47(ptr) Variable Input
4(main): 2 Function None 3
5: Label
27: 26(ptr) Variable Function
31(param): 7(ptr) Variable Function
33: 32(ptr) AccessChain 30(ubinst) 25
34: 6(bool) Load 33
Store 31(param) 34
35: 6(bool) FunctionCall 10(foo(b1;) 31(param)
SelectionMerge 37 None
BranchConditional 35 36 40
36: Label
Store 27 39
Branch 37
40: Label
Store 27 42
Branch 37
37: Label
43: 17(fvec4) Load 27
45: 44(ptr) AccessChain 23 25
Store 45 43
28: 27(ptr) Variable Function
32(param): 7(ptr) Variable Function
34: 33(ptr) AccessChain 31(ubinst) 26
35: 6(bool) Load 34
Store 32(param) 35
36: 6(bool) FunctionCall 10(foo(b1;) 32(param)
SelectionMerge 38 None
BranchConditional 36 37 41
37: Label
Store 28 40
Branch 38
41: Label
Store 28 43
Branch 38
38: Label
44: 18(fvec4) Load 28
46: 45(ptr) AccessChain 24 26
Store 46 44
Return
FunctionEnd
10(foo(b1;): 6(bool) Function None 8
......
......@@ -50,4 +50,6 @@ Linked vertex stage:
19: 6(int) IAdd 17 18
Store 8(i) 19
Branch 10
12: Label
Return
FunctionEnd
......@@ -5,7 +5,7 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 60
// Id's are bound by 61
Capability Shader
1: ExtInstImport "GLSL.std.450"
......@@ -24,13 +24,13 @@ Linked fragment stage:
Name 27 "f"
Name 30 "gl_FragColor"
Name 36 "d"
Name 59 "bigColor"
Name 60 "bigColor"
Decorate 18(color) RelaxedPrecision
Decorate 20(BaseColor) RelaxedPrecision
Decorate 27(f) RelaxedPrecision
Decorate 30(gl_FragColor) RelaxedPrecision
Decorate 36(d) RelaxedPrecision
Decorate 59(bigColor) RelaxedPrecision
Decorate 60(bigColor) RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
8: TypeFloat 32
......@@ -52,8 +52,8 @@ Linked fragment stage:
49: TypeInt 32 0
50: 49(int) Constant 0
53: 49(int) Constant 1
58: TypePointer UniformConstant 12(fvec4)
59(bigColor): 58(ptr) Variable UniformConstant
59: TypePointer UniformConstant 12(fvec4)
60(bigColor): 59(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
18(color): 13(ptr) Variable Function
......
......@@ -7,12 +7,12 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 76
// Id's are bound by 77
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 57 68
EntryPoint Fragment 4 "main" 58 69
ExecutionMode 4 OriginLowerLeft
Source GLSL 130
Name 4 "main"
......@@ -22,14 +22,14 @@ Linked fragment stage:
Name 16 "unreachableReturn("
Name 18 "missingReturn("
Name 21 "h"
Name 34 "d"
Name 55 "color"
Name 57 "BaseColor"
Name 58 "param"
Name 63 "f"
Name 65 "g"
Name 68 "gl_FragColor"
Name 75 "bigColor"
Name 35 "d"
Name 56 "color"
Name 58 "BaseColor"
Name 59 "param"
Name 64 "f"
Name 66 "g"
Name 69 "gl_FragColor"
Name 76 "bigColor"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
......@@ -44,42 +44,42 @@ Linked fragment stage:
24: 23(int) Constant 0
25: TypePointer Function 6(float)
28: 23(int) Constant 1
33: TypePointer UniformConstant 6(float)
34(d): 33(ptr) Variable UniformConstant
36: 6(float) Constant 1082549862
37: TypeBool
41: 6(float) Constant 1067030938
44: 6(float) Constant 1083179008
52: 6(float) Constant 1081711002
56: TypePointer Input 7(fvec4)
57(BaseColor): 56(ptr) Variable Input
67: TypePointer Output 7(fvec4)
68(gl_FragColor): 67(ptr) Variable Output
74: TypePointer UniformConstant 7(fvec4)
75(bigColor): 74(ptr) Variable UniformConstant
34: TypePointer UniformConstant 6(float)
35(d): 34(ptr) Variable UniformConstant
37: 6(float) Constant 1082549862
38: TypeBool
42: 6(float) Constant 1067030938
45: 6(float) Constant 1083179008
53: 6(float) Constant 1081711002
57: TypePointer Input 7(fvec4)
58(BaseColor): 57(ptr) Variable Input
68: TypePointer Output 7(fvec4)
69(gl_FragColor): 68(ptr) Variable Output
75: TypePointer UniformConstant 7(fvec4)
76(bigColor): 75(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
55(color): 8(ptr) Variable Function
58(param): 8(ptr) Variable Function
63(f): 25(ptr) Variable Function
65(g): 25(ptr) Variable Function
56(color): 8(ptr) Variable Function
59(param): 8(ptr) Variable Function
64(f): 25(ptr) Variable Function
66(g): 25(ptr) Variable Function
Store 21(h) 22
59: 7(fvec4) Load 57(BaseColor)
Store 58(param) 59
60: 6(float) FunctionCall 11(foo(vf4;) 58(param)
61: 7(fvec4) CompositeConstruct 60 60 60 60
Store 55(color) 61
62: 2 FunctionCall 13(bar()
64: 6(float) FunctionCall 16(unreachableReturn()
Store 63(f) 64
66: 6(float) FunctionCall 18(missingReturn()
Store 65(g) 66
69: 7(fvec4) Load 55(color)
70: 6(float) Load 63(f)
71: 7(fvec4) VectorTimesScalar 69 70
72: 6(float) Load 21(h)
73: 7(fvec4) VectorTimesScalar 71 72
Store 68(gl_FragColor) 73
60: 7(fvec4) Load 58(BaseColor)
Store 59(param) 60
61: 6(float) FunctionCall 11(foo(vf4;) 59(param)
62: 7(fvec4) CompositeConstruct 61 61 61 61
Store 56(color) 62
63: 2 FunctionCall 13(bar()
65: 6(float) FunctionCall 16(unreachableReturn()
Store 64(f) 65
67: 6(float) FunctionCall 18(missingReturn()
Store 66(g) 67
70: 7(fvec4) Load 56(color)
71: 6(float) Load 64(f)
72: 7(fvec4) VectorTimesScalar 70 71
73: 6(float) Load 21(h)
74: 7(fvec4) VectorTimesScalar 72 73
Store 69(gl_FragColor) 74
Return
FunctionEnd
11(foo(vf4;): 6(float) Function None 9
......@@ -98,29 +98,29 @@ Linked fragment stage:
FunctionEnd
16(unreachableReturn(): 6(float) Function None 15
17: Label
35: 6(float) Load 34(d)
38: 37(bool) FOrdLessThan 35 36
SelectionMerge 40 None
BranchConditional 38 39 43
39: Label
ReturnValue 41
43: Label
ReturnValue 44
40: Label
46: 6(float) Undef
ReturnValue 46
36: 6(float) Load 35(d)
39: 38(bool) FOrdLessThan 36 37
SelectionMerge 41 None
BranchConditional 39 40 44
40: Label
ReturnValue 42
44: Label
ReturnValue 45
41: Label
47: 6(float) Undef
ReturnValue 47
FunctionEnd
18(missingReturn(): 6(float) Function None 15
19: Label
47: 6(float) Load 34(d)
48: 37(bool) FOrdLessThan 47 44
SelectionMerge 50 None
BranchConditional 48 49 50
49: Label
51: 6(float) Load 34(d)
Store 21(h) 51
ReturnValue 52
50: Label
54: 6(float) Undef
ReturnValue 54
48: 6(float) Load 35(d)
49: 38(bool) FOrdLessThan 48 45
SelectionMerge 51 None
BranchConditional 49 50 51
50: Label
52: 6(float) Load 35(d)
Store 21(h) 52
ReturnValue 53
51: Label
55: 6(float) Undef
ReturnValue 55
FunctionEnd
......@@ -5,12 +5,12 @@ Linked vertex stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 93
// Id's are bound by 96
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 69 73 92
EntryPoint Vertex 4 "main" 72 76 95
Source GLSL 130
Name 4 "main"
Name 14 "xf(mf33;vf3;"
......@@ -21,18 +21,18 @@ Linked vertex stage:
Name 26 "mxv(mf44;vf3;"
Name 24 "m4"
Name 25 "v"
Name 63 "param"
Name 69 "gl_Position"
Name 71 "m4"
Name 73 "v3"
Name 74 "param"
Name 76 "param"
Name 80 "m3"
Name 81 "param"
Name 83 "param"
Name 92 "gl_VertexID"
Decorate 69(gl_Position) BuiltIn Position
Decorate 92(gl_VertexID) BuiltIn VertexId
Name 65 "param"
Name 72 "gl_Position"
Name 74 "m4"
Name 76 "v3"
Name 77 "param"
Name 79 "param"
Name 83 "m3"
Name 84 "param"
Name 86 "param"
Name 95 "gl_VertexID"
Decorate 72(gl_Position) BuiltIn Position
Decorate 95(gl_VertexID) BuiltIn VertexId
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
......@@ -46,45 +46,45 @@ Linked vertex stage:
18: TypePointer Function 17
19: TypeFunction 8 18(ptr)
23: TypeFunction 7(fvec3) 18(ptr) 10(ptr)
32: TypeInt 32 1
33: 32(int) Constant 0
34: TypePointer Function 16(fvec4)
38: 32(int) Constant 1
42: 32(int) Constant 2
46: 6(float) Constant 1065353216
47: 6(float) Constant 0
68: TypePointer Output 16(fvec4)
69(gl_Position): 68(ptr) Variable Output
70: TypePointer UniformConstant 17
71(m4): 70(ptr) Variable UniformConstant
72: TypePointer Input 7(fvec3)
73(v3): 72(ptr) Variable Input
79: TypePointer UniformConstant 8
80(m3): 79(ptr) Variable UniformConstant
91: TypePointer Input 32(int)
92(gl_VertexID): 91(ptr) Variable Input
33: TypeInt 32 1
34: 33(int) Constant 0
35: TypePointer Function 16(fvec4)
39: 33(int) Constant 1
43: 33(int) Constant 2
47: 6(float) Constant 1065353216
48: 6(float) Constant 0
71: TypePointer Output 16(fvec4)
72(gl_Position): 71(ptr) Variable Output
73: TypePointer UniformConstant 17
74(m4): 73(ptr) Variable UniformConstant
75: TypePointer Input 7(fvec3)
76(v3): 75(ptr) Variable Input
82: TypePointer UniformConstant 8
83(m3): 82(ptr) Variable UniformConstant
94: TypePointer Input 33(int)
95(gl_VertexID): 94(ptr) Variable Input
4(main): 2 Function None 3
5: Label
74(param): 18(ptr) Variable Function
76(param): 10(ptr) Variable Function
81(param): 9(ptr) Variable Function
83(param): 10(ptr) Variable Function
75: 17 Load 71(m4)
Store 74(param) 75
77: 7(fvec3) Load 73(v3)
Store 76(param) 77
78: 7(fvec3) FunctionCall 26(mxv(mf44;vf3;) 74(param) 76(param)
82: 8 Load 80(m3)
Store 81(param) 82
84: 7(fvec3) Load 73(v3)
Store 83(param) 84
85: 7(fvec3) FunctionCall 14(xf(mf33;vf3;) 81(param) 83(param)
86: 7(fvec3) FAdd 78 85
87: 6(float) CompositeExtract 86 0
88: 6(float) CompositeExtract 86 1
89: 6(float) CompositeExtract 86 2
90: 16(fvec4) CompositeConstruct 87 88 89 46
Store 69(gl_Position) 90
77(param): 18(ptr) Variable Function
79(param): 10(ptr) Variable Function
84(param): 9(ptr) Variable Function
86(param): 10(ptr) Variable Function
78: 17 Load 74(m4)
Store 77(param) 78
80: 7(fvec3) Load 76(v3)
Store 79(param) 80
81: 7(fvec3) FunctionCall 26(mxv(mf44;vf3;) 77(param) 79(param)
85: 8 Load 83(m3)
Store 84(param) 85
87: 7(fvec3) Load 76(v3)
Store 86(param) 87
88: 7(fvec3) FunctionCall 14(xf(mf33;vf3;) 84(param) 86(param)
89: 7(fvec3) FAdd 81 88
90: 6(float) CompositeExtract 89 0
91: 6(float) CompositeExtract 89 1
92: 6(float) CompositeExtract 89 2
93: 16(fvec4) CompositeConstruct 90 91 92 47
Store 72(gl_Position) 93
Return
FunctionEnd
14(xf(mf33;vf3;): 7(fvec3) Function None 11
......@@ -99,39 +99,39 @@ Linked vertex stage:
21(Mat3(mf44;): 8 Function None 19
20(m): 18(ptr) FunctionParameter
22: Label
35: 34(ptr) AccessChain 20(m) 33
36: 16(fvec4) Load 35
37: 7(fvec3) VectorShuffle 36 36 0 1 2
39: 34(ptr) AccessChain 20(m) 38
40: 16(fvec4) Load 39
41: 7(fvec3) VectorShuffle 40 40 0 1 2
43: 34(ptr) AccessChain 20(m) 42
44: 16(fvec4) Load 43
45: 7(fvec3) VectorShuffle 44 44 0 1 2
48: 6(float) CompositeExtract 37 0
49: 6(float) CompositeExtract 37 1
50: 6(float) CompositeExtract 37 2
51: 6(float) CompositeExtract 41 0
52: 6(float) CompositeExtract 41 1
53: 6(float) CompositeExtract 41 2
54: 6(float) CompositeExtract 45 0
55: 6(float) CompositeExtract 45 1
56: 6(float) CompositeExtract 45 2
57: 7(fvec3) CompositeConstruct 48 49 50
58: 7(fvec3) CompositeConstruct 51 52 53
59: 7(fvec3) CompositeConstruct 54 55 56
60: 8 CompositeConstruct 57 58 59
ReturnValue 60
36: 35(ptr) AccessChain 20(m) 34
37: 16(fvec4) Load 36
38: 7(fvec3) VectorShuffle 37 37 0 1 2
40: 35(ptr) AccessChain 20(m) 39
41: 16(fvec4) Load 40
42: 7(fvec3) VectorShuffle 41 41 0 1 2
44: 35(ptr) AccessChain 20(m) 43
45: 16(fvec4) Load 44
46: 7(fvec3) VectorShuffle 45 45 0 1 2
49: 6(float) CompositeExtract 38 0
50: 6(float) CompositeExtract 38 1
51: 6(float) CompositeExtract 38 2
52: 6(float) CompositeExtract 42 0
53: 6(float) CompositeExtract 42 1
54: 6(float) CompositeExtract 42 2
55: 6(float) CompositeExtract 46 0
56: 6(float) CompositeExtract 46 1
57: 6(float) CompositeExtract 46 2
58: 7(fvec3) CompositeConstruct 49 50 51
59: 7(fvec3) CompositeConstruct 52 53 54
60: 7(fvec3) CompositeConstruct 55 56 57
61: 8 CompositeConstruct 58 59 60
ReturnValue 61
FunctionEnd
26(mxv(mf44;vf3;): 7(fvec3) Function None 23
24(m4): 18(ptr) FunctionParameter
25(v): 10(ptr) FunctionParameter
27: Label
63(param): 18(ptr) Variable Function
62: 7(fvec3) Load 25(v)
64: 17 Load 24(m4)
Store 63(param) 64
65: 8 FunctionCall 21(Mat3(mf44;) 63(param)
66: 7(fvec3) VectorTimesMatrix 62 65
ReturnValue 66
65(param): 18(ptr) Variable Function
64: 7(fvec3) Load 25(v)
66: 17 Load 24(m4)
Store 65(param) 66
67: 8 FunctionCall 21(Mat3(mf44;) 65(param)
68: 7(fvec3) VectorTimesMatrix 64 67
ReturnValue 68
FunctionEnd
......@@ -7,20 +7,20 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 22
// Id's are bound by 23
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 12 16
EntryPoint Fragment 4 "main" 12 17
ExecutionMode 4 OriginLowerLeft
Source GLSL 150
Name 4 "main"
Name 9 "foo("
Name 12 "BaseColor"
Name 16 "gl_FragColor"
Name 19 "bigColor"
Name 21 "d"
Name 17 "gl_FragColor"
Name 20 "bigColor"
Name 22 "d"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
......@@ -28,16 +28,16 @@ Linked fragment stage:
8: TypeFunction 7(fvec4)
11: TypePointer Input 7(fvec4)
12(BaseColor): 11(ptr) Variable Input
15: TypePointer Output 7(fvec4)
16(gl_FragColor): 15(ptr) Variable Output
18: TypePointer UniformConstant 7(fvec4)
19(bigColor): 18(ptr) Variable UniformConstant
20: TypePointer UniformConstant 6(float)
21(d): 20(ptr) Variable UniformConstant
16: TypePointer Output 7(fvec4)
17(gl_FragColor): 16(ptr) Variable Output
19: TypePointer UniformConstant 7(fvec4)
20(bigColor): 19(ptr) Variable UniformConstant
21: TypePointer UniformConstant 6(float)
22(d): 21(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
17: 7(fvec4) FunctionCall 9(foo()
Store 16(gl_FragColor) 17
18: 7(fvec4) FunctionCall 9(foo()
Store 17(gl_FragColor) 18
Return
FunctionEnd
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