Skip to main content

VulkanImportLease

Struct VulkanImportLease 

Source
pub struct VulkanImportLease { /* private fields */ }
Expand description

Owns the imported texture, FFmpeg frame, and native transition commands.

Implementations§

Source§

impl VulkanImportLease

Source

pub const fn retained_bytes(&self) -> u64

Approximate decoded-surface bytes retained by this import.

Source

pub fn staged_signals(&self) -> usize

Timeline signals this lease has already staged on the wgpu queue.

Zero until the frame that samples this import stages its submission, and zero again once that submission completes and the lease is released. A nonzero count when the next frame begins staging would mean a signal from the previous frame is about to ride on this one.

Source

pub fn prepare_submission(self: &Arc<Self>)

Queues this import for the next Self::flush_submission, which acquires the frame and adds its timeline signals to the wgpu submission that samples it. Queuing an import twice is harmless.

Source

pub fn flush_submission(&self) -> Result<(), BridgeError>

Acquires every queued import of this context, one native queue submission per frame, each under that frame’s lock, and stages the signals of the wgpu submission that samples them.

§Errors

Returns an error if a frame cannot be locked, its acquire fails, or its signals cannot be staged. Imports not yet acquired can then be queued again for a retry.

Source

pub fn submitted(&self) -> Result<(), BridgeError>

Records that the wgpu submission sampling this import was made.

When the frame’s signals were staged on that submission, the frame already records its value and layout, and nothing more is submitted. Otherwise the planes are returned to the layout FFmpeg had them in, in a submission of their own.

§Errors

Returns a bridge error if the frame can no longer be locked or submitted.

Trait Implementations§

Source§

impl Debug for VulkanImportLease

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Drop for VulkanImportLease

Source§

fn drop(&mut self)

Leaves the frame as FFmpeg can go on from, and gives the ticket back.

An acquired lease that the renderer’s sampling submission never released (its frame failed, or was dropped, after the acquire) still owes the frame what it promised. When its signal was staged, the frame records the value that submission was to raise, and a decode that used the frame since has queued a wait on it: taking the signal back off the queue alone would leave that wait, and every later batch on the decode queue, waiting forever. So under the frame’s lock, which FFmpeg holds from reading the value to submitting its wait, a signal wgpu has not submitted yet is taken off its queue and raised by a submission of its own, after the acquire. A lease with nothing staged releases the frame from where it stands instead.

Either way the ticket goes back to the pool, which reuses it once the fences of everything it submitted have signalled, the acquire’s included: an acquire may still be waiting on the decoder when its lease is dropped, and freeing its command pool then would free commands the GPU has yet to run.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for VulkanImportLease

Source§

impl Sync for VulkanImportLease

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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