Skip to main content

VkAcquireTimeline

Struct VkAcquireTimeline 

Source
pub struct VkAcquireTimeline { /* private fields */ }
Available on Hermit or Unix or WASI or Windows only.
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

Source

pub fn new_fd(fd: Arc<OwnedFd>, value: u64) -> Self

Available on Hermit or Unix or WASI only.

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.

Source

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.

Source

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).

Source

pub fn fd(&self) -> &Arc<OwnedFd> ⓘ

Available on Hermit or Unix or WASI only.

Exported fd to the producer’s TIMELINE semaphore. Stable across frames.

Source

pub fn value(&self) -> u64

Value to wait the timeline to reach before reading the associated memory. Monotonically advances per frame.

Source

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.

Source

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).

Trait Implementations§

Source§

impl Clone for VkAcquireTimeline

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VkAcquireTimeline

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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
Source§

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

Source§

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

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync + ?Sized,

Source§

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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