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:
@@ -78,7 +78,7 @@ gl_FragCoord origin is upper left
|
||||
0:17 Sequence
|
||||
0:17 move second child to first child ( temp 4-component vector of float)
|
||||
0:17 'ret' ( temp 4-component vector of float)
|
||||
0:17 Test condition and select ( temp 4-component vector of float)
|
||||
0:17 Test condition and select ( temp 4-component vector of float): no shortcircuit
|
||||
0:17 Condition
|
||||
0:17 Compare Not Equal ( temp bool)
|
||||
0:17 t: direct index for structure ( uniform float)
|
||||
@@ -169,7 +169,7 @@ gl_FragCoord origin is upper left
|
||||
0:37 'e' ( temp int)
|
||||
0:37 move second child to first child ( temp int)
|
||||
0:37 'a' ( temp int)
|
||||
0:37 Test condition and select ( temp int)
|
||||
0:37 Test condition and select ( temp int): no shortcircuit
|
||||
0:37 Condition
|
||||
0:37 Convert int to bool ( temp bool)
|
||||
0:37 'b' ( temp int)
|
||||
@@ -182,7 +182,7 @@ gl_FragCoord origin is upper left
|
||||
0:37 10 (const int)
|
||||
0:37 move second child to first child ( temp int)
|
||||
0:37 'b' ( temp int)
|
||||
0:37 Test condition and select ( temp int)
|
||||
0:37 Test condition and select ( temp int): no shortcircuit
|
||||
0:37 Condition
|
||||
0:37 Convert int to bool ( temp bool)
|
||||
0:37 'a' ( temp int)
|
||||
@@ -195,7 +195,7 @@ gl_FragCoord origin is upper left
|
||||
0:37 11 (const int)
|
||||
0:39 move second child to first child ( temp 4-component vector of float)
|
||||
0:39 'f' ( temp 4-component vector of float)
|
||||
0:39 Test condition and select ( temp 4-component vector of float)
|
||||
0:39 Test condition and select ( temp 4-component vector of float): no shortcircuit
|
||||
0:39 Condition
|
||||
0:39 Compare Less Than ( temp bool)
|
||||
0:39 direct index ( temp float)
|
||||
@@ -341,7 +341,7 @@ gl_FragCoord origin is upper left
|
||||
0:17 Sequence
|
||||
0:17 move second child to first child ( temp 4-component vector of float)
|
||||
0:17 'ret' ( temp 4-component vector of float)
|
||||
0:17 Test condition and select ( temp 4-component vector of float)
|
||||
0:17 Test condition and select ( temp 4-component vector of float): no shortcircuit
|
||||
0:17 Condition
|
||||
0:17 Compare Not Equal ( temp bool)
|
||||
0:17 t: direct index for structure ( uniform float)
|
||||
@@ -432,7 +432,7 @@ gl_FragCoord origin is upper left
|
||||
0:37 'e' ( temp int)
|
||||
0:37 move second child to first child ( temp int)
|
||||
0:37 'a' ( temp int)
|
||||
0:37 Test condition and select ( temp int)
|
||||
0:37 Test condition and select ( temp int): no shortcircuit
|
||||
0:37 Condition
|
||||
0:37 Convert int to bool ( temp bool)
|
||||
0:37 'b' ( temp int)
|
||||
@@ -445,7 +445,7 @@ gl_FragCoord origin is upper left
|
||||
0:37 10 (const int)
|
||||
0:37 move second child to first child ( temp int)
|
||||
0:37 'b' ( temp int)
|
||||
0:37 Test condition and select ( temp int)
|
||||
0:37 Test condition and select ( temp int): no shortcircuit
|
||||
0:37 Condition
|
||||
0:37 Convert int to bool ( temp bool)
|
||||
0:37 'a' ( temp int)
|
||||
@@ -458,7 +458,7 @@ gl_FragCoord origin is upper left
|
||||
0:37 11 (const int)
|
||||
0:39 move second child to first child ( temp 4-component vector of float)
|
||||
0:39 'f' ( temp 4-component vector of float)
|
||||
0:39 Test condition and select ( temp 4-component vector of float)
|
||||
0:39 Test condition and select ( temp 4-component vector of float): no shortcircuit
|
||||
0:39 Condition
|
||||
0:39 Compare Less Than ( temp bool)
|
||||
0:39 direct index ( temp float)
|
||||
@@ -523,12 +523,12 @@ gl_FragCoord origin is upper left
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80004
|
||||
// Id's are bound by 220
|
||||
// Id's are bound by 206
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 213 216
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 199 202
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source HLSL 500
|
||||
Name 4 "PixelShaderFunction"
|
||||
@@ -548,20 +548,20 @@ gl_FragCoord origin is upper left
|
||||
MemberName 29($Global) 4 "f"
|
||||
Name 31 ""
|
||||
Name 85 "ret"
|
||||
Name 113 "a"
|
||||
Name 115 "b"
|
||||
Name 117 "c"
|
||||
Name 119 "d"
|
||||
Name 120 "ret"
|
||||
Name 140 "e"
|
||||
Name 161 "f"
|
||||
Name 200 "param"
|
||||
Name 201 "param"
|
||||
Name 202 "param"
|
||||
Name 211 "input"
|
||||
Name 213 "input"
|
||||
Name 216 "@entryPointOutput"
|
||||
Name 217 "param"
|
||||
Name 110 "a"
|
||||
Name 112 "b"
|
||||
Name 114 "c"
|
||||
Name 116 "d"
|
||||
Name 117 "ret"
|
||||
Name 137 "e"
|
||||
Name 150 "f"
|
||||
Name 186 "param"
|
||||
Name 187 "param"
|
||||
Name 188 "param"
|
||||
Name 197 "input"
|
||||
Name 199 "input"
|
||||
Name 202 "@entryPointOutput"
|
||||
Name 203 "param"
|
||||
MemberDecorate 29($Global) 0 Offset 0
|
||||
MemberDecorate 29($Global) 1 Offset 16
|
||||
MemberDecorate 29($Global) 2 Offset 32
|
||||
@@ -569,8 +569,8 @@ gl_FragCoord origin is upper left
|
||||
MemberDecorate 29($Global) 4 Offset 52
|
||||
Decorate 29($Global) Block
|
||||
Decorate 31 DescriptorSet 0
|
||||
Decorate 213(input) Location 0
|
||||
Decorate 216(@entryPointOutput) Location 0
|
||||
Decorate 199(input) Location 0
|
||||
Decorate 202(@entryPointOutput) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
@@ -598,41 +598,41 @@ gl_FragCoord origin is upper left
|
||||
48: 32(int) Constant 4
|
||||
49: TypePointer Uniform 6(float)
|
||||
53: 32(int) Constant 3
|
||||
100: 6(float) Constant 1065353216
|
||||
101: 7(fvec4) ConstantComposite 100 100 100 100
|
||||
112: TypePointer Function 32(int)
|
||||
114: 32(int) Constant 5
|
||||
116: 32(int) Constant 6
|
||||
118: 32(int) Constant 7
|
||||
143: TypeInt 32 0
|
||||
144: 143(int) Constant 0
|
||||
150: 32(int) Constant 10
|
||||
159: 32(int) Constant 11
|
||||
163: TypePointer Function 6(float)
|
||||
166: 143(int) Constant 1
|
||||
192: 13(bool) ConstantTrue
|
||||
193: 13(bool) ConstantFalse
|
||||
194: 14(bvec2) ConstantComposite 192 193
|
||||
195: 6(float) Constant 1073741824
|
||||
196: 16(fvec2) ConstantComposite 100 195
|
||||
197: 6(float) Constant 1077936128
|
||||
198: 6(float) Constant 1082130432
|
||||
199: 16(fvec2) ConstantComposite 197 198
|
||||
204: 6(float) Constant 1092616192
|
||||
212: TypePointer Input 7(fvec4)
|
||||
213(input): 212(ptr) Variable Input
|
||||
215: TypePointer Output 7(fvec4)
|
||||
216(@entryPointOutput): 215(ptr) Variable Output
|
||||
96: 6(float) Constant 1065353216
|
||||
97: 7(fvec4) ConstantComposite 96 96 96 96
|
||||
109: TypePointer Function 32(int)
|
||||
111: 32(int) Constant 5
|
||||
113: 32(int) Constant 6
|
||||
115: 32(int) Constant 7
|
||||
139: TypeInt 32 0
|
||||
140: 139(int) Constant 0
|
||||
143: 32(int) Constant 10
|
||||
148: 32(int) Constant 11
|
||||
151: TypePointer Function 6(float)
|
||||
154: 139(int) Constant 1
|
||||
178: 13(bool) ConstantTrue
|
||||
179: 13(bool) ConstantFalse
|
||||
180: 14(bvec2) ConstantComposite 178 179
|
||||
181: 6(float) Constant 1073741824
|
||||
182: 16(fvec2) ConstantComposite 96 181
|
||||
183: 6(float) Constant 1077936128
|
||||
184: 6(float) Constant 1082130432
|
||||
185: 16(fvec2) ConstantComposite 183 184
|
||||
190: 6(float) Constant 1092616192
|
||||
198: TypePointer Input 7(fvec4)
|
||||
199(input): 198(ptr) Variable Input
|
||||
201: TypePointer Output 7(fvec4)
|
||||
202(@entryPointOutput): 201(ptr) Variable Output
|
||||
4(PixelShaderFunction): 2 Function None 3
|
||||
5: Label
|
||||
211(input): 24(ptr) Variable Function
|
||||
217(param): 24(ptr) Variable Function
|
||||
214: 7(fvec4) Load 213(input)
|
||||
Store 211(input) 214
|
||||
218: 7(fvec4) Load 211(input)
|
||||
Store 217(param) 218
|
||||
219: 7(fvec4) FunctionCall 27(@PixelShaderFunction(vf4;) 217(param)
|
||||
Store 216(@entryPointOutput) 219
|
||||
197(input): 24(ptr) Variable Function
|
||||
203(param): 24(ptr) Variable Function
|
||||
200: 7(fvec4) Load 199(input)
|
||||
Store 197(input) 200
|
||||
204: 7(fvec4) Load 197(input)
|
||||
Store 203(param) 204
|
||||
205: 7(fvec4) FunctionCall 27(@PixelShaderFunction(vf4;) 203(param)
|
||||
Store 202(@entryPointOutput) 205
|
||||
Return
|
||||
FunctionEnd
|
||||
9(vectorCond(): 7(fvec4) Function None 8
|
||||
@@ -682,154 +682,116 @@ gl_FragCoord origin is upper left
|
||||
11(scalarCond(): 7(fvec4) Function None 8
|
||||
12: Label
|
||||
85(ret): 24(ptr) Variable Function
|
||||
86: 24(ptr) Variable Function
|
||||
87: 49(ptr) AccessChain 31 53
|
||||
88: 6(float) Load 87
|
||||
89: 49(ptr) AccessChain 31 48
|
||||
90: 6(float) Load 89
|
||||
91: 13(bool) FOrdNotEqual 88 90
|
||||
SelectionMerge 93 None
|
||||
BranchConditional 91 92 99
|
||||
92: Label
|
||||
94: 49(ptr) AccessChain 31 53
|
||||
95: 6(float) Load 94
|
||||
96: 34(ptr) AccessChain 31 33
|
||||
97: 7(fvec4) Load 96
|
||||
98: 7(fvec4) VectorTimesScalar 97 95
|
||||
Store 86 98
|
||||
Branch 93
|
||||
99: Label
|
||||
Store 86 101
|
||||
Branch 93
|
||||
93: Label
|
||||
102: 7(fvec4) Load 86
|
||||
Store 85(ret) 102
|
||||
103: 7(fvec4) Load 85(ret)
|
||||
ReturnValue 103
|
||||
86: 49(ptr) AccessChain 31 53
|
||||
87: 6(float) Load 86
|
||||
88: 49(ptr) AccessChain 31 48
|
||||
89: 6(float) Load 88
|
||||
90: 13(bool) FOrdNotEqual 87 89
|
||||
91: 49(ptr) AccessChain 31 53
|
||||
92: 6(float) Load 91
|
||||
93: 34(ptr) AccessChain 31 33
|
||||
94: 7(fvec4) Load 93
|
||||
95: 7(fvec4) VectorTimesScalar 94 92
|
||||
98: 43(bvec4) CompositeConstruct 90 90 90 90
|
||||
99: 7(fvec4) Select 98 95 97
|
||||
Store 85(ret) 99
|
||||
100: 7(fvec4) Load 85(ret)
|
||||
ReturnValue 100
|
||||
FunctionEnd
|
||||
22(fbSelect(vb2;vf2;vf2;): 16(fvec2) Function None 18
|
||||
19(cnd): 15(ptr) FunctionParameter
|
||||
20(src0): 17(ptr) FunctionParameter
|
||||
21(src1): 17(ptr) FunctionParameter
|
||||
23: Label
|
||||
106: 16(fvec2) Load 21(src1)
|
||||
107: 16(fvec2) Load 20(src0)
|
||||
108: 14(bvec2) Load 19(cnd)
|
||||
109: 16(fvec2) Select 108 107 106
|
||||
ReturnValue 109
|
||||
103: 16(fvec2) Load 21(src1)
|
||||
104: 16(fvec2) Load 20(src0)
|
||||
105: 14(bvec2) Load 19(cnd)
|
||||
106: 16(fvec2) Select 105 104 103
|
||||
ReturnValue 106
|
||||
FunctionEnd
|
||||
27(@PixelShaderFunction(vf4;): 7(fvec4) Function None 25
|
||||
26(input): 24(ptr) FunctionParameter
|
||||
28: Label
|
||||
113(a): 112(ptr) Variable Function
|
||||
115(b): 112(ptr) Variable Function
|
||||
117(c): 112(ptr) Variable Function
|
||||
119(d): 112(ptr) Variable Function
|
||||
120(ret): 24(ptr) Variable Function
|
||||
140(e): 112(ptr) Variable Function
|
||||
141: 112(ptr) Variable Function
|
||||
152: 112(ptr) Variable Function
|
||||
161(f): 24(ptr) Variable Function
|
||||
162: 24(ptr) Variable Function
|
||||
200(param): 15(ptr) Variable Function
|
||||
201(param): 17(ptr) Variable Function
|
||||
202(param): 17(ptr) Variable Function
|
||||
Store 113(a) 114
|
||||
Store 115(b) 116
|
||||
Store 117(c) 118
|
||||
Store 119(d) 118
|
||||
121: 32(int) Load 113(a)
|
||||
122: 6(float) ConvertSToF 121
|
||||
123: 7(fvec4) Load 26(input)
|
||||
124: 7(fvec4) VectorTimesScalar 123 122
|
||||
125: 32(int) Load 115(b)
|
||||
126: 6(float) ConvertSToF 125
|
||||
127: 7(fvec4) Load 26(input)
|
||||
128: 7(fvec4) VectorTimesScalar 127 126
|
||||
129: 7(fvec4) FAdd 124 128
|
||||
130: 32(int) Load 117(c)
|
||||
131: 6(float) ConvertSToF 130
|
||||
132: 7(fvec4) Load 26(input)
|
||||
133: 7(fvec4) VectorTimesScalar 132 131
|
||||
134: 7(fvec4) FAdd 129 133
|
||||
135: 32(int) Load 119(d)
|
||||
136: 6(float) ConvertSToF 135
|
||||
137: 7(fvec4) Load 26(input)
|
||||
138: 7(fvec4) VectorTimesScalar 137 136
|
||||
139: 7(fvec4) FAdd 134 138
|
||||
Store 120(ret) 139
|
||||
142: 32(int) Load 115(b)
|
||||
145: 13(bool) INotEqual 142 144
|
||||
SelectionMerge 147 None
|
||||
BranchConditional 145 146 149
|
||||
146: Label
|
||||
148: 32(int) Load 119(d)
|
||||
Store 117(c) 148
|
||||
Store 141 148
|
||||
Branch 147
|
||||
149: Label
|
||||
Store 141 150
|
||||
Branch 147
|
||||
147: Label
|
||||
151: 32(int) Load 141
|
||||
Store 113(a) 151
|
||||
Store 140(e) 151
|
||||
153: 32(int) Load 113(a)
|
||||
154: 13(bool) INotEqual 153 144
|
||||
SelectionMerge 156 None
|
||||
BranchConditional 154 155 158
|
||||
155: Label
|
||||
157: 32(int) Load 117(c)
|
||||
Store 119(d) 157
|
||||
Store 152 157
|
||||
Branch 156
|
||||
158: Label
|
||||
Store 152 159
|
||||
Branch 156
|
||||
156: Label
|
||||
160: 32(int) Load 152
|
||||
Store 115(b) 160
|
||||
164: 163(ptr) AccessChain 120(ret) 144
|
||||
165: 6(float) Load 164
|
||||
167: 163(ptr) AccessChain 26(input) 166
|
||||
168: 6(float) Load 167
|
||||
169: 13(bool) FOrdLessThan 165 168
|
||||
SelectionMerge 171 None
|
||||
BranchConditional 169 170 176
|
||||
170: Label
|
||||
172: 32(int) Load 117(c)
|
||||
173: 6(float) ConvertSToF 172
|
||||
174: 7(fvec4) Load 26(input)
|
||||
175: 7(fvec4) VectorTimesScalar 174 173
|
||||
Store 162 175
|
||||
Branch 171
|
||||
176: Label
|
||||
177: 32(int) Load 119(d)
|
||||
178: 6(float) ConvertSToF 177
|
||||
179: 7(fvec4) Load 26(input)
|
||||
180: 7(fvec4) VectorTimesScalar 179 178
|
||||
Store 162 180
|
||||
Branch 171
|
||||
171: Label
|
||||
181: 7(fvec4) Load 162
|
||||
Store 161(f) 181
|
||||
182: 32(int) Load 140(e)
|
||||
183: 6(float) ConvertSToF 182
|
||||
184: 7(fvec4) Load 120(ret)
|
||||
185: 7(fvec4) VectorTimesScalar 184 183
|
||||
186: 7(fvec4) Load 161(f)
|
||||
187: 7(fvec4) FAdd 185 186
|
||||
188: 7(fvec4) FunctionCall 9(vectorCond()
|
||||
189: 7(fvec4) FAdd 187 188
|
||||
190: 7(fvec4) FunctionCall 11(scalarCond()
|
||||
191: 7(fvec4) FAdd 189 190
|
||||
Store 200(param) 194
|
||||
Store 201(param) 196
|
||||
Store 202(param) 199
|
||||
203: 16(fvec2) FunctionCall 22(fbSelect(vb2;vf2;vf2;) 200(param) 201(param) 202(param)
|
||||
205: 6(float) CompositeExtract 203 0
|
||||
206: 6(float) CompositeExtract 203 1
|
||||
207: 7(fvec4) CompositeConstruct 205 206 204 204
|
||||
208: 7(fvec4) FAdd 191 207
|
||||
ReturnValue 208
|
||||
110(a): 109(ptr) Variable Function
|
||||
112(b): 109(ptr) Variable Function
|
||||
114(c): 109(ptr) Variable Function
|
||||
116(d): 109(ptr) Variable Function
|
||||
117(ret): 24(ptr) Variable Function
|
||||
137(e): 109(ptr) Variable Function
|
||||
150(f): 24(ptr) Variable Function
|
||||
186(param): 15(ptr) Variable Function
|
||||
187(param): 17(ptr) Variable Function
|
||||
188(param): 17(ptr) Variable Function
|
||||
Store 110(a) 111
|
||||
Store 112(b) 113
|
||||
Store 114(c) 115
|
||||
Store 116(d) 115
|
||||
118: 32(int) Load 110(a)
|
||||
119: 6(float) ConvertSToF 118
|
||||
120: 7(fvec4) Load 26(input)
|
||||
121: 7(fvec4) VectorTimesScalar 120 119
|
||||
122: 32(int) Load 112(b)
|
||||
123: 6(float) ConvertSToF 122
|
||||
124: 7(fvec4) Load 26(input)
|
||||
125: 7(fvec4) VectorTimesScalar 124 123
|
||||
126: 7(fvec4) FAdd 121 125
|
||||
127: 32(int) Load 114(c)
|
||||
128: 6(float) ConvertSToF 127
|
||||
129: 7(fvec4) Load 26(input)
|
||||
130: 7(fvec4) VectorTimesScalar 129 128
|
||||
131: 7(fvec4) FAdd 126 130
|
||||
132: 32(int) Load 116(d)
|
||||
133: 6(float) ConvertSToF 132
|
||||
134: 7(fvec4) Load 26(input)
|
||||
135: 7(fvec4) VectorTimesScalar 134 133
|
||||
136: 7(fvec4) FAdd 131 135
|
||||
Store 117(ret) 136
|
||||
138: 32(int) Load 112(b)
|
||||
141: 13(bool) INotEqual 138 140
|
||||
142: 32(int) Load 116(d)
|
||||
Store 114(c) 142
|
||||
144: 32(int) Select 141 142 143
|
||||
Store 110(a) 144
|
||||
Store 137(e) 144
|
||||
145: 32(int) Load 110(a)
|
||||
146: 13(bool) INotEqual 145 140
|
||||
147: 32(int) Load 114(c)
|
||||
Store 116(d) 147
|
||||
149: 32(int) Select 146 147 148
|
||||
Store 112(b) 149
|
||||
152: 151(ptr) AccessChain 117(ret) 140
|
||||
153: 6(float) Load 152
|
||||
155: 151(ptr) AccessChain 26(input) 154
|
||||
156: 6(float) Load 155
|
||||
157: 13(bool) FOrdLessThan 153 156
|
||||
158: 32(int) Load 114(c)
|
||||
159: 6(float) ConvertSToF 158
|
||||
160: 7(fvec4) Load 26(input)
|
||||
161: 7(fvec4) VectorTimesScalar 160 159
|
||||
162: 32(int) Load 116(d)
|
||||
163: 6(float) ConvertSToF 162
|
||||
164: 7(fvec4) Load 26(input)
|
||||
165: 7(fvec4) VectorTimesScalar 164 163
|
||||
166: 43(bvec4) CompositeConstruct 157 157 157 157
|
||||
167: 7(fvec4) Select 166 161 165
|
||||
Store 150(f) 167
|
||||
168: 32(int) Load 137(e)
|
||||
169: 6(float) ConvertSToF 168
|
||||
170: 7(fvec4) Load 117(ret)
|
||||
171: 7(fvec4) VectorTimesScalar 170 169
|
||||
172: 7(fvec4) Load 150(f)
|
||||
173: 7(fvec4) FAdd 171 172
|
||||
174: 7(fvec4) FunctionCall 9(vectorCond()
|
||||
175: 7(fvec4) FAdd 173 174
|
||||
176: 7(fvec4) FunctionCall 11(scalarCond()
|
||||
177: 7(fvec4) FAdd 175 176
|
||||
Store 186(param) 180
|
||||
Store 187(param) 182
|
||||
Store 188(param) 185
|
||||
189: 16(fvec2) FunctionCall 22(fbSelect(vb2;vf2;vf2;) 186(param) 187(param) 188(param)
|
||||
191: 6(float) CompositeExtract 189 0
|
||||
192: 6(float) CompositeExtract 189 1
|
||||
193: 7(fvec4) CompositeConstruct 191 192 190 190
|
||||
194: 7(fvec4) FAdd 177 193
|
||||
ReturnValue 194
|
||||
FunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user