Skip to content

Commit 817989b

Browse files
fix(naga): properly impl. auto. type conv. for select
1 parent 5b50fe3 commit 817989b

File tree

1 file changed

+17
-2
lines changed
  • naga/src/front/wgsl/lower

1 file changed

+17
-2
lines changed

naga/src/front/wgsl/lower/mod.rs

+17-2
Original file line numberDiff line numberDiff line change
@@ -2483,8 +2483,23 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
24832483
"select" => {
24842484
let mut args = ctx.prepare_args(arguments, 3, span);
24852485

2486-
let reject = self.expression(args.next()?, ctx)?;
2487-
let accept = self.expression(args.next()?, ctx)?;
2486+
let mut values = [
2487+
self.expression_for_abstract(args.next()?, ctx)?,
2488+
self.expression_for_abstract(args.next()?, ctx)?,
2489+
];
2490+
for &value in &values {
2491+
ctx.grow_types(value)?;
2492+
}
2493+
if let Ok(consensus_scalar) =
2494+
ctx.automatic_conversion_consensus(&values)
2495+
{
2496+
ctx.convert_slice_to_common_leaf_scalar(
2497+
&mut values,
2498+
consensus_scalar,
2499+
)?;
2500+
}
2501+
2502+
let [reject, accept] = values;
24882503
let condition = self.expression(args.next()?, ctx)?;
24892504

24902505
args.finish()?;

0 commit comments

Comments
 (0)