Expand description
Zero-copy import of externally produced GPU frames into wgpu textures.
Browser engines, media decoders, capture pipelines, and compositors all hand
their output over as a platform handle to memory the GPU already holds:
a DMA-BUF file descriptor on Linux, an AHardwareBuffer on Android, an
IOSurface on Apple platforms, a shared ID3D12Resource handle on
Windows. This crate turns each of those into a wgpu::Texture on a
device the caller already owns, without ever routing a pixel through the
CPU.
Each platform gets its own module, because the handles genuinely have
nothing in common: one is a file descriptor with a DRM format modifier and
an explicit fence, one is a reference-counted NDK object, one is a
CoreFoundation object, one is a Win32 HANDLE. There is no unifying
trait, and inventing one would only hide the differences a caller has to
know about anyway. A module exists only on its own platform, so these docs
link the one built for the target they were generated for and name the
others.
dma_buf— Linux DMA-BUF, imported through Vulkan external memory (VK_EXT_external_memory_dma_buf) or EGL (EGL_LINUX_DMA_BUF_EXTplusglEGLImageTargetTexture2DOES), whichever backend thewgpudevice runs on.ahardware_buffer— AndroidAHardwareBuffer, imported through Vulkan (VK_ANDROID_external_memory_android_hardware_buffer) and adopted bywgpuwithout a copy, except for YCbCr buffers the driver describes only through an external format, which a GPU pass converts into planeswgpuowns.io_surface— macOS and iOSIOSurface, packed RGBA/BGRA or biplanar 4:2:0 YCbCr one plane per texture, imported throughMTLDevice::newTextureWithDescriptor:iosurface:plane:.shared_handle— Windows shared texture handles, imported throughID3D12Device::OpenSharedHandle.
Every import reaches under wgpu to its hal layer, so the caller must
run on the backend that platform’s import requires; each entry point says
which, and asserts it rather than guessing.
Modules§
- dma_buf
- Linux DMA-BUF import.
Structs§
- Ycbcr
Encoding - How a YCbCr frame’s samples map to non-linear R’G’B’: the matrix and the code range a consumer needs to convert them.
Enums§
- Ycbcr
Matrix - YCbCr to R’G’B’ matrix coefficients.
- Ycbcr
Range - The code range YCbCr samples span.