SPV: Implement short circuiting of && and || when emitting SPIR-V.

This commit is contained in:
John Kessenich
2015-10-15 13:29:11 -06:00
parent da581a2b95
commit 7c1aa1026e
9 changed files with 1942 additions and 1429 deletions

View File

@@ -5,7 +5,7 @@ Linked vertex stage:
// Module Version 99
// Generated by (magic number): 51a00bb
// Id's are bound by 111
// Id's are bound by 114
Source ESSL 300
Capability Shader
@@ -40,8 +40,8 @@ Linked vertex stage:
MemberName 77(S) 0 "c"
MemberName 77(S) 1 "f"
Name 79 "s"
Name 109 "gl_VertexID"
Name 110 "gl_InstanceID"
Name 112 "gl_VertexID"
Name 113 "gl_InstanceID"
Decorate 9(pos) Smooth
Decorate 11(p) Location 3
MemberDecorate 17(Transform) 0 RowMajor
@@ -67,10 +67,10 @@ Linked vertex stage:
Decorate 53(c) Location 7
Decorate 61(iout) Flat
Decorate 73(aiv2) Location 9
Decorate 109(gl_VertexID) BuiltIn VertexId
Decorate 109(gl_VertexID) NoStaticUse
Decorate 110(gl_InstanceID) BuiltIn InstanceId
Decorate 110(gl_InstanceID) NoStaticUse
Decorate 112(gl_VertexID) BuiltIn VertexId
Decorate 112(gl_VertexID) NoStaticUse
Decorate 113(gl_InstanceID) BuiltIn InstanceId
Decorate 113(gl_InstanceID) NoStaticUse
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -124,12 +124,12 @@ Linked vertex stage:
89: 6(float) Constant 1065353216
90: 14(fvec3) ConstantComposite 89 89 89
91: TypeVector 42(bool) 3
94: TypePointer Uniform 30(ivec3)
97: 29(int) Constant 5
98: 30(ivec3) ConstantComposite 97 97 97
108: TypePointer Input 16(int)
109(gl_VertexID): 108(ptr) Variable Input
110(gl_InstanceID): 108(ptr) Variable Input
97: TypePointer Uniform 30(ivec3)
100: 29(int) Constant 5
101: 30(ivec3) ConstantComposite 100 100 100
111: TypePointer Input 16(int)
112(gl_VertexID): 111(ptr) Variable Input
113(gl_InstanceID): 111(ptr) Variable Input
4(main): 2 Function None 3
5: Label
12: 7(fvec4) Load 11(p)
@@ -174,20 +174,26 @@ Linked vertex stage:
88: 14(fvec3) Load 87
92: 91(bvec3) FOrdNotEqual 88 90
93: 42(bool) Any 92
95: 94(ptr) AccessChain 35 62 55
96: 30(ivec3) Load 95
99: 91(bvec3) INotEqual 96 98
100: 42(bool) Any 99
101: 42(bool) LogicalOr 93 100
SelectionMerge 103 None
BranchConditional 101 102 103
102: Label
104: 50(ptr) AccessChain 79(s) 20
105: 14(fvec3) Load 104
106: 14(fvec3) CompositeConstruct 89 89 89
107: 14(fvec3) FAdd 105 106
Store 104 107
Branch 103
103: Label
94: 42(bool) LogicalNot 93
SelectionMerge 96 None
BranchConditional 94 95 96
95: Label
98: 97(ptr) AccessChain 35 62 55
99: 30(ivec3) Load 98
102: 91(bvec3) INotEqual 99 101
103: 42(bool) Any 102
Branch 96
96: Label
104: 42(bool) Phi 93 5 103 95
SelectionMerge 106 None
BranchConditional 104 105 106
105: Label
107: 50(ptr) AccessChain 79(s) 20
108: 14(fvec3) Load 107
109: 14(fvec3) CompositeConstruct 89 89 89
110: 14(fvec3) FAdd 108 109
Store 107 110
Branch 106
106: Label
Return
FunctionEnd