Skip to main content

SharedVulkanContext

Struct SharedVulkanContext 

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

One Vulkan logical device adopted by both the renderer and FFmpeg.

Implementations§

Source§

impl SharedVulkanContext

Source

pub fn create() -> Result<Self, SharedVulkanError>

Creates a Vulkan 1.3 device with wgpu, video-decode, and NV12 support.

§Errors

Returns a capability or initialization failure suitable for auto-mode fallback.

Source

pub fn gpu(&self) -> GpuContext

Renderer context backed by the shared logical device.

Source

pub fn ffmpeg_device(&self) -> AVHWDeviceContext

FFmpeg device reference for one decoder session.

Source

pub const fn identity(&self) -> NativeGpuIdentity

Raw-device cache identity.

Source

pub fn supports_ten_bit(&self) -> bool

Whether this device can present 10-bit decoded planes.

Source

pub fn decode_codecs(&self) -> &[&'static str]

Decode codecs (h264, hevc, av1) whose extensions the device was created with.

Source

pub const fn validation_layer(&self) -> Option<VulkanLayerVersion>

The Khronos validation layer loaded on this instance, and its version.

Loaded means the loader activated it: wgpu enabled it (its validation flag, on in every debug build) or the environment injected it.

Source

pub fn video_session_hazard(&self) -> Option<String>

Why FFmpeg must not open a video session on this device, or None when it may.

A validation layer older than VulkanLayerVersion::VIDEO_SESSIONS crashes or hangs inside the session setup, and a decode session is set up as an encode one is: hardware decode and the GPU encoder both ask this, so neither opens one the other is kept from.

Source

pub fn encode_codecs(&self) -> &[&'static str]

Video-encode codecs this device created a queue and extensions for.

Empty on an adapter with no encode queue, which every other path still runs on. FFmpeg’s Vulkan encoder refuses to open without the queue, so this is what decides whether that encoder is even a candidate.

Source

pub const fn encode_extent(&self) -> Option<&VideoEncodeExtent>

Output sizes this device’s H.264 encoder accepts.

h264_vulkan refuses anything outside it, and an export that asks for one silently takes the readback path instead. The limit is the device’s, not the encoder list’s: it comes from vkGetPhysicalDeviceVideoCapabilitiesKHR, and on the adapter this was developed against the minimum is 160x64.

None when the device has no encode queue, or when the query itself failed, in which case no size can be promised either way.

Source

pub fn import_ticket_stats(&self) -> ImportTicketStats

Allocation counters of the import tickets this device reuses.

Source

pub fn import_surface( &self, frame: Arc<VulkanFrameLease>, ) -> Result<ImportedVulkanFrame, BridgeError>

Imports one same-device FFmpeg NV12 or P010 surface as plane views.

The acquire transition waits on FFmpeg’s latest timeline value without a CPU fence wait. The returned lease must receive submitted() directly after the wgpu submission that samples the views.

§Errors

Returns an error for a different device, unsupported image layout, or a failed Vulkan transition submission.

Trait Implementations§

Source§

impl Clone for SharedVulkanContext

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 SharedVulkanContext

Source§

fn fmt(&self, formatter: &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> 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> 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> Upcast<T> for T

Source§

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

Source§

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