pub enum Fence {
TimelineSemaphore(Semaphore),
FencePool {
last_completed: FenceValue,
active: Vec<(FenceValue, Fence)>,
free: Vec<Fence>,
},
}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
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.
Fields
last_completed: FenceValueactive: Vec<(FenceValue, Fence)>The pending fence values have to be ascending.