pub fn poll_load(
        &mut self,
        device_context: &VkDeviceContext,
    ) -> InProgressUploadPollResult {
        loop {
            if let Some(mut inner) = self.take_inner() {
                match inner.upload.state() {
                    Ok(state) => match state {
                        VkTransferUploadState::Writable => {
                            //log::trace!("VkTransferUploadState::Writable");
                            inner
                                .upload
                                .submit_transfer(&device_context.queues().transfer_queue)
                                .unwrap();
                            self.inner = Some(inner);
                        }
                        VkTransferUploadState::SentToTransferQueue => {
                            //log::trace!("VkTransferUploadState::SentToTransferQueue");
                            self.inner = Some(inner);
                            break InProgressUploadPollResult::Pending;
                        }
                        VkTransferUploadState::PendingSubmitDstQueue => {
                            //log::trace!("VkTransferUploadState::PendingSubmitDstQueue");
                            inner
                                .upload
                                .submit_dst(&device_context.queues().graphics_queue)
                                .unwrap();
                            self.inner = Some(inner);
                        }
                        VkTransferUploadState::SentToDstQueue => {
                            //log::trace!("VkTransferUploadState::SentToDstQueue");
                            self.inner = Some(inner);
                            break InProgressUploadPollResult::Pending;
                        }
                        VkTransferUploadState::Complete => {
                            //log::trace!("VkTransferUploadState::Complete");
                            for mut upload in inner.image_uploads {
                                let image = unsafe { ManuallyDrop::take(&mut upload.image) };
                                upload.upload_op.complete(image, upload.load_op);
                            }

                            for mut upload in inner.buffer_uploads {
                                let buffer = unsafe { ManuallyDrop::take(&mut upload.buffer) };
                                upload.upload_op.complete(buffer, upload.load_op);
                            }

                            break InProgressUploadPollResult::Complete;
                        }
                    },
                    Err(err) => {
                        for mut upload in inner.image_uploads {
                            upload.load_op.error(err);
                            upload.upload_op.error();
                            unsafe {
                                ManuallyDrop::drop(&mut upload.image);
                            }
                        }

                        for mut upload in inner.buffer_uploads {
                            upload.load_op.error(err);
                            upload.upload_op.error();
                            unsafe {
                                ManuallyDrop::drop(&mut upload.buffer);
                            }
                        }

                        break InProgressUploadPollResult::Error;
                    }
                }
            } else {
                break InProgressUploadPollResult::Destroyed;
            }
        }
    }
// The main state machine for an upload:
// - Submits on the transfer queue and waits
// - Submits on the graphics queue and waits
//
// Calls load_op.complete() or load_op.error() as appropriate
The main state machine for an upload:
Submits on the transfer queue and waits
Submits on the graphics queue and waits


The main state machine for an upload : Submits on the transfer queue and waits Submits on the graphics queue and waits
pub fn poll_load(
        &mut self,
        device_context: &VkDeviceContext,
    ) -> InProgressUploadPollResult {
        loop {
            if let Some(mut inner) = self.take_inner() {
                match inner.upload.state() {
                    Ok(state) => match state {
                        VkTransferUploadState::Writable => {
                            //log::trace!("VkTransferUploadState::Writable");
                            inner
                                .upload
                                .submit_transfer(&device_context.queues().transfer_queue)
                                .unwrap();
                            self.inner = Some(inner);
                        }
                        VkTransferUploadState::SentToTransferQueue => {
                            //log::trace!("VkTransferUploadState::SentToTransferQueue");
                            self.inner = Some(inner);
                            break InProgressUploadPollResult::Pending;
                        }
                        VkTransferUploadState::PendingSubmitDstQueue => {
                            //log::trace!("VkTransferUploadState::PendingSubmitDstQueue");
                            inner
                                .upload
                                .submit_dst(&device_context.queues().graphics_queue)
                                .unwrap();
                            self.inner = Some(inner);
                        }
                        VkTransferUploadState::SentToDstQueue => {
                            //log::trace!("VkTransferUploadState::SentToDstQueue");
                            self.inner = Some(inner);
                            break InProgressUploadPollResult::Pending;
                        }
                        VkTransferUploadState::Complete => {
                            //log::trace!("VkTransferUploadState::Complete");
                            for mut upload in inner.image_uploads {
                                let image = unsafe { ManuallyDrop::take(&mut upload.image) };
                                upload.upload_op.complete(image, upload.load_op);
                            }
                            for mut upload in inner.buffer_uploads {
                                let buffer = unsafe { ManuallyDrop::take(&mut upload.buffer) };
                                upload.upload_op.complete(buffer, upload.load_op);
                            }
                            break InProgressUploadPollResult::Complete;
                        }
                    },
                    Err(err) => {
                        for mut upload in inner.image_uploads {
                            upload.load_op.error(err);
                            upload.upload_op.error();
                            unsafe {
                                ManuallyDrop::drop(&mut upload.image);
                            }
                        }
                        for mut upload in inner.buffer_uploads {
                            upload.load_op.error(err);
                            upload.upload_op.error();
                            unsafe {
                                ManuallyDrop::drop(&mut upload.buffer);
                            }
                        }
                        break InProgressUploadPollResult::Error;
                    }
                }
            } else {
                break InProgressUploadPollResult::Destroyed;
            }
        }
    }
pub fn poll_load ( & mut self , device_context : & VkDeviceContext , ) -> InProgressUploadPollResult { loop { if let Some ( mut inner ) = self . take_inner ( ) { match inner . upload . state ( ) { Ok ( state ) => match state { VkTransferUploadState :: Writable => { //log::trace!("VkTransferUploadState::Writable"); inner . upload . submit_transfer ( & device_context . queues ( ) . transfer_queue ) . unwrap ( ) ; self . inner = Some ( inner ) ; } VkTransferUploadState :: SentToTransferQueue => { //log::trace!("VkTransferUploadState::SentToTransferQueue"); self . inner = Some ( inner ) ; break InProgressUploadPollResult :: Pending ; } VkTransferUploadState :: PendingSubmitDstQueue => { //log::trace!("VkTransferUploadState::PendingSubmitDstQueue"); inner . upload . submit_dst ( & device_context . queues ( ) . graphics_queue ) . unwrap ( ) ; self . inner = Some ( inner ) ; } VkTransferUploadState :: SentToDstQueue => { //log::trace!("VkTransferUploadState::SentToDstQueue"); self . inner = Some ( inner ) ; break InProgressUploadPollResult :: Pending ; } VkTransferUploadState :: Complete => { //log::trace!("VkTransferUploadState::Complete"); for mut upload in inner . image_uploads { let image = unsafe { ManuallyDrop :: take ( & mut upload . image ) } ; upload . upload_op . complete ( image , upload . load_op ) ; } for mut upload in inner . buffer_uploads { let buffer = unsafe { ManuallyDrop :: take ( & mut upload . buffer ) } ; upload . upload_op . complete ( buffer , upload . load_op ) ; } break InProgressUploadPollResult :: Complete ; } } , Err ( err ) => { for mut upload in inner . image_uploads { upload . load_op . error ( err ) ; upload . upload_op . error ( ) ; unsafe { ManuallyDrop :: drop ( & mut upload . image ) ; } } for mut upload in inner . buffer_uploads { upload . load_op . error ( err ) ; upload . upload_op . error ( ) ; unsafe { ManuallyDrop :: drop ( & mut upload . buffer ) ; } } break InProgressUploadPollResult :: Error ; } } } else { break InProgressUploadPollResult :: Destroyed ; } } }
The main state machine for an upload:
 Submits on the transfer queue and waits
 Submits on the graphics queue and waits
The main state machine for an upload : Submits on the transfer queue and waits Submits on the graphics queue and waits
&mut self
device_context
&VkDeviceContext
&mut self
device_context
&VkDeviceContext