Struct wgpu_hal::vulkan::RelaySemaphores
source · struct RelaySemaphores {
wait: Option<Semaphore>,
signal: Semaphore,
}
Expand description
Semaphores for forcing queue submissions to run in order.
The wgpu_hal::Queue
trait promises that if two calls to submit
are
ordered, then the first submission will finish on the GPU before the second
submission begins. To get this behavior on Vulkan we need to pass semaphores
to vkQueueSubmit
for the commands to wait on before beginning execution,
and to signal when their execution is done.
Normally this can be done with a single semaphore, waited on and then signalled for each submission. At any given time there’s exactly one submission that would signal the semaphore, and exactly one waiting on it, as Vulkan requires.
However, as of Oct 2021, bug #5508 in the Mesa ANV drivers caused them to hang if we use a single semaphore. The workaround is to alternate between two semaphores. The bug has been fixed in Mesa, but we should probably keep the workaround until, say, Oct 2026.
Fields§
§wait: Option<Semaphore>
The semaphore the next submission should wait on before beginning
execution on the GPU. This is None
for the first submission, which
should not wait on anything at all.
signal: Semaphore
The semaphore the next submission should signal when it has finished execution on the GPU.
Implementations§
source§impl RelaySemaphores
impl RelaySemaphores
fn new(device: &DeviceShared) -> Result<Self, DeviceError>
sourcefn advance(&mut self, device: &DeviceShared) -> Result<Self, DeviceError>
fn advance(&mut self, device: &DeviceShared) -> Result<Self, DeviceError>
Advances the semaphores, returning the semaphores that should be used for a submission.
Trait Implementations§
source§impl Clone for RelaySemaphores
impl Clone for RelaySemaphores
source§fn clone(&self) -> RelaySemaphores
fn clone(&self) -> RelaySemaphores
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for RelaySemaphores
impl RefUnwindSafe for RelaySemaphores
impl Send for RelaySemaphores
impl Sync for RelaySemaphores
impl Unpin for RelaySemaphores
impl UnwindSafe for RelaySemaphores
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)