[Metal] Impl Expression::Splat (#738)

* [Metal] Impl `Expression::Splat`

* Add changes to the snapshots

* Apply suggestions
This commit is contained in:
Ashley authored and GitHub committed 2021-04-20 11:41:13 -04:00
1 parent a4ac7b38b2
commit b08dfe5146
5 files changed
+17 -8

No files matched your search

+11 -2
View File
@@ -608,8 +608,17 @@ impl<W: Write> Writer<W> {
};
write!(self.out, "{}", coco)?;
}
crate::Expression::Splat { size: _, value } => {
self.put_expression(value, context, is_scoped)?;
crate::Expression::Splat { size, value } => {
let scalar_kind = match *context.resolve_type(value) {
crate::TypeInner::Scalar { kind, .. } => kind,
_ => return Err(Error::Validation)
};
let scalar = scalar_kind_string(scalar_kind);
let size = vector_size_string(size);
write!(self.out, "{}{}(", scalar, size)?;
self.put_expression(value, context, true)?;
write!(self.out, ")")?;
}
crate::Expression::Compose { ty, ref components } => {
let inner = &context.module.types[ty].inner;