HLSL: Fix #1249: Always execute both sides of ternary "?:".

This is semantically required by HLSL, and frequently results in using
OpSelect instead of control flow.
This commit is contained in:
John Kessenich
2018-02-20 21:29:05 -07:00
parent a5cae08259
commit 4bee531fc1
17 changed files with 776 additions and 850 deletions

View File

@@ -86,8 +86,8 @@ spv.bitCast.frag
148(u4): 147(ptr) Variable Input
153: TypePointer Output 46(fvec4)
154(fragColor): 153(ptr) Variable Output
159: TypeBool
160: TypeVector 159(bool) 4
158: TypeBool
159: TypeVector 158(bool) 4
168: 12(float) Constant 1045220557
169: 46(fvec4) ConstantComposite 168 168 168 168
4(main): 2 Function None 3
@@ -95,7 +95,7 @@ spv.bitCast.frag
9(idata): 8(ptr) Variable Function
55(udata): 54(ptr) Variable Function
85(fdata): 84(ptr) Variable Function
155: 84(ptr) Variable Function
162: 84(ptr) Variable Function
Store 9(idata) 11
15: 12(float) Load 14(f1)
16: 6(int) Bitcast 15
@@ -211,24 +211,24 @@ spv.bitCast.frag
151: 46(fvec4) Load 85(fdata)
152: 46(fvec4) FAdd 151 150
Store 85(fdata) 152
156: 7(ivec4) Load 9(idata)
157: 53(ivec4) Bitcast 156
158: 53(ivec4) Load 55(udata)
161: 160(bvec4) IEqual 157 158
162: 159(bool) All 161
155: 7(ivec4) Load 9(idata)
156: 53(ivec4) Bitcast 155
157: 53(ivec4) Load 55(udata)
160: 159(bvec4) IEqual 156 157
161: 158(bool) All 160
SelectionMerge 164 None
BranchConditional 162 163 166
BranchConditional 161 163 166
163: Label
165: 46(fvec4) Load 85(fdata)
Store 155 165
Store 162 165
Branch 164
166: Label
167: 46(fvec4) Load 85(fdata)
170: 46(fvec4) FAdd 167 169
Store 155 170
Store 162 170
Branch 164
164: Label
171: 46(fvec4) Load 155
171: 46(fvec4) Load 162
Store 154(fragColor) 171
Return
FunctionEnd