From 98649a79a0837a4f4dc0570d5a72ff06531ee58d Mon Sep 17 00:00:00 2001 From: Junjun Dong Date: Sun, 16 Feb 2025 18:43:24 -0800 Subject: [PATCH] feat: update naga::back::spv::Function::to_words (#7156) --- CHANGELOG.md | 1 + naga/src/back/spv/ray.rs | 1 - naga/src/back/spv/writer.rs | 3 +-- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f14482910..d6d5de79b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -130,6 +130,7 @@ By @cwfitzgerald in [#7030](https://github.com/gfx-rs/wgpu/pull/7030). - Support @must_use attribute on function declarations. By @turbocrime in [#6801](https://github.com/gfx-rs/wgpu/pull/6801). - Support for generating the candidate intersections from AABB geometry, and confirming the hits. By @kvark in [#7047](https://github.com/gfx-rs/wgpu/pull/7047). +- Make naga::back::spv::Function::to_words write the OpFunctionEnd instruction in itself, instead of making another call after it. By @junjunjd in [#7156](https://github.com/gfx-rs/wgpu/pull/7156). ### Changes diff --git a/naga/src/back/spv/ray.rs b/naga/src/back/spv/ray.rs index b8e5281ac..4a1768173 100644 --- a/naga/src/back/spv/ray.rs +++ b/naga/src/back/spv/ray.rs @@ -510,7 +510,6 @@ impl Writer { ); function.to_words(&mut self.logical_layout.function_definitions); - Instruction::function_end().to_words(&mut self.logical_layout.function_definitions); self.ray_get_intersection_function = Some(func_id); func_id } diff --git a/naga/src/back/spv/writer.rs b/naga/src/back/spv/writer.rs index 097791ef3..cc0c227be 100644 --- a/naga/src/back/spv/writer.rs +++ b/naga/src/back/spv/writer.rs @@ -40,6 +40,7 @@ impl Function { instruction.to_words(sink); } } + Instruction::function_end().to_words(sink); } } @@ -544,7 +545,6 @@ impl Writer { function.consume(block, Instruction::return_value(return_id)); function.to_words(&mut self.logical_layout.function_definitions); - Instruction::function_end().to_words(&mut self.logical_layout.function_definitions); Ok(()) } @@ -947,7 +947,6 @@ impl Writer { self.temp_list = temp_list; function.to_words(&mut self.logical_layout.function_definitions); - Instruction::function_end().to_words(&mut self.logical_layout.function_definitions); Ok(function_id) }