mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 08:13:27 +00:00
Naga(msl): Clear named expressions after writing each function (#4594)
This appears to match other backends, and fixes fix the case where expressions which were named in earlier functions are used in local variable declarations
This commit is contained in:
parent
ca96cb428c
commit
9d57a60d4b
@ -3643,10 +3643,10 @@ impl<W: Write> Writer<W> {
|
|||||||
writeln!(self.out, ";")?;
|
writeln!(self.out, ";")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.named_expressions.clear();
|
|
||||||
self.update_expressions_to_bake(fun, fun_info, &context.expression);
|
self.update_expressions_to_bake(fun, fun_info, &context.expression);
|
||||||
self.put_block(back::Level(1), &fun.body, &context)?;
|
self.put_block(back::Level(1), &fun.body, &context)?;
|
||||||
writeln!(self.out, "}}")?;
|
writeln!(self.out, "}}")?;
|
||||||
|
self.named_expressions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut info = TranslationInfo {
|
let mut info = TranslationInfo {
|
||||||
@ -4313,13 +4313,13 @@ impl<W: Write> Writer<W> {
|
|||||||
writeln!(self.out, ";")?;
|
writeln!(self.out, ";")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.named_expressions.clear();
|
|
||||||
self.update_expressions_to_bake(fun, fun_info, &context.expression);
|
self.update_expressions_to_bake(fun, fun_info, &context.expression);
|
||||||
self.put_block(back::Level(1), &fun.body, &context)?;
|
self.put_block(back::Level(1), &fun.body, &context)?;
|
||||||
writeln!(self.out, "}}")?;
|
writeln!(self.out, "}}")?;
|
||||||
if ep_index + 1 != module.entry_points.len() {
|
if ep_index + 1 != module.entry_points.len() {
|
||||||
writeln!(self.out)?;
|
writeln!(self.out)?;
|
||||||
}
|
}
|
||||||
|
self.named_expressions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(info)
|
Ok(info)
|
||||||
|
Loading…
Reference in New Issue
Block a user