pub struct VulkanExternalImage { /* private fields */ }Expand description
A frame backed by a Linux DMABUF imported via Vulkan
VK_KHR_external_memory_fd + VK_EXT_image_drm_format_modifier.
The producer (e.g. WPE) hands the consumer a DMABUF fd, DRM format
modifier, and per-plane offset/stride; the importer wraps it as a
wgpu::Texture on the host’s wgpu Vulkan device. Single-plane RGBA is
the common case; multi-plane formats are not yet supported.
The safe constructor takes ownership of both descriptors. Vulkan consumes
each descriptor only after its matching driver import succeeds; otherwise
Rust closes it as this frame is dropped. The raw constructor is unsafe
because it must be given uniquely owned file descriptors.
The Linux Vulkan semaphore synchronizer imports a duplicate of the
frame-owned semaphore descriptor, then drops the original with the
consumed frame.
Implementations§
Source§impl VulkanExternalImage
impl VulkanExternalImage
Sourcepub fn metadata(&self) -> FrameMetadata
pub fn metadata(&self) -> FrameMetadata
Metadata that remains valid after the frame is consumed.
pub fn new( metadata: FrameMetadata, dmabuf_fd: OwnedFd, dmabuf_offset: u64, dmabuf_stride: u64, drm_modifier: u64, wait_semaphore_fd: Option<OwnedFd>, ) -> Self
Sourcepub unsafe fn from_raw_owned_parts(
metadata: FrameMetadata,
dmabuf_fd: RawFd,
dmabuf_offset: u64,
dmabuf_stride: u64,
drm_modifier: u64,
wait_semaphore_fd: Option<RawFd>,
) -> Self
pub unsafe fn from_raw_owned_parts( metadata: FrameMetadata, dmabuf_fd: RawFd, dmabuf_offset: u64, dmabuf_stride: u64, drm_modifier: u64, wait_semaphore_fd: Option<RawFd>, ) -> Self
Construct an owned frame from raw Linux descriptors.
§Safety
Each descriptor must be valid and uniquely owned by the caller. This function assumes responsibility for closing it if the Vulkan driver does not successfully consume it.
Auto Trait Implementations§
impl Freeze for VulkanExternalImage
impl RefUnwindSafe for VulkanExternalImage
impl Send for VulkanExternalImage
impl Sync for VulkanExternalImage
impl Unpin for VulkanExternalImage
impl UnsafeUnpin for VulkanExternalImage
impl UnwindSafe for VulkanExternalImage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more