pub enum Fence {
TimelineSemaphore(Semaphore),
FencePool(RwLock<FencePool>),
}vulkan only.Expand description
The Api::Fence type for vulkan::Api.
This is an enum because there are two possible implementations of
wgpu-hal fences on Vulkan: Vulkan fences, which work on any version of
Vulkan, and Vulkan timeline semaphores, which are easier and cheaper but
require non-1.0 features.
Device::create_fence returns a TimelineSemaphore if
VK_KHR_timeline_semaphore is available and enabled, and a FencePool
otherwise.
Variants§
TimelineSemaphore(Semaphore)
A Vulkan timeline semaphore.
These are simpler to use than Vulkan fences, since timeline semaphores
work exactly the way wpgu_hal::Api::Fence is specified to work.
FencePool(RwLock<FencePool>)
A collection of Vulkan fences, each associated with a FenceValue.
The effective FenceValue of this variant is the greater of
last_completed and the maximum value associated with a signalled fence
in active.
Fences are available in all versions of Vulkan, but since they only have
two states, “signaled” and “unsignaled”, we need to use a separate fence
for each queue submission we might want to wait for, and remember which
FenceValue each one represents.
One should keep the fence pool read while there are any references to the fences inside of them. This ensures there are no race conditions when resetting the fences