pub unsafe fn sync_graphics_commands<R, Action>(
        &self,
        mut action: Action,
    ) -> Result<R>
    where
        Action: FnMut(vk::CommandBuffer) -> Result<R>,
    {
        let pool = self.shared_graphics_pool.lock().unwrap();
        let command_buffer =
            pool.allocate_command_buffer(&self.logical_device)?;

        let begin_info = vk::CommandBufferBeginInfo {
            flags: vk::CommandBufferUsageFlags::ONE_TIME_SUBMIT,
            ..Default::default()
        };
        self.logical_device
            .begin_command_buffer(command_buffer, &&begin_info)?;

        let result = action(command_buffer);

        self.logical_device.end_command_buffer(command_buffer)?;
        self.submit_and_wait_idle(&self.graphics_queue, command_buffer)?;
        pool.free_command_buffer(&self.logical_device, command_buffer);

        result
    }
/// Synchronously submit commands for execution on the graphics queue.
///
/// This method is internally synchronized and can be called on multiple
/// threads without any additional synchronization.
///
/// This method forces the device to wait idle after submitting commands,
/// as such it is very slow (don't do it in a loop every frame!).
///
/// # Unsafe Because
///
/// - no internal synchronization is done, any resources used by graphcis
///   commands must be synchronized by the caller
/// - note: the device idles after the submission, so no resources refereced
///   inside this method should be in-use after the call.
Synchronously submit commands for execution on the graphics queue.
This method is internally synchronized and can be called on multiple
threads without any additional synchronization.

This method forces the device to wait idle after submitting commands,
as such it is very slow (don't do it in a loop every frame!).
Synchronously submit commands for execution on the graphics queue . This method is internally synchronized and can be called on multiple threads without any additional synchronization . This method forces the device to wait idle after submitting commands as such it is very slow ( don ' t do it in a loop every frame! ) .
pub unsafe fn sync_graphics_commands<R, Action>(
        &self,
        mut action: Action,
    ) -> Result<R>
    where
        Action: FnMut(vk::CommandBuffer) -> Result<R>,
    {
        let pool = self.shared_graphics_pool.lock().unwrap();
        let command_buffer =
            pool.allocate_command_buffer(&self.logical_device)?;
        let begin_info = vk::CommandBufferBeginInfo {
            flags: vk::CommandBufferUsageFlags::ONE_TIME_SUBMIT,
            ..Default::default()
        };
        self.logical_device
            .begin_command_buffer(command_buffer, &&begin_info)?;
        let result = action(command_buffer);
        self.logical_device.end_command_buffer(command_buffer)?;
        self.submit_and_wait_idle(&self.graphics_queue, command_buffer)?;
        pool.free_command_buffer(&self.logical_device, command_buffer);
        result
    }
pub unsafe fn sync_graphics_commands < R , Action > ( & self , mut action : Action , ) -> Result < R > where Action : FnMut ( vk :: CommandBuffer ) -> Result < R > , { let pool = self . shared_graphics_pool . lock ( ) . unwrap ( ) ; let command_buffer = pool . allocate_command_buffer ( & self . logical_device ) ? ; let begin_info = vk :: CommandBufferBeginInfo { flags : vk :: CommandBufferUsageFlags :: ONE_TIME_SUBMIT , .. Default :: default ( ) } ; self . logical_device . begin_command_buffer ( command_buffer , & & begin_info ) ? ; let result = action ( command_buffer ) ; self . logical_device . end_command_buffer ( command_buffer ) ? ; self . submit_and_wait_idle ( & self . graphics_queue , command_buffer ) ? ; pool . free_command_buffer ( & self . logical_device , command_buffer ) ; result }
Synchronously submit commands for execution on the graphics queue.
Synchronously submit commands for execution on the graphics queue .
&self
action
Action
unsafe because
no internal synchronization is done, any resources used by graphcis
commands must be synchronized by the caller
note: the device idles after the submission, so no resources refereced
inside this method should be in-use after the call.
no internal synchronization is done any resources used by graphcis commands must be synchronized by the caller note : the device idles after the submission so no resources refereced inside this method should be in - use after the call .