This commit is contained in:
janis 2026-04-04 13:01:52 +02:00
parent 3c59cf022a
commit cf3244197e
4 changed files with 38 additions and 50 deletions

View file

@ -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<u32> {
if self.end == vk::REMAINING_ARRAY_LAYERS {
None
} else {
Some(self.end)
}
}
}
impl<R: core::ops::RangeBounds<u32>> From<R> for MipRange {

View file

@ -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<GraphResourceId, GraphResource> {
let outputs = self
.outputs
.iter()
.map(|(id, _)| (*id, core::mem::take(&mut self.resources[id.0 as usize])))
.collect::<BTreeMap<_, _>>();
outputs
self.outputs
.keys()
.map(|id| (*id, core::mem::take(&mut self.resources[id.0 as usize])))
.collect::<BTreeMap<_, _>>()
}
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
}

View file

@ -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({

View file

@ -783,7 +783,7 @@ pub struct CStringList {
}
impl CStringList {
pub fn from_iter<I, S>(i: I) -> CStringList
pub fn from_strings<I, S>(i: I) -> CStringList
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
@ -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,
}