From b9fb893701a090f9f84b8bbc8ebfe90dd5380096 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sat, 21 Nov 2026 03:30:44 -0800 Subject: [PATCH] Fragment: what only the storage forms read goes What: - coverage::finish no longer returns whether the function loops over its samples: its one reader, the snapshot plan of the interlocked storage forms, went with them. - The extended-range planned blend's reads_second goes: its readers were the storage forms' fetch arms. Why: lint m3-max-62859 at 9d9998df5d failed clippy with -D warnings on both (an unused variable, lower/fragment/mod.rs:267, and a method never used, lower/arith/extended_range/blend.rs:987). Verified: cargo fmt --all. --- .../src/lower/arith/extended_range/blend.rs | 14 -------------- crates/metal2vulkan/src/lower/fragment/coverage.rs | 6 +++--- crates/metal2vulkan/src/lower/fragment/mod.rs | 2 +- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/crates/metal2vulkan/src/lower/arith/extended_range/blend.rs b/crates/metal2vulkan/src/lower/arith/extended_range/blend.rs index a787ba5bd..526c26e3c 100644 --- a/crates/metal2vulkan/src/lower/arith/extended_range/blend.rs +++ b/crates/metal2vulkan/src/lower/arith/extended_range/blend.rs @@ -982,20 +982,6 @@ impl Blend { .flatten() .any(|a| nodes(a).into_iter().any(reads_constant)) } - - /// Whether the blend reads the second source (the function's index-1 output). - pub fn reads_second(&self) -> bool { - let second = |n: Node| { - matches!( - n, - Node::Atom(Atom::S1 | Atom::S1a) | Node::OneMinus(Atom::S1 | Atom::S1a) - ) - }; - [&self.color, &self.alpha] - .into_iter() - .flatten() - .any(|a| nodes(a).into_iter().any(second)) - } } /// Whether `n` reads the blend color. diff --git a/crates/metal2vulkan/src/lower/fragment/coverage.rs b/crates/metal2vulkan/src/lower/fragment/coverage.rs index 78340a514..4757ef137 100644 --- a/crates/metal2vulkan/src/lower/fragment/coverage.rs +++ b/crates/metal2vulkan/src/lower/fragment/coverage.rs @@ -238,9 +238,9 @@ fn most_samples(limits: &crate::device::Limits) -> u32 { /// derivative, implicit-LOD sample, quad or simdgroup operation, or barrier, refuses the loop. A /// looping function is refused here; any other records in its interface how link treats it /// (`StageIo::coverage_loop`). -pub(super) fn finish(cx: &mut SelectCx<'_>) -> Result { +pub(super) fn finish(cx: &mut SelectCx<'_>) -> Result<(), Error> { let Some(plan) = cx.families.fragment.coverage else { - return Ok(false); + return Ok(()); }; let late = if !cx.families.fragment.discards.is_empty() { Some(CoverageLoopRefusal::Discard) @@ -262,7 +262,7 @@ pub(super) fn finish(cx: &mut SelectCx<'_>) -> Result { (false, None) => CoverageLoop::Unlooped, (false, Some(r)) => CoverageLoop::Refused(r), }; - Ok(plan.looped) + Ok(()) } /// Declare the `Private u32` the loop hands each pass its sample index in. diff --git a/crates/metal2vulkan/src/lower/fragment/mod.rs b/crates/metal2vulkan/src/lower/fragment/mod.rs index cf14e87e8..ada0bb5fb 100644 --- a/crates/metal2vulkan/src/lower/fragment/mod.rs +++ b/crates/metal2vulkan/src/lower/fragment/mod.rs @@ -264,7 +264,7 @@ pub fn finish(cx: &mut SelectCx<'_>, m: &mut Meter) -> Result<(), Error> { if cx.stage == Stage::Fragment && counts_active_lanes(cx) { cx.precision.insert(PrecisionNote::QuadsSplitByClipping); } - let looped = coverage::finish(cx)?; + coverage::finish(cx)?; let interlock = if rog::declared(cx) { Some(rog::mode(cx)?) } else {