[msl] fix Select on vectors

This commit is contained in:
Dzmitry Malyshau 2021-03-26 01:02:07 -04:00 committed by Dzmitry Malyshau
parent a090afa3f5
commit 00f4c07609

View File

@ -522,19 +522,37 @@ impl<W: Write> Writer<W> {
condition, condition,
accept, accept,
reject, reject,
} => { } => match *context.resolve_type(condition) {
if !is_scoped { crate::TypeInner::Scalar {
write!(self.out, "(")?; kind: crate::ScalarKind::Bool,
..
} => {
if !is_scoped {
write!(self.out, "(")?;
}
self.put_expression(condition, context, false)?;
write!(self.out, " ? ")?;
self.put_expression(accept, context, false)?;
write!(self.out, " : ")?;
self.put_expression(reject, context, false)?;
if !is_scoped {
write!(self.out, ")")?;
}
} }
self.put_expression(condition, context, false)?; crate::TypeInner::Vector {
write!(self.out, " ? ")?; kind: crate::ScalarKind::Bool,
self.put_expression(accept, context, false)?; ..
write!(self.out, " : ")?; } => {
self.put_expression(reject, context, false)?; write!(self.out, "{}::select(", NAMESPACE)?;
if !is_scoped { self.put_expression(accept, context, true)?;
write!(self.out, ", ")?;
self.put_expression(reject, context, true)?;
write!(self.out, ", ")?;
self.put_expression(condition, context, true)?;
write!(self.out, ")")?; write!(self.out, ")")?;
} }
} _ => return Err(Error::Validation),
},
crate::Expression::Derivative { axis, expr } => { crate::Expression::Derivative { axis, expr } => {
let op = match axis { let op = match axis {
crate::DerivativeAxis::X => "dfdx", crate::DerivativeAxis::X => "dfdx",