fn add_or_modify_reuse_image_requirements(
        virtual_resources: &AssignVirtualResourcesResult,
        constraints: &DetermineConstraintsResult,
        pass_index: usize,
        usage: RenderGraphImageUsageId,
        reuse_requirements: &mut Vec<PhysicalImageReuseRequirements>,
        reuse_requirements_lookup: &mut FnvHashMap<VirtualImageId, usize>,
    ) {
        // Get physical ID from usage
        let virtual_id = virtual_resources.image_usage_to_virtual[&usage];

        // Find requirements for this image if they exist, or create new requirements. This is a
        // lookup for an index so that the requirements will be stored sorted by
        // first_node_pass_index for iteration later
        let reused_image_requirements_index = *reuse_requirements_lookup
            .entry(virtual_id)
            .or_insert_with(|| {
                let reused_image_requirements_index = reuse_requirements.len();
                let specification = &constraints.images[&usage];
                reuse_requirements.push(PhysicalImageReuseRequirements {
                    virtual_id,
                    first_node_pass_index: pass_index,
                    last_node_pass_index: pass_index,
                    specification: specification.clone(),
                });

                log::trace!("  Add requirement {:?} {:?}", virtual_id, specification);
                reused_image_requirements_index
            });

        // Update the last pass index
        reuse_requirements[reused_image_requirements_index].last_node_pass_index = pass_index;
    }
//
// This inner function is responsible for populating reuse_requirements and
// reuse_requirements_lookup. The goal here is to determine the lifetimes of all virtual images
//
This inner function is responsible for populating reuse_requirements and
reuse_requirements_lookup. The goal here is to determine the lifetimes of all virtual images
This inner function is responsible for populating reuse_requirements and reuse_requirements_lookup . The goal here is to determine the lifetimes of all virtual images
fn add_or_modify_reuse_image_requirements(
        virtual_resources: &AssignVirtualResourcesResult,
        constraints: &DetermineConstraintsResult,
        pass_index: usize,
        usage: RenderGraphImageUsageId,
        reuse_requirements: &mut Vec<PhysicalImageReuseRequirements>,
        reuse_requirements_lookup: &mut FnvHashMap<VirtualImageId, usize>,
    ) {
        // Get physical ID from usage
        let virtual_id = virtual_resources.image_usage_to_virtual[&usage];
        // Find requirements for this image if they exist, or create new requirements. This is a
        // lookup for an index so that the requirements will be stored sorted by
        // first_node_pass_index for iteration later
        let reused_image_requirements_index = *reuse_requirements_lookup
            .entry(virtual_id)
            .or_insert_with(|| {
                let reused_image_requirements_index = reuse_requirements.len();
                let specification = &constraints.images[&usage];
                reuse_requirements.push(PhysicalImageReuseRequirements {
                    virtual_id,
                    first_node_pass_index: pass_index,
                    last_node_pass_index: pass_index,
                    specification: specification.clone(),
                });
                log::trace!("  Add requirement {:?} {:?}", virtual_id, specification);
                reused_image_requirements_index
            });
        // Update the last pass index
        reuse_requirements[reused_image_requirements_index].last_node_pass_index = pass_index;
    }
fn add_or_modify_reuse_image_requirements ( virtual_resources : & AssignVirtualResourcesResult , constraints : & DetermineConstraintsResult , pass_index : usize , usage : RenderGraphImageUsageId , reuse_requirements : & mut Vec < PhysicalImageReuseRequirements > , reuse_requirements_lookup : & mut FnvHashMap < VirtualImageId , usize > , ) { // Get physical ID from usage let virtual_id = virtual_resources . image_usage_to_virtual [ & usage ] ; // Find requirements for this image if they exist, or create new requirements. This is a // lookup for an index so that the requirements will be stored sorted by // first_node_pass_index for iteration later let reused_image_requirements_index = * reuse_requirements_lookup . entry ( virtual_id ) . or_insert_with ( | | { let reused_image_requirements_index = reuse_requirements . len ( ) ; let specification = & constraints . images [ & usage ] ; reuse_requirements . push ( PhysicalImageReuseRequirements { virtual_id , first_node_pass_index : pass_index , last_node_pass_index : pass_index , specification : specification . clone ( ) , } ) ; log :: trace ! ( " " virtual_id specification ) ; reused_image_requirements_index } ) ; // Update the last pass index reuse_requirements [ reused_image_requirements_index ] . last_node_pass_index = pass_index ; }
This inner function is responsible for populating reuse_requirements and
reuse_requirements_lookup.
This inner function is responsible for populating reuse_requirements and reuse_requirements_lookup .
virtual_resources
&AssignVirtualResourcesResult
constraints
&DetermineConstraintsResult
pass_index
usize
usage
RenderGraphImageUsageId
reuse_requirements
&mut Vec<PhysicalImageReuseRequirements>
reuse_requirements_lookup
&mut FnvHashMap<VirtualImageId, usize>
virtual_resources
&AssignVirtualResourcesResult
constraints
&DetermineConstraintsResult
pass_index
usize
usage
RenderGraphImageUsageId
reuse_requirements
&mut Vec<PhysicalImageReuseRequirements>
reuse_requirements_lookup
&mut FnvHashMap<VirtualImageId, usize>