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 { pub fn fits_in(&self, total_mips: u32) -> bool {
self.start < total_mips && (self.end == vk::REMAINING_MIP_LEVELS || self.end <= total_mips) 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 { 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.allocate_ref_ranges(&self.pass_descs);
refmap.ref_passes(&self.pass_descs); refmap.ref_passes(&self.pass_descs);
let dag = refmap.build_dag(); let dag = refmap.build_dag();
let topo = refmap.toposort_dag(dag);
topo refmap.toposort_dag(dag)
}); });
// create internal resources: // create internal resources:
@ -492,7 +492,7 @@ impl RenderGraph {
let resources = &self.resources; let resources = &self.resources;
let cmds = topo let cmds = topo
.iter() .into_iter()
.rev() .rev()
.map(|(passes, accesses)| { .map(|(passes, accesses)| {
let passes = passes let passes = passes
@ -541,13 +541,10 @@ impl RenderGraph {
} }
pub fn get_outputs(&mut self) -> BTreeMap<GraphResourceId, GraphResource> { pub fn get_outputs(&mut self) -> BTreeMap<GraphResourceId, GraphResource> {
let outputs = self self.outputs
.outputs .keys()
.iter() .map(|id| (*id, core::mem::take(&mut self.resources[id.0 as usize])))
.map(|(id, _)| (*id, core::mem::take(&mut self.resources[id.0 as usize]))) .collect::<BTreeMap<_, _>>()
.collect::<BTreeMap<_, _>>();
outputs
} }
pub fn transition_resource( pub fn transition_resource(
@ -682,7 +679,7 @@ mod graph_resolver {
Self { Self {
num_resources, num_resources,
num_passes, 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_ranges: Vec::new(),
ref_accesses: Vec::new(), ref_accesses: Vec::new(),
ref_access_passid: Vec::new(), ref_access_passid: Vec::new(),
@ -1034,31 +1031,31 @@ mod graph_resolver {
dag.remove_node(sink); dag.remove_node(sink);
} }
#[cfg(any(debug_assertions, test))] // #[cfg(any(debug_assertions, test))]
std::fs::write( // std::fs::write(
"render_graph2.dot", // "render_graph2.dot",
&format!( // &format!(
"{:?}", // "{:?}",
petgraph::dot::Dot::with_attr_getters( // petgraph::dot::Dot::with_attr_getters(
&dag, // &dag,
&[], // &[],
&|_graph, edgeref| { // &|_graph, edgeref| {
format!( // format!(
"label = \"{},{:#?}\"", // "label = \"{},{:#?}\"",
edgeref.weight().0, // edgeref.weight().0,
edgeref.weight().1, // edgeref.weight().1,
) // )
}, // },
&|_graph, noderef| { // &|_graph, noderef| {
format!( // format!(
"label = \"Pass({:?})\"", // "label = \"Pass({:?})\"",
petgraph::visit::NodeRef::weight(&noderef) // petgraph::visit::NodeRef::weight(&noderef)
) // )
} // }
) // )
), // ),
) // )
.expect("writing render_graph repr"); // .expect("writing render_graph repr");
dag dag
} }

View file

@ -1,5 +1,4 @@
use std::{ use std::{
collections::HashMap,
mem::ManuallyDrop, mem::ManuallyDrop,
num::NonZero, num::NonZero,
ops::Deref, ops::Deref,
@ -37,7 +36,7 @@ pub struct Surface {
// destroy surface after any fields that depend on it // destroy surface after any fields that depend on it
_drop_guard: DropGuard, _drop_guard: DropGuard,
// drop reference to instance after destroying the surface // drop reference to instance after destroying the surface
pub(crate) instance: Instance, pub(crate) _instance: Instance,
} }
impl Surface { impl Surface {
@ -81,7 +80,7 @@ impl Surface {
Ok(Self { Ok(Self {
raw, raw,
swapchain: RwLock::new(None), swapchain: RwLock::new(None),
instance: instance.clone(), _instance: instance.clone(),
// the surface must be destroyed after the swapchain // the surface must be destroyed after the swapchain
_drop_guard: DropGuard::new({ _drop_guard: DropGuard::new({
@ -125,7 +124,7 @@ impl Surface {
Ok(Self { Ok(Self {
raw, raw,
swapchain: RwLock::new(None), swapchain: RwLock::new(None),
instance: instance.clone(), _instance: instance.clone(),
// the surface must be destroyed after the swapchain // the surface must be destroyed after the swapchain
_drop_guard: DropGuard::new({ _drop_guard: DropGuard::new({

View file

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