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 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.
Sourcepub fn create_on(index: usize) -> Result<Self, SharedVulkanError>
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.
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, vp9) 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 the loader activated on this instance (by wgpu’s validation flag or the environment), and its version.
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.
Validation layers older than VulkanLayerVersion::VIDEO_SESSIONS crash or hang in
session setup, for decode and encode alike, so both paths ask this.
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 without an
encode queue, in which case FFmpeg’s Vulkan encoder cannot open.
Sourcepub fn encode_extent(&self, codec: &str) -> Option<&VideoEncodeExtent>
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.
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 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.