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 the shared device on the adapter the host’s choice makes by default (choose_shared_vulkan under ALPHA2_GPU_ADAPTER, decode allowed).

§Errors

Returns why no adapter carries the shared device.

Source

pub fn create_on(index: usize) -> Result<Self, SharedVulkanError>

Creates the shared Vulkan 1.3 device, with wgpu, video decode, and NV12 support, on the adapter at Vulkan enumeration index (as ALPHA2_GPU_ADAPTER names it).

§Errors

Returns why the adapter cannot carry the shared device, or the failing initialization step.

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, vp9) whose extensions the device was created with.

Source

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

The Khronos validation layer the loader activated on this instance (by wgpu’s validation flag or the environment), and its version.

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.

Validation layers older than VulkanLayerVersion::VIDEO_SESSIONS crash or hang in session setup, for decode and encode alike, so both paths ask this.

Source

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

Video-encode codecs this device created a queue and extensions for. Empty without an encode queue, in which case FFmpeg’s Vulkan encoder cannot open.

Source

pub fn encode_extent(&self, codec: &str) -> Option<&VideoEncodeExtent>

Output sizes this device’s encoder of codec (h264, hevc) accepts, from vkGetPhysicalDeviceVideoCapabilitiesKHR. Exports outside it take the readback path.

None when the device does not encode codec or the query failed.

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 waits on FFmpeg’s latest timeline value without a CPU wait. Call submitted() on the returned lease right after the wgpu submission that samples it.

§Errors

Returns an error for a different device, an 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,