pub fn on_frame_complete(
        &mut self,
        device_context: &VkDeviceContext,
    ) -> VkResult<()> {
        self.frame_index += Wrapping(1);

        // Determine how many resources we should drain
        let mut resources_to_drop = 0;
        for resource_in_flight in &self.resources_in_flight {
            // If frame_index matches or exceeds live_until_frame, then the result will be a very
            // high value due to wrapping a negative value to u32::MAX
            if resource_in_flight.live_until_frame - self.frame_index > Wrapping(std::u32::MAX / 2)
            {
                resources_to_drop += 1;
            } else {
                break;
            }
        }

        // Reset them and add them to the list of pools ready to be allocated
        let resources_to_drop: Vec<_> = self
            .resources_in_flight
            .drain(0..resources_to_drop)
            .collect();
        for resource_to_drop in resources_to_drop {
            T::destroy(device_context, resource_to_drop.resource)?;
        }

        Ok(())
    }
/// Call when we are ready to drop another set of resources, most likely when a frame is
/// presented or a new frame begins
Call when we are ready to drop another set of resources, most likely when a frame is
presented or a new frame begins
Call when we are ready to drop another set of resources most likely when a frame is presented or a new frame begins
pub fn on_frame_complete(
        &mut self,
        device_context: &VkDeviceContext,
    ) -> VkResult<()> {
        self.frame_index += Wrapping(1);
        // Determine how many resources we should drain
        let mut resources_to_drop = 0;
        for resource_in_flight in &self.resources_in_flight {
            // If frame_index matches or exceeds live_until_frame, then the result will be a very
            // high value due to wrapping a negative value to u32::MAX
            if resource_in_flight.live_until_frame - self.frame_index > Wrapping(std::u32::MAX / 2)
            {
                resources_to_drop += 1;
            } else {
                break;
            }
        }
        // Reset them and add them to the list of pools ready to be allocated
        let resources_to_drop: Vec<_> = self
            .resources_in_flight
            .drain(0..resources_to_drop)
            .collect();
        for resource_to_drop in resources_to_drop {
            T::destroy(device_context, resource_to_drop.resource)?;
        }
        Ok(())
    }
pub fn on_frame_complete ( & mut self , device_context : & VkDeviceContext , ) -> VkResult < ( ) > { self . frame_index += Wrapping ( 1 ) ; // Determine how many resources we should drain let mut resources_to_drop = 0 ; for resource_in_flight in & self . resources_in_flight { // If frame_index matches or exceeds live_until_frame, then the result will be a very // high value due to wrapping a negative value to u32::MAX if resource_in_flight . live_until_frame - self . frame_index > Wrapping ( std :: u32 :: MAX / 2 ) { resources_to_drop += 1 ; } else { break ; } } // Reset them and add them to the list of pools ready to be allocated let resources_to_drop : Vec < _ > = self . resources_in_flight . drain ( 0 .. resources_to_drop ) . collect ( ) ; for resource_to_drop in resources_to_drop { T :: destroy ( device_context , resource_to_drop . resource ) ? ; } Ok ( ( ) ) }
Call when we are ready to drop another set of resources, most likely when a frame is
presented or a new frame begins
Call when we are ready to drop another set of resources most likely when a frame is presented or a new frame begins
&mut self
device_context
&VkDeviceContext
&mut self
device_context
&VkDeviceContext