[msl] fix constant array initialization

This commit is contained in:
Dzmitry Malyshau authored and Dzmitry Malyshau committed 2021-03-30 00:38:00 -04:00
1 parent 057fa336a8
commit baccfc68f5
2 files changed
+3 -7

No files matched your search

+2 -6
View File
@@ -1189,17 +1189,13 @@ impl<W: Write> Writer<W> {
crate::ConstantInner::Composite { ty, ref components } => {
let name = &self.names[&NameKey::Constant(handle)];
let ty_name = &self.names[&NameKey::Type(ty)];
write!(
self.out,
"constexpr constant {} {} = {}(",
ty_name, name, ty_name
)?;
write!(self.out, "constexpr constant {} {} = {{", ty_name, name,)?;
for (i, &sub_handle) in components.iter().enumerate() {
let separator = if i != 0 { ", " } else { "" };
let sub_name = &self.names[&NameKey::Constant(sub_handle)];
write!(self.out, "{}{}", separator, sub_name)?;
}
writeln!(self.out, ");")?;
writeln!(self.out, "}};")?;
}
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ typedef uint type6;
typedef float type7;
typedef metal::float2 type8;
typedef metal::float3 type9;
constexpr constant type9 c_ambient = type9(const_0_05f, const_0_05f, const_0_05f);
constexpr constant type9 c_ambient = {const_0_05f, const_0_05f, const_0_05f};
type7 fetch_shadow(
type6 light_id,
type2 homogeneous_coords,