SPV: Emit OpSelect when a selection node is simple enough.

Also, ensures it has a type, no disallowed side effects,
or performance trade offs.
This commit is contained in:
John Kessenich
2017-01-26 20:31:11 -07:00
parent 509177d136
commit 433e9ff896
6 changed files with 321 additions and 322 deletions

View File

@@ -1,12 +1,12 @@
spv.deepRvalue.frag
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 155
// Id's are bound by 150
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 149
EntryPoint Fragment 4 "main" 144
ExecutionMode 4 OriginUpperLeft
Source GLSL 330
Name 4 "main"
@@ -21,12 +21,12 @@ spv.deepRvalue.frag
Name 106 "h"
Name 107 "i"
Name 111 "samp2D"
Name 134 "str"
MemberName 134(str) 0 "a"
MemberName 134(str) 1 "b"
MemberName 134(str) 2 "c"
Name 136 "t"
Name 149 "gl_FragColor"
Name 129 "str"
MemberName 129(str) 0 "a"
MemberName 129(str) 1 "b"
MemberName 129(str) 2 "c"
Name 131 "t"
Name 144 "gl_FragColor"
Decorate 111(samp2D) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
@@ -75,22 +75,21 @@ spv.deepRvalue.frag
113: TypeVector 6(float) 2
114: 6(float) Constant 1056964608
115: 113(fvec2) ConstantComposite 114 114
118: TypePointer Function 7(fvec4)
121: 6(float) Constant 1036831949
122: TypeBool
133: TypeArray 113(fvec2) 84
134(str): TypeStruct 81(int) 133 122(bool)
135: TypePointer Function 134(str)
137: 113(fvec2) ConstantComposite 10 11
138: 6(float) Constant 1082130432
139: 113(fvec2) ConstantComposite 138 12
140: 6(float) Constant 1086324736
141: 113(fvec2) ConstantComposite 140 13
142: 133 ConstantComposite 137 139 141
143: 122(bool) ConstantTrue
144: 134(str) ConstantComposite 82 142 143
148: TypePointer Output 7(fvec4)
149(gl_FragColor): 148(ptr) Variable Output
119: 6(float) Constant 1036831949
120: TypeBool
128: TypeArray 113(fvec2) 84
129(str): TypeStruct 81(int) 128 120(bool)
130: TypePointer Function 129(str)
132: 113(fvec2) ConstantComposite 10 11
133: 6(float) Constant 1082130432
134: 113(fvec2) ConstantComposite 133 12
135: 6(float) Constant 1086324736
136: 113(fvec2) ConstantComposite 135 13
137: 128 ConstantComposite 132 134 136
138: 120(bool) ConstantTrue
139: 129(str) ConstantComposite 82 137 138
143: TypePointer Output 7(fvec4)
144(gl_FragColor): 143(ptr) Variable Output
4(main): 2 Function None 3
5: Label
35(m): 34(ptr) Variable Function
@@ -99,8 +98,7 @@ spv.deepRvalue.frag
87(g): 79(ptr) Variable Function
106(h): 79(ptr) Variable Function
107(i): 79(ptr) Variable Function
119: 118(ptr) Variable Function
136(t): 135(ptr) Variable Function
131(t): 130(ptr) Variable Function
Store 9(v1) 14
Store 15(v2) 20
Store 21(v3) 26
@@ -172,34 +170,25 @@ spv.deepRvalue.frag
116: 7(fvec4) ImageSampleImplicitLod 112 115
117: 6(float) CompositeExtract 116 1
Store 107(i) 117
120: 6(float) Load 107(i)
123: 122(bool) FOrdGreaterThan 120 121
SelectionMerge 125 None
BranchConditional 123 124 127
124: Label
126: 7(fvec4) Load 9(v1)
Store 119 126
Branch 125
127: Label
128: 7(fvec4) Load 15(v2)
Store 119 128
Branch 125
125: Label
129: 79(ptr) AccessChain 119 84
130: 6(float) Load 129
131: 6(float) Load 107(i)
132: 6(float) FAdd 131 130
Store 107(i) 132
Store 136(t) 144
145: 6(float) CompositeExtract 144 1 2 1
146: 6(float) Load 107(i)
147: 6(float) FAdd 146 145
Store 107(i) 147
150: 6(float) Load 80(f)
151: 6(float) Load 87(g)
152: 6(float) Load 106(h)
153: 6(float) Load 107(i)
154: 7(fvec4) CompositeConstruct 150 151 152 153
Store 149(gl_FragColor) 154
118: 6(float) Load 107(i)
121: 120(bool) FOrdGreaterThan 118 119
122: 7(fvec4) Load 9(v1)
123: 7(fvec4) Load 15(v2)
124: 7(fvec4) Select 121 122 123
125: 6(float) CompositeExtract 124 3
126: 6(float) Load 107(i)
127: 6(float) FAdd 126 125
Store 107(i) 127
Store 131(t) 139
140: 6(float) CompositeExtract 139 1 2 1
141: 6(float) Load 107(i)
142: 6(float) FAdd 141 140
Store 107(i) 142
145: 6(float) Load 80(f)
146: 6(float) Load 87(g)
147: 6(float) Load 106(h)
148: 6(float) Load 107(i)
149: 7(fvec4) CompositeConstruct 145 146 147 148
Store 144(gl_FragColor) 149
Return
FunctionEnd