pub struct SharedVulkanContext { /* private fields */ }Expand description
One Vulkan logical device adopted by both the renderer and FFmpeg.
Implementations§
Sourcepub fn create() -> Result<Self, SharedVulkanError>
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.
Sourcepub fn gpu(&self) -> GpuContext
pub fn gpu(&self) -> GpuContext
Renderer context backed by the shared logical device.
Sourcepub fn ffmpeg_device(&self) -> AVHWDeviceContext
pub fn ffmpeg_device(&self) -> AVHWDeviceContext
FFmpeg device reference for one decoder session.
Sourcepub const fn identity(&self) -> NativeGpuIdentity
pub const fn identity(&self) -> NativeGpuIdentity
Raw-device cache identity.
Sourcepub fn supports_ten_bit(&self) -> bool
pub fn supports_ten_bit(&self) -> bool
Whether this device can present 10-bit decoded planes.
Sourcepub fn decode_codecs(&self) -> &[&'static str]
pub fn decode_codecs(&self) -> &[&'static str]
Decode codecs (h264, hevc, av1) whose extensions the device was
created with.
Sourcepub const fn validation_layer(&self) -> Option<VulkanLayerVersion>
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.
Sourcepub fn video_session_hazard(&self) -> Option<String>
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.
Sourcepub fn encode_codecs(&self) -> &[&'static str]
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.
Sourcepub const fn encode_extent(&self) -> Option<&VideoEncodeExtent>
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.
Sourcepub fn import_ticket_stats(&self) -> ImportTicketStats
pub fn import_ticket_stats(&self) -> ImportTicketStats
Allocation counters of the import tickets this device reuses.
Sourcepub fn import_surface(
&self,
frame: Arc<VulkanFrameLease>,
) -> Result<ImportedVulkanFrame, BridgeError>
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.