From cf3244197e10274fd74721f6c8cd03037cb067dd Mon Sep 17 00:00:00 2001 From: janis Date: Sat, 4 Apr 2026 13:01:52 +0200 Subject: [PATCH] warnings --- crates/renderer/src/images.rs | 8 ---- crates/renderer/src/render_graph.rs | 69 ++++++++++++++--------------- crates/renderer/src/swapchain.rs | 7 ++- crates/renderer/src/util.rs | 4 +- 4 files changed, 38 insertions(+), 50 deletions(-) diff --git a/crates/renderer/src/images.rs b/crates/renderer/src/images.rs index 1ac2455..140e31b 100644 --- a/crates/renderer/src/images.rs +++ b/crates/renderer/src/images.rs @@ -605,14 +605,6 @@ impl MipRange { pub fn fits_in(&self, total_mips: u32) -> bool { self.start < total_mips && (self.end == vk::REMAINING_MIP_LEVELS || self.end <= total_mips) } - - pub(crate) fn end(&self) -> Option { - if self.end == vk::REMAINING_ARRAY_LAYERS { - None - } else { - Some(self.end) - } - } } impl> From for MipRange { diff --git a/crates/renderer/src/render_graph.rs b/crates/renderer/src/render_graph.rs index a56f0d0..db6f580 100644 --- a/crates/renderer/src/render_graph.rs +++ b/crates/renderer/src/render_graph.rs @@ -459,8 +459,8 @@ impl RenderGraph { refmap.allocate_ref_ranges(&self.pass_descs); refmap.ref_passes(&self.pass_descs); let dag = refmap.build_dag(); - let topo = refmap.toposort_dag(dag); - topo + + refmap.toposort_dag(dag) }); // create internal resources: @@ -492,7 +492,7 @@ impl RenderGraph { let resources = &self.resources; let cmds = topo - .iter() + .into_iter() .rev() .map(|(passes, accesses)| { let passes = passes @@ -541,13 +541,10 @@ impl RenderGraph { } pub fn get_outputs(&mut self) -> BTreeMap { - let outputs = self - .outputs - .iter() - .map(|(id, _)| (*id, core::mem::take(&mut self.resources[id.0 as usize]))) - .collect::>(); - - outputs + self.outputs + .keys() + .map(|id| (*id, core::mem::take(&mut self.resources[id.0 as usize]))) + .collect::>() } pub fn transition_resource( @@ -682,7 +679,7 @@ mod graph_resolver { Self { num_resources, num_passes, - references: vec![0; ((num_passes) * num_resources).div_ceil(64) as usize], + references: vec![0; (num_passes * num_resources).div_ceil(64)], ref_ranges: Vec::new(), ref_accesses: Vec::new(), ref_access_passid: Vec::new(), @@ -1034,31 +1031,31 @@ mod graph_resolver { dag.remove_node(sink); } - #[cfg(any(debug_assertions, test))] - std::fs::write( - "render_graph2.dot", - &format!( - "{:?}", - petgraph::dot::Dot::with_attr_getters( - &dag, - &[], - &|_graph, edgeref| { - format!( - "label = \"{},{:#?}\"", - edgeref.weight().0, - edgeref.weight().1, - ) - }, - &|_graph, noderef| { - format!( - "label = \"Pass({:?})\"", - petgraph::visit::NodeRef::weight(&noderef) - ) - } - ) - ), - ) - .expect("writing render_graph repr"); + // #[cfg(any(debug_assertions, test))] + // std::fs::write( + // "render_graph2.dot", + // &format!( + // "{:?}", + // petgraph::dot::Dot::with_attr_getters( + // &dag, + // &[], + // &|_graph, edgeref| { + // format!( + // "label = \"{},{:#?}\"", + // edgeref.weight().0, + // edgeref.weight().1, + // ) + // }, + // &|_graph, noderef| { + // format!( + // "label = \"Pass({:?})\"", + // petgraph::visit::NodeRef::weight(&noderef) + // ) + // } + // ) + // ), + // ) + // .expect("writing render_graph repr"); dag } diff --git a/crates/renderer/src/swapchain.rs b/crates/renderer/src/swapchain.rs index 87ec5a8..b89d824 100644 --- a/crates/renderer/src/swapchain.rs +++ b/crates/renderer/src/swapchain.rs @@ -1,5 +1,4 @@ use std::{ - collections::HashMap, mem::ManuallyDrop, num::NonZero, ops::Deref, @@ -37,7 +36,7 @@ pub struct Surface { // destroy surface after any fields that depend on it _drop_guard: DropGuard, // drop reference to instance after destroying the surface - pub(crate) instance: Instance, + pub(crate) _instance: Instance, } impl Surface { @@ -81,7 +80,7 @@ impl Surface { Ok(Self { raw, swapchain: RwLock::new(None), - instance: instance.clone(), + _instance: instance.clone(), // the surface must be destroyed after the swapchain _drop_guard: DropGuard::new({ @@ -125,7 +124,7 @@ impl Surface { Ok(Self { raw, swapchain: RwLock::new(None), - instance: instance.clone(), + _instance: instance.clone(), // the surface must be destroyed after the swapchain _drop_guard: DropGuard::new({ diff --git a/crates/renderer/src/util.rs b/crates/renderer/src/util.rs index e4b23f8..be727a7 100644 --- a/crates/renderer/src/util.rs +++ b/crates/renderer/src/util.rs @@ -783,7 +783,7 @@ pub struct CStringList { } impl CStringList { - pub fn from_iter(i: I) -> CStringList + pub fn from_strings(i: I) -> CStringList where I: IntoIterator, S: AsRef, @@ -801,7 +801,7 @@ impl CStringList { Self { strings: strings .into_iter() - .map(|offset| unsafe { bytes.as_ptr().offset(offset as isize) as *const i8 }) + .map(|offset| unsafe { bytes.as_ptr().add(offset) as *const i8 }) .collect(), bytes, }