From 9d57a60d4bd7996e9b22f7267060e5233c42b443 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 2 Nov 2023 18:46:36 +0000 Subject: [PATCH] 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 --- naga/src/back/msl/writer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/naga/src/back/msl/writer.rs b/naga/src/back/msl/writer.rs index 09f7b1c73f..d93ad65062 100644 --- a/naga/src/back/msl/writer.rs +++ b/naga/src/back/msl/writer.rs @@ -3643,10 +3643,10 @@ impl Writer { writeln!(self.out, ";")?; } - self.named_expressions.clear(); self.update_expressions_to_bake(fun, fun_info, &context.expression); self.put_block(back::Level(1), &fun.body, &context)?; writeln!(self.out, "}}")?; + self.named_expressions.clear(); } let mut info = TranslationInfo { @@ -4313,13 +4313,13 @@ impl Writer { writeln!(self.out, ";")?; } - self.named_expressions.clear(); self.update_expressions_to_bake(fun, fun_info, &context.expression); self.put_block(back::Level(1), &fun.body, &context)?; writeln!(self.out, "}}")?; if ep_index + 1 != module.entry_points.len() { writeln!(self.out)?; } + self.named_expressions.clear(); } Ok(info)