Queue

Struct Queue 

Source
pub struct Queue {
    raw: Queue,
    device: Arc<DeviceShared>,
    family_index: u32,
    relay_semaphores: Mutex<RelaySemaphores>,
    signal_semaphores: Mutex<SemaphoreList>,
    wait_semaphores: Mutex<SemaphoreList>,
    next_submit_chain: Mutex<Option<PnextChain>>,
}
Available on vulkan only.

Fields§

§raw: Queue§device: Arc<DeviceShared>§family_index: u32§relay_semaphores: Mutex<RelaySemaphores>§signal_semaphores: Mutex<SemaphoreList>§wait_semaphores: Mutex<SemaphoreList>§next_submit_chain: Mutex<Option<PnextChain>>

A caller-provided pNext chain to attach to the [vk::SubmitInfo] of the next call to submit().

Set only through Queue::set_next_submit_chain().

Implementations§

Source§

impl Queue

Source

pub fn as_raw(&self) -> Queue

Source§

impl Queue

Source

pub fn raw_device(&self) -> &Device

Source

pub fn add_signal_semaphore( &self, semaphore: Semaphore, semaphore_value: Option<u64>, )

Source

pub fn remove_signal_semaphore(&self, semaphore: Semaphore) -> bool

Remove semaphore from the pending signal list if it is still present.

Returns true if the semaphore was found and removed. If the submit already consumed it, this is a harmless no-op that returns false.

Source

pub fn add_wait_semaphore( &self, semaphore: Semaphore, semaphore_value: Option<u64>, stage: PipelineStageFlags, )

Stage a semaphore wait on the next crate::Queue::submit call.

semaphore_value selects the kind of payload the wait targets:

  • Some(value) - wait until semaphore (a timeline semaphore) has been signalled to at least value.
  • None - wait on a binary semaphore signal.

stage is the pipeline stage at which the wait blocks downstream work (e.g. vk::PipelineStageFlags::TOP_OF_PIPE to gate the entire submission, or a more specific stage when only that stage reads the synchronised resource).

Source

pub fn remove_wait_semaphore(&self, semaphore: Semaphore) -> bool

Remove semaphore from the pending wait list if it is still present.

Returns true if the semaphore was found and removed. If the submit already consumed it, this is a no-op that returns false.

Source

pub unsafe fn set_next_submit_chain(&self, chain: *mut c_void)

Set a pNext chain of extension structs to attach to the [vk::SubmitInfo] of the next submit() on this queue.

This supports submission extensions that wgpu-hal has no dedicated support for. One example is VkLatencySubmissionPresentIdNV from VK_NV_low_latency2. The device extension itself must be enabled at device creation, for example with Adapter::open_with_callback().

The next submission on this queue consumes the chain, and a later call replaces a chain that hasn’t been submitted yet. One wgpu or wgpu-core submit maps to one submission here, but layers above wgpu-hal also make housekeeping submissions of their own, for example when a buffer is mapped, and those consume the chain too. Set the chain right before the submission it applies to, with no other queue or buffer-mapping work in between.

§Safety
  • chain must point to a valid pNext chain of structs that can extend [vk::SubmitInfo]. The extensions in the chain must be enabled on this queue’s device.
  • The chain must stay valid until the next submission on this queue is made or the queue is dropped. Don’t read or write the chain during that time. Fields the driver wrote during submission may be read afterwards.

Trait Implementations§

Source§

impl Debug for Queue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Queue

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl DynResource for Queue

Source§

fn as_any(&self) -> &dyn Any

Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Source§

impl Queue for Queue

Source§

type A = Api

Source§

unsafe fn submit( &self, command_buffers: &[&CommandBuffer], surface_textures: &[&SurfaceTexture], (signal_fence, signal_value): (&Fence, FenceValue), ) -> Result<(), DeviceError>

Submit command_buffers for execution on GPU. Read more
Source§

unsafe fn present( &self, surface: &Surface, texture: SurfaceTexture, ) -> Result<(), SurfaceError>

Present a surface texture to the screen. Read more
Source§

unsafe fn get_timestamp_period(&self) -> f32

Source§

unsafe fn wait_for_idle(&self) -> Result<(), DeviceError>

Block until all previously submitted work on this queue has completed, including any pending presentations. Read more

Auto Trait Implementations§

§

impl !Freeze for Queue

§

impl !RefUnwindSafe for Queue

§

impl Send for Queue

§

impl Sync for Queue

§

impl Unpin for Queue

§

impl !UnwindSafe for Queue

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<Q> DynQueue for Q
where Q: Queue + DynResource,

Source§

unsafe fn submit( &self, command_buffers: &[&(dyn DynCommandBuffer + 'static)], surface_textures: &[&(dyn DynSurfaceTexture + 'static)], signal_fence: (&(dyn DynFence + 'static), u64), ) -> Result<(), DeviceError>

Source§

unsafe fn present( &self, surface: &(dyn DynSurface + 'static), texture: Box<dyn DynSurfaceTexture>, ) -> Result<(), SurfaceError>

Source§

unsafe fn get_timestamp_period(&self) -> f32

Source§

unsafe fn wait_for_idle(&self) -> Result<(), DeviceError>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,