diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e47daa9bf..b0a0da99b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,11 +44,14 @@ For naga changelogs at or before v0.14.0. See [naga's changelog](naga/CHANGELOG. ### Bug Fixes - #### WGL - Create a hidden window per `wgpu::Instance` instead of sharing a global one. +#### Naga MSL-OUT + +- Fix issue where local variables were sometimes using variable names from previous functions. + ## v0.18.0 (2023-10-25) ### Desktop OpenGL 3.3+ Support on Windows 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)