#[non_exhaustive]pub enum HardwareBufferFormat {
Bgra8,
Rgba8,
Nv12,
P010,
}Expand description
How a hardware buffer lays out its pixels: one plane of colour, as an app draws, or a video
decoder’s own planes of brightness and colour difference, which the system’s decoders write and
its compositor shows with no conversion. What the samples mean as colour (matrix, range) is the
picture’s (VideoFrame::color), not the buffer’s.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Bgra8
8-bit blue, green, red and alpha in one plane: CoreVideo’s 32BGRA, DXGI’s
B8G8R8A8_UNORM, DRM’s ARGB8888.
Rgba8
8-bit red, green, blue and alpha in one plane: Android’s R8G8B8A8_UNORM.
Nv12
8-bit 4:2:0 in two planes: brightness, then blue and red difference interleaved at half
the size each way. CoreVideo’s 420v and 420f, DXGI’s and DRM’s NV12. Not Android’s
Y8Cb8Cr8_420, whose planes lie as its allocator chooses.
P010
10-bit 4:2:0 laid out as Nv12, each sample in the high ten bits of
sixteen: CoreVideo’s x420 and xf20, DXGI’s and DRM’s P010, Android’s YCbCr_P010.
Implementations§
Source§impl HardwareBufferFormat
impl HardwareBufferFormat
Sourcepub fn plane_count(self) -> usize
pub fn plane_count(self) -> usize
Sourcepub fn plane_format(self, plane: usize) -> Option<TextureFormat>
pub fn plane_format(self, plane: usize) -> Option<TextureFormat>
The texture format plane plane is sampled in: Bgra8Unorm or Rgba8Unorm for one plane;
R8Unorm then Rg8Unorm for Nv12, as wgpu’s TextureFormat::NV12
aspects are; R16Unorm then Rg16Unorm for P010, which need
Features::TEXTURE_FORMAT_16BIT_NORM. None
past the last plane.
Trait Implementations§
Source§impl Clone for HardwareBufferFormat
impl Clone for HardwareBufferFormat
impl Copy for HardwareBufferFormat
Source§impl Debug for HardwareBufferFormat
impl Debug for HardwareBufferFormat
impl Eq for HardwareBufferFormat
Source§impl Hash for HardwareBufferFormat
impl Hash for HardwareBufferFormat
Source§impl PartialEq for HardwareBufferFormat
impl PartialEq for HardwareBufferFormat
impl StructuralPartialEq for HardwareBufferFormat
Auto Trait Implementations§
impl Forget for HardwareBufferFormat
impl Freeze for HardwareBufferFormat
impl Move for HardwareBufferFormat
impl RefUnwindSafe for HardwareBufferFormat
impl Send for HardwareBufferFormat
impl Sync for HardwareBufferFormat
impl Unpin for HardwareBufferFormat
impl UnsafeUnpin for HardwareBufferFormat
impl UnwindSafe for HardwareBufferFormat
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.