gfx_hal::queue

Trait Queue

Source
pub trait Queue<B: Backend>:
    Debug
    + Any
    + Send
    + Sync {
    // Required methods
    unsafe fn submit<'a, Ic, Iw, Is>(
        &mut self,
        command_buffers: Ic,
        wait_semaphores: Iw,
        signal_semaphores: Is,
        fence: Option<&mut B::Fence>,
    )
       where Ic: Iterator<Item = &'a B::CommandBuffer>,
             Iw: Iterator<Item = (&'a B::Semaphore, PipelineStage)>,
             Is: Iterator<Item = &'a B::Semaphore>;
    unsafe fn present(
        &mut self,
        surface: &mut B::Surface,
        image: <B::Surface as PresentationSurface<B>>::SwapchainImage,
        wait_semaphore: Option<&mut B::Semaphore>,
    ) -> Result<Option<Suboptimal>, PresentError>;
    fn wait_idle(&mut self) -> Result<(), OutOfMemory>;
    fn timestamp_period(&self) -> f32;

    // Provided method
    unsafe fn bind_sparse<'a, Iw, Is, Ibi, Ib, Iii, Io, Ii>(
        &mut self,
        _wait_semaphores: Iw,
        _signal_semaphores: Is,
        _buffer_memory_binds: Ib,
        _image_opaque_memory_binds: Io,
        _image_memory_binds: Ii,
        _device: &B::Device,
        _fence: Option<&B::Fence>,
    )
       where Ibi: Iterator<Item = &'a SparseBind<&'a B::Memory>>,
             Ib: Iterator<Item = (&'a mut B::Buffer, Ibi)>,
             Iii: Iterator<Item = &'a SparseImageBind<&'a B::Memory>>,
             Io: Iterator<Item = (&'a mut B::Image, Ibi)>,
             Ii: Iterator<Item = (&'a mut B::Image, Iii)>,
             Iw: Iterator<Item = &'a B::Semaphore>,
             Is: Iterator<Item = &'a B::Semaphore> { ... }
}
Expand description

Abstraction for an internal GPU execution engine.

Commands are executed on the the device by submitting command buffers.

Queues can also be used for presenting to a surface (that is, flip the front buffer with the next one in the chain).

Required Methods§

Source

unsafe fn submit<'a, Ic, Iw, Is>( &mut self, command_buffers: Ic, wait_semaphores: Iw, signal_semaphores: Is, fence: Option<&mut B::Fence>, )
where Ic: Iterator<Item = &'a B::CommandBuffer>, Iw: Iterator<Item = (&'a B::Semaphore, PipelineStage)>, Is: Iterator<Item = &'a B::Semaphore>,

Submit command buffers to queue for execution.

§Arguments
  • command_buffers - command buffers to submit.
  • wait_semaphores - semaphores to wait being signalled before submission.
  • signal_semaphores - semaphores to signal after all command buffers in the submission have finished execution.
  • fence - must be in unsignaled state, and will be signaled after all command buffers in the submission have finished execution.
§Safety

It’s not checked that the queue can process the submitted command buffers.

For example, trying to submit compute commands to a graphics queue will result in undefined behavior.

Source

unsafe fn present( &mut self, surface: &mut B::Surface, image: <B::Surface as PresentationSurface<B>>::SwapchainImage, wait_semaphore: Option<&mut B::Semaphore>, ) -> Result<Option<Suboptimal>, PresentError>

Present a swapchain image directly to a surface, after waiting on wait_semaphore.

§Safety

Unsafe for the same reasons as submit. No checks are performed to verify that this queue supports present operations.

Source

fn wait_idle(&mut self) -> Result<(), OutOfMemory>

Wait for the queue to be idle.

Source

fn timestamp_period(&self) -> f32

The amount of nanoseconds that causes a timestamp query value to increment by one.

Provided Methods§

Source

unsafe fn bind_sparse<'a, Iw, Is, Ibi, Ib, Iii, Io, Ii>( &mut self, _wait_semaphores: Iw, _signal_semaphores: Is, _buffer_memory_binds: Ib, _image_opaque_memory_binds: Io, _image_memory_binds: Ii, _device: &B::Device, _fence: Option<&B::Fence>, )
where Ibi: Iterator<Item = &'a SparseBind<&'a B::Memory>>, Ib: Iterator<Item = (&'a mut B::Buffer, Ibi)>, Iii: Iterator<Item = &'a SparseImageBind<&'a B::Memory>>, Io: Iterator<Item = (&'a mut B::Image, Ibi)>, Ii: Iterator<Item = (&'a mut B::Image, Iii)>, Iw: Iterator<Item = &'a B::Semaphore>, Is: Iterator<Item = &'a B::Semaphore>,

Sparse memory bind operation.

§Arguments
  • info - information about the memory bindings.
§Safety
  • Defining memory as None will cause undefined behaviour when the tile is read or written from in some hardware.
  • The memory regions provided are not checked to be valid and matching of the sparse resource type.
  • If extents are not a multiple of the block size, additional space will be bound, and accessing memory is unsafe.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§