pub struct VulkanImportLease { /* private fields */ }Expand description
Owns the imported texture, FFmpeg frame, and native transition commands.
Implementations§
Source§impl VulkanImportLease
impl VulkanImportLease
Sourcepub const fn retained_bytes(&self) -> u64
pub const fn retained_bytes(&self) -> u64
Approximate decoded-surface bytes retained by this import.
Sourcepub fn staged_signals(&self) -> usize
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.
Sourcepub fn prepare_submission(self: &Arc<Self>)
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.
Sourcepub fn flush_submission(&self) -> Result<(), BridgeError>
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.
Sourcepub fn submitted(&self) -> Result<(), BridgeError>
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
impl Debug for VulkanImportLease
Source§impl Drop for VulkanImportLease
impl Drop for VulkanImportLease
Source§fn drop(&mut self)
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.