From ec8d82744da040c93bb0da8137063cc0bd09ae32 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Tue, 17 Nov 2026 11:11:54 -0800 Subject: [PATCH] rt: the emulated module boxed in its lowering; the reaper's end takes the lowerings left Clippy: Lowered::Made held a Kernel beside three small variants (large_enum_variant), and the reaper's end drained the queue into a new one (drain_collect). --- crates/metal2vulkan-rt/src/pipeline.rs | 6 +++--- crates/metal2vulkan-rt/src/reaper.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/metal2vulkan-rt/src/pipeline.rs b/crates/metal2vulkan-rt/src/pipeline.rs index 394a481ea..19ad7a37e 100644 --- a/crates/metal2vulkan-rt/src/pipeline.rs +++ b/crates/metal2vulkan-rt/src/pipeline.rs @@ -99,7 +99,7 @@ pub(crate) struct Emulated { /// What the reaper's lowering of an emulated variant gave. pub(crate) enum Lowered { /// The module, and the translator's notes of it. - Made(Kernel, Vec), + Made(Box, Vec), /// The translator refused the variant, or it reads what the compute encoder does not supply. Refused, /// `vkCreateShaderModule` failed. @@ -742,7 +742,7 @@ impl PipelineInner { } }; match lowered { - Lowered::Made(kernel, _) => Ok(kernel), + Lowered::Made(kernel, _) => Ok(&**kernel), Lowered::Refused => Err(refused), &Lowered::Failed(result) => Err(Error::Vulkan { call: "vkCreateShaderModule", @@ -782,7 +782,7 @@ impl Emulated { }; let notes = pipeline.stage.precision_notes.clone(); match Kernel::new(core, pipeline, descriptor.required_threads_per_threadgroup) { - Ok(kernel) => Lowered::Made(kernel, notes), + Ok(kernel) => Lowered::Made(Box::new(kernel), notes), Err(Error::Vulkan { result, .. }) => Lowered::Failed(result), Err(_) => Lowered::Refused, } diff --git a/crates/metal2vulkan-rt/src/reaper.rs b/crates/metal2vulkan-rt/src/reaper.rs index efe1c1877..e55a12f2a 100644 --- a/crates/metal2vulkan-rt/src/reaper.rs +++ b/crates/metal2vulkan-rt/src/reaper.rs @@ -174,7 +174,7 @@ pub(crate) fn run(core: Arc) { break Next::Job(job); } if state.stop { - break Next::End(state.lowerings.drain(..).collect()); + break Next::End(std::mem::take(&mut state.lowerings)); } if let Some(lowering) = state.lowerings.pop_front() { break Next::Lower(lowering);