pub struct VkAcquireTimeline { /* private fields */ }Expand description
Optional GPU-side acquire-sync attached to a VkOpaqueFd /
VkOpaqueWin32 carrier.
When present, the consumer SHOULD chain a GPU wait on this timeline
at the carried value before any GPU read of the associated memory
— the producer signals value on the same submit that wrote the
memory, and skips its own CPU-side post-wait. Importer pseudocode:
// 1. Once per (consumer-VkDevice, handle) — cache the import:
let imported: vk::Semaphore =
vkImportSemaphoreWin32HandleKHR(.handle = timeline.handle(), TIMELINE);
// 2. Per frame — wait at `timeline.value()` on the first GPU submit
// that touches the imported image.The carried handle / fd is stable across every frame from the
same producer (signal-only, one export at pool init), so importers
keep the imported vk::Semaphore cached per producer rather than
re-importing every frame.
None on a carrier means the producer guarantees CPU-visibility of
the memory by the time the carrier is handed over (it CPU-waits with
vkWaitSemaphores after its submit). Consumers can then
skip GPU sync — the read is already safe.
Implementations§
Source§impl VkAcquireTimeline
impl VkAcquireTimeline
Sourcepub fn new_fd(fd: Arc<OwnedFd>, value: u64) -> Self
Available on Hermit or Unix or WASI only.
pub fn new_fd(fd: Arc<OwnedFd>, value: u64) -> Self
Unix constructor — fd is an fd from vkGetSemaphoreFdKHR on a
TIMELINE semaphore created with VkExportSemaphoreCreateInfo .handleTypes = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR.
Sourcepub fn with_wait_capability_ack(self, ack: Arc<AtomicBool>) -> Self
pub fn with_wait_capability_ack(self, ack: Arc<AtomicBool>) -> Self
Attach the producer’s consumer-capability ack bool to this
carrier. The consumer calls Self::ack_wait_capability after
successfully chaining a GPU wait on this timeline; the producer
reads the bool on the next frame to decide whether to elide its
own CPU post-wait. Never stamped (None) means the producer was
not going to elide anyway, so a consumer may skip the ack.
Sourcepub fn ack_wait_capability(&self)
pub fn ack_wait_capability(&self)
Called by the consumer-side import after a GPU-side wait on
this timeline has been successfully chained (Vulkan submit’s
wait list, or GL glWaitSemaphoreEXT queued onto wgpu’s GL
command stream). Sets the producer’s capability bool to true
with release ordering so the producer’s next-frame Acquire
load observes it.
Idempotent — repeated calls are cheap atomic stores. No-op when the carrier wasn’t stamped with an ack (the producer wasn’t planning to elide).
Sourcepub fn fd(&self) -> &Arc<OwnedFd> ⓘ
Available on Hermit or Unix or WASI only.
pub fn fd(&self) -> &Arc<OwnedFd> ⓘ
Exported fd to the producer’s TIMELINE semaphore. Stable across frames.
Sourcepub fn value(&self) -> u64
pub fn value(&self) -> u64
Value to wait the timeline to reach before reading the associated memory. Monotonically advances per frame.
Sourcepub fn with_needs_binary_fallback_ack(self, ack: Arc<AtomicBool>) -> Self
pub fn with_needs_binary_fallback_ack(self, ack: Arc<AtomicBool>) -> Self
Attach the producer’s “switch to binary fallback” bool to this
carrier. The consumer flips it via
Self::signal_needs_binary_fallback when the timeline import
path turns out to be unusable on this driver; the producer reads
it at the start of each per-frame copy and, from then on, also arms
a per-frame fresh BINARY semaphore alongside the timeline export.
Never stamped (None) means the producer did not wire the
fallback channel.
Sourcepub fn signal_needs_binary_fallback(&self)
pub fn signal_needs_binary_fallback(&self)
Called by the consumer-side import after a timeline-import
attempt has failed (either the platform path is genuinely
unavailable — GL_NV_timeline_semaphore missing,
D3D12_FENCE export missing — or the import call itself
returned a GL error). Flips the producer’s “needs binary
fallback” bool with release ordering so the producer’s next
per-frame copy sees it and additionally arms a per-frame
fresh BINARY semaphore on the carrier.
No-op when the carrier wasn’t stamped with the fallback ack (the producer didn’t wire the channel, typically because no consumer it targets supports binary fallback for this resource type).