mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-11 22:44:04 +00:00
spirv-reader: fix mapping of OpLogicalOr, OpLogicalAnd
These work on scalar and vector of bool, and map to ast::BinaryOp::kOr and kAnd. Bug: tint:1043 Change-Id: I009edf8e43c21cb75ccfdcde1106ec177d2fe50e Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59561 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: James Price <jrprice@google.com> Commit-Queue: James Price <jrprice@google.com> Auto-Submit: David Neto <dneto@google.com>
This commit is contained in:
@@ -55,18 +55,10 @@ int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout flo
|
||||
param_3 = float2((x_123 - x_124), (x_127 - x_128));
|
||||
const float x_131 = cross2d_vf2_vf2_(param_2, param_3);
|
||||
pbc = x_131;
|
||||
bool tint_tmp = (x_114 < 0.0f);
|
||||
if (tint_tmp) {
|
||||
tint_tmp = (x_131 < 0.0f);
|
||||
}
|
||||
const bool x_134 = (tint_tmp);
|
||||
const bool x_134 = ((x_114 < 0.0f) & (x_131 < 0.0f));
|
||||
x_141_phi = x_134;
|
||||
if (!(x_134)) {
|
||||
bool tint_tmp_1 = (x_114 >= 0.0f);
|
||||
if (tint_tmp_1) {
|
||||
tint_tmp_1 = (x_131 >= 0.0f);
|
||||
}
|
||||
x_140 = (tint_tmp_1);
|
||||
x_140 = ((x_114 >= 0.0f) & (x_131 >= 0.0f));
|
||||
x_141_phi = x_140;
|
||||
}
|
||||
if (!(x_141_phi)) {
|
||||
@@ -87,18 +79,10 @@ int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout flo
|
||||
param_5 = float2((x_152 - x_153), (x_155 - x_156));
|
||||
const float x_159 = cross2d_vf2_vf2_(param_4, param_5);
|
||||
pca = x_159;
|
||||
bool tint_tmp_2 = (x_114 < 0.0f);
|
||||
if (tint_tmp_2) {
|
||||
tint_tmp_2 = (x_159 < 0.0f);
|
||||
}
|
||||
const bool x_162 = (tint_tmp_2);
|
||||
const bool x_162 = ((x_114 < 0.0f) & (x_159 < 0.0f));
|
||||
x_169_phi = x_162;
|
||||
if (!(x_162)) {
|
||||
bool tint_tmp_3 = (x_114 >= 0.0f);
|
||||
if (tint_tmp_3) {
|
||||
tint_tmp_3 = (x_159 >= 0.0f);
|
||||
}
|
||||
x_168 = (tint_tmp_3);
|
||||
x_168 = ((x_114 >= 0.0f) & (x_159 >= 0.0f));
|
||||
x_169_phi = x_168;
|
||||
}
|
||||
if (!(x_169_phi)) {
|
||||
|
||||
@@ -62,10 +62,10 @@ int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* cons
|
||||
param_3 = float2((x_123 - x_124), (x_127 - x_128));
|
||||
float const x_131 = cross2d_vf2_vf2_(&(param_2), &(param_3));
|
||||
pbc = x_131;
|
||||
bool const x_134 = ((x_114 < 0.0f) && (x_131 < 0.0f));
|
||||
bool const x_134 = ((x_114 < 0.0f) & (x_131 < 0.0f));
|
||||
x_141_phi = x_134;
|
||||
if (!(x_134)) {
|
||||
x_140 = ((x_114 >= 0.0f) && (x_131 >= 0.0f));
|
||||
x_140 = ((x_114 >= 0.0f) & (x_131 >= 0.0f));
|
||||
x_141_phi = x_140;
|
||||
}
|
||||
bool const x_141 = x_141_phi;
|
||||
@@ -87,10 +87,10 @@ int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* cons
|
||||
param_5 = float2((x_152 - x_153), (x_155 - x_156));
|
||||
float const x_159 = cross2d_vf2_vf2_(&(param_4), &(param_5));
|
||||
pca = x_159;
|
||||
bool const x_162 = ((x_114 < 0.0f) && (x_159 < 0.0f));
|
||||
bool const x_162 = ((x_114 < 0.0f) & (x_159 < 0.0f));
|
||||
x_169_phi = x_162;
|
||||
if (!(x_162)) {
|
||||
x_168 = ((x_114 >= 0.0f) && (x_159 >= 0.0f));
|
||||
x_168 = ((x_114 >= 0.0f) & (x_159 >= 0.0f));
|
||||
x_169_phi = x_168;
|
||||
}
|
||||
bool const x_169 = x_169_phi;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 265
|
||||
; Bound: 257
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
@@ -92,22 +92,22 @@
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%void = OpTypeVoid
|
||||
%214 = OpTypeFunction %void
|
||||
%206 = OpTypeFunction %void
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%float_0_699999988 = OpConstant %float 0.699999988
|
||||
%float_0_300000012 = OpConstant %float 0.300000012
|
||||
%233 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012
|
||||
%225 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%float_0_899999976 = OpConstant %float 0.899999976
|
||||
%236 = OpConstantComposite %v2float %float_0_5 %float_0_899999976
|
||||
%228 = OpConstantComposite %v2float %float_0_5 %float_0_899999976
|
||||
%float_0_100000001 = OpConstant %float 0.100000001
|
||||
%float_0_400000006 = OpConstant %float 0.400000006
|
||||
%239 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006
|
||||
%231 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006
|
||||
%float_1 = OpConstant %float 1
|
||||
%250 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%251 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%242 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%243 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%252 = OpTypeFunction %void %main_out
|
||||
%244 = OpTypeFunction %void %main_out
|
||||
%cross2d_vf2_vf2_ = OpFunction %float None %15
|
||||
%a = OpFunctionParameter %_ptr_Function_v2float
|
||||
%b = OpFunctionParameter %_ptr_Function_v2float
|
||||
@@ -204,157 +204,137 @@
|
||||
%137 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_2 %param_3
|
||||
OpStore %pbc %137
|
||||
%141 = OpFOrdLessThan %bool %104 %float_0
|
||||
OpSelectionMerge %142 None
|
||||
OpBranchConditional %141 %143 %142
|
||||
%143 = OpLabel
|
||||
%144 = OpFOrdLessThan %bool %137 %float_0
|
||||
OpBranch %142
|
||||
%142 = OpLabel
|
||||
%145 = OpPhi %bool %141 %73 %144 %143
|
||||
OpStore %x_141_phi %145
|
||||
%146 = OpLogicalNot %bool %145
|
||||
OpSelectionMerge %147 None
|
||||
OpBranchConditional %146 %148 %147
|
||||
%148 = OpLabel
|
||||
%149 = OpFOrdGreaterThanEqual %bool %104 %float_0
|
||||
OpSelectionMerge %150 None
|
||||
OpBranchConditional %149 %151 %150
|
||||
%151 = OpLabel
|
||||
%152 = OpFOrdGreaterThanEqual %bool %137 %float_0
|
||||
OpBranch %150
|
||||
%150 = OpLabel
|
||||
%153 = OpPhi %bool %149 %148 %152 %151
|
||||
OpStore %x_140 %153
|
||||
%154 = OpLoad %bool %x_140
|
||||
OpStore %x_141_phi %154
|
||||
OpBranch %147
|
||||
%147 = OpLabel
|
||||
%155 = OpLoad %bool %x_141_phi
|
||||
%156 = OpLogicalNot %bool %155
|
||||
OpSelectionMerge %157 None
|
||||
OpBranchConditional %156 %158 %157
|
||||
%158 = OpLabel
|
||||
%142 = OpFOrdLessThan %bool %137 %float_0
|
||||
%143 = OpLogicalAnd %bool %141 %142
|
||||
OpStore %x_141_phi %143
|
||||
%144 = OpLogicalNot %bool %143
|
||||
OpSelectionMerge %145 None
|
||||
OpBranchConditional %144 %146 %145
|
||||
%146 = OpLabel
|
||||
%147 = OpFOrdGreaterThanEqual %bool %104 %float_0
|
||||
%148 = OpFOrdGreaterThanEqual %bool %137 %float_0
|
||||
%149 = OpLogicalAnd %bool %147 %148
|
||||
OpStore %x_140 %149
|
||||
%150 = OpLoad %bool %x_140
|
||||
OpStore %x_141_phi %150
|
||||
OpBranch %145
|
||||
%145 = OpLabel
|
||||
%151 = OpLoad %bool %x_141_phi
|
||||
%152 = OpLogicalNot %bool %151
|
||||
OpSelectionMerge %153 None
|
||||
OpBranchConditional %152 %154 %153
|
||||
%154 = OpLabel
|
||||
OpStore %x_90 %true
|
||||
OpStore %x_91 %int_0
|
||||
OpStore %x_173_phi %int_0
|
||||
OpBranch %72
|
||||
%157 = OpLabel
|
||||
%162 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%163 = OpLoad %float %162
|
||||
%165 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%166 = OpLoad %float %165
|
||||
%168 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%169 = OpLoad %float %168
|
||||
%171 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%172 = OpLoad %float %171
|
||||
%174 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%175 = OpLoad %float %174
|
||||
%177 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%178 = OpLoad %float %177
|
||||
%180 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%181 = OpLoad %float %180
|
||||
%183 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%184 = OpLoad %float %183
|
||||
%185 = OpFSub %float %163 %166
|
||||
%186 = OpFSub %float %169 %172
|
||||
%187 = OpCompositeConstruct %v2float %185 %186
|
||||
OpStore %param_4 %187
|
||||
%188 = OpFSub %float %175 %178
|
||||
%189 = OpFSub %float %181 %184
|
||||
%190 = OpCompositeConstruct %v2float %188 %189
|
||||
OpStore %param_5 %190
|
||||
%191 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5
|
||||
OpStore %pca %191
|
||||
%194 = OpFOrdLessThan %bool %104 %float_0
|
||||
OpSelectionMerge %195 None
|
||||
OpBranchConditional %194 %196 %195
|
||||
%196 = OpLabel
|
||||
%197 = OpFOrdLessThan %bool %191 %float_0
|
||||
OpBranch %195
|
||||
%153 = OpLabel
|
||||
%158 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%159 = OpLoad %float %158
|
||||
%161 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%162 = OpLoad %float %161
|
||||
%164 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%165 = OpLoad %float %164
|
||||
%167 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%168 = OpLoad %float %167
|
||||
%170 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%171 = OpLoad %float %170
|
||||
%173 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%174 = OpLoad %float %173
|
||||
%176 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%177 = OpLoad %float %176
|
||||
%179 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%180 = OpLoad %float %179
|
||||
%181 = OpFSub %float %159 %162
|
||||
%182 = OpFSub %float %165 %168
|
||||
%183 = OpCompositeConstruct %v2float %181 %182
|
||||
OpStore %param_4 %183
|
||||
%184 = OpFSub %float %171 %174
|
||||
%185 = OpFSub %float %177 %180
|
||||
%186 = OpCompositeConstruct %v2float %184 %185
|
||||
OpStore %param_5 %186
|
||||
%187 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5
|
||||
OpStore %pca %187
|
||||
%190 = OpFOrdLessThan %bool %104 %float_0
|
||||
%191 = OpFOrdLessThan %bool %187 %float_0
|
||||
%192 = OpLogicalAnd %bool %190 %191
|
||||
OpStore %x_169_phi %192
|
||||
%193 = OpLogicalNot %bool %192
|
||||
OpSelectionMerge %194 None
|
||||
OpBranchConditional %193 %195 %194
|
||||
%195 = OpLabel
|
||||
%198 = OpPhi %bool %194 %157 %197 %196
|
||||
OpStore %x_169_phi %198
|
||||
%199 = OpLogicalNot %bool %198
|
||||
OpSelectionMerge %200 None
|
||||
OpBranchConditional %199 %201 %200
|
||||
%201 = OpLabel
|
||||
%202 = OpFOrdGreaterThanEqual %bool %104 %float_0
|
||||
OpSelectionMerge %203 None
|
||||
OpBranchConditional %202 %204 %203
|
||||
%204 = OpLabel
|
||||
%205 = OpFOrdGreaterThanEqual %bool %191 %float_0
|
||||
OpBranch %203
|
||||
%196 = OpFOrdGreaterThanEqual %bool %104 %float_0
|
||||
%197 = OpFOrdGreaterThanEqual %bool %187 %float_0
|
||||
%198 = OpLogicalAnd %bool %196 %197
|
||||
OpStore %x_168 %198
|
||||
%199 = OpLoad %bool %x_168
|
||||
OpStore %x_169_phi %199
|
||||
OpBranch %194
|
||||
%194 = OpLabel
|
||||
%200 = OpLoad %bool %x_169_phi
|
||||
%201 = OpLogicalNot %bool %200
|
||||
OpSelectionMerge %202 None
|
||||
OpBranchConditional %201 %203 %202
|
||||
%203 = OpLabel
|
||||
%206 = OpPhi %bool %202 %201 %205 %204
|
||||
OpStore %x_168 %206
|
||||
%207 = OpLoad %bool %x_168
|
||||
OpStore %x_169_phi %207
|
||||
OpBranch %200
|
||||
%200 = OpLabel
|
||||
%208 = OpLoad %bool %x_169_phi
|
||||
%209 = OpLogicalNot %bool %208
|
||||
OpSelectionMerge %210 None
|
||||
OpBranchConditional %209 %211 %210
|
||||
%211 = OpLabel
|
||||
OpStore %x_90 %true
|
||||
OpStore %x_91 %int_0
|
||||
OpStore %x_173_phi %int_0
|
||||
OpBranch %72
|
||||
%210 = OpLabel
|
||||
%202 = OpLabel
|
||||
OpStore %x_90 %true
|
||||
OpStore %x_91 %int_1
|
||||
OpStore %x_173_phi %int_1
|
||||
OpBranch %72
|
||||
%72 = OpLabel
|
||||
%213 = OpLoad %int %x_173_phi
|
||||
OpReturnValue %213
|
||||
%205 = OpLoad %int %x_173_phi
|
||||
OpReturnValue %205
|
||||
OpFunctionEnd
|
||||
%main_1 = OpFunction %void None %214
|
||||
%217 = OpLabel
|
||||
%main_1 = OpFunction %void None %206
|
||||
%209 = OpLabel
|
||||
%pos = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_6 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_7 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_8 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_9 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%223 = OpLoad %v4float %gl_FragCoord
|
||||
%225 = OpAccessChain %_ptr_Uniform_v2float %x_24 %uint_0
|
||||
%226 = OpLoad %v2float %225
|
||||
%227 = OpCompositeExtract %float %223 0
|
||||
%228 = OpCompositeExtract %float %223 1
|
||||
%229 = OpCompositeConstruct %v2float %227 %228
|
||||
%230 = OpFDiv %v2float %229 %226
|
||||
OpStore %pos %230
|
||||
OpStore %param_6 %230
|
||||
OpStore %param_7 %233
|
||||
OpStore %param_8 %236
|
||||
OpStore %param_9 %239
|
||||
%240 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9
|
||||
%245 = OpIEqual %bool %240 %int_1
|
||||
OpSelectionMerge %246 None
|
||||
OpBranchConditional %245 %247 %248
|
||||
%247 = OpLabel
|
||||
OpStore %x_GLF_color %250
|
||||
OpBranch %246
|
||||
%248 = OpLabel
|
||||
OpStore %x_GLF_color %251
|
||||
OpBranch %246
|
||||
%246 = OpLabel
|
||||
%215 = OpLoad %v4float %gl_FragCoord
|
||||
%217 = OpAccessChain %_ptr_Uniform_v2float %x_24 %uint_0
|
||||
%218 = OpLoad %v2float %217
|
||||
%219 = OpCompositeExtract %float %215 0
|
||||
%220 = OpCompositeExtract %float %215 1
|
||||
%221 = OpCompositeConstruct %v2float %219 %220
|
||||
%222 = OpFDiv %v2float %221 %218
|
||||
OpStore %pos %222
|
||||
OpStore %param_6 %222
|
||||
OpStore %param_7 %225
|
||||
OpStore %param_8 %228
|
||||
OpStore %param_9 %231
|
||||
%232 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9
|
||||
%237 = OpIEqual %bool %232 %int_1
|
||||
OpSelectionMerge %238 None
|
||||
OpBranchConditional %237 %239 %240
|
||||
%239 = OpLabel
|
||||
OpStore %x_GLF_color %242
|
||||
OpBranch %238
|
||||
%240 = OpLabel
|
||||
OpStore %x_GLF_color %243
|
||||
OpBranch %238
|
||||
%238 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_3 = OpFunction %void None %252
|
||||
%tint_symbol_3 = OpFunction %void None %244
|
||||
%tint_symbol_1 = OpFunctionParameter %main_out
|
||||
%256 = OpLabel
|
||||
%257 = OpCompositeExtract %v4float %tint_symbol_1 0
|
||||
OpStore %tint_symbol_2 %257
|
||||
%248 = OpLabel
|
||||
%249 = OpCompositeExtract %v4float %tint_symbol_1 0
|
||||
OpStore %tint_symbol_2 %249
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %214
|
||||
%259 = OpLabel
|
||||
%260 = OpLoad %v4float %tint_symbol
|
||||
OpStore %gl_FragCoord %260
|
||||
%261 = OpFunctionCall %void %main_1
|
||||
%263 = OpLoad %v4float %x_GLF_color
|
||||
%264 = OpCompositeConstruct %main_out %263
|
||||
%262 = OpFunctionCall %void %tint_symbol_3 %264
|
||||
%main = OpFunction %void None %206
|
||||
%251 = OpLabel
|
||||
%252 = OpLoad %v4float %tint_symbol
|
||||
OpStore %gl_FragCoord %252
|
||||
%253 = OpFunctionCall %void %main_1
|
||||
%255 = OpLoad %v4float %x_GLF_color
|
||||
%256 = OpCompositeConstruct %main_out %255
|
||||
%254 = OpFunctionCall %void %tint_symbol_3 %256
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
@@ -68,10 +68,10 @@ fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr<function, vec2<f32>>, a_1 : ptr<func
|
||||
param_3 = vec2<f32>((x_123 - x_124), (x_127 - x_128));
|
||||
let x_131 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3));
|
||||
pbc = x_131;
|
||||
let x_134 : bool = ((x_114 < 0.0) && (x_131 < 0.0));
|
||||
let x_134 : bool = ((x_114 < 0.0) & (x_131 < 0.0));
|
||||
x_141_phi = x_134;
|
||||
if (!(x_134)) {
|
||||
x_140 = ((x_114 >= 0.0) && (x_131 >= 0.0));
|
||||
x_140 = ((x_114 >= 0.0) & (x_131 >= 0.0));
|
||||
x_141_phi = x_140;
|
||||
}
|
||||
let x_141 : bool = x_141_phi;
|
||||
@@ -93,10 +93,10 @@ fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr<function, vec2<f32>>, a_1 : ptr<func
|
||||
param_5 = vec2<f32>((x_152 - x_153), (x_155 - x_156));
|
||||
let x_159 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5));
|
||||
pca = x_159;
|
||||
let x_162 : bool = ((x_114 < 0.0) && (x_159 < 0.0));
|
||||
let x_162 : bool = ((x_114 < 0.0) & (x_159 < 0.0));
|
||||
x_169_phi = x_162;
|
||||
if (!(x_162)) {
|
||||
x_168 = ((x_114 >= 0.0) && (x_159 >= 0.0));
|
||||
x_168 = ((x_114 >= 0.0) & (x_159 >= 0.0));
|
||||
x_169_phi = x_168;
|
||||
}
|
||||
let x_169 : bool = x_169_phi;
|
||||
|
||||
Reference in New Issue
Block a user