pub struct Yuv420pReadback { /* private fields */ }Expand description
A submitted GPU RGB-to-YUV420 conversion whose buffer is not mapped yet.
Implementations§
Source§impl Yuv420pReadback
impl Yuv420pReadback
Sourcepub const fn size(&self) -> RenderSize
pub const fn size(&self) -> RenderSize
The luma-plane dimensions.
Sourcepub const fn staging_bytes(&self) -> u64
pub const fn staging_bytes(&self) -> u64
Bytes held by the staging buffer.
Sourcepub fn wait_ready(&self) -> Result<(), RenderError>
pub fn wait_ready(&self) -> Result<(), RenderError>
Blocks a native caller until this readback is mapped.
§Errors
Returns RenderError::TextureReadback when mapping or polling fails.
Sourcepub fn wait_for_submission(&self) -> Result<(), RenderError>
pub fn wait_for_submission(&self) -> Result<(), RenderError>
Blocks until this readback’s submission completes; may follow an earlier
Self::map_async.
§Errors
RenderError::GpuTimeout past the renderer’s wait timeout, or
RenderError::TextureReadback when device polling fails.
Sourcepub fn wait(self) -> Result<Yuv420pPlanes, RenderError>
pub fn wait(self) -> Result<Yuv420pPlanes, RenderError>
Waits for this readback and returns tightly packed planes.
§Errors
RenderError::TextureReadback when mapping, polling or row packing fails.
Sourcepub fn map_async(
&self,
on_ready: impl FnOnce(Result<(), RenderError>) + Send + 'static,
)
pub fn map_async( &self, on_ready: impl FnOnce(Result<(), RenderError>) + Send + 'static, )
Requests buffer mapping and reports readiness exactly once.
Sourcepub fn finish_into(
self,
targets: &mut Yuv420pTargets<'_>,
) -> Result<(), RenderError>
pub fn finish_into( self, targets: &mut Yuv420pTargets<'_>, ) -> Result<(), RenderError>
Packs mapped planes into caller-owned, possibly strided, plane buffers, avoiding the
allocation and copy of Yuv420pReadback::finish.
§Errors RenderError::TextureReadback when the buffer is not mapped, the layout is
unrepresentable or a target is too small, and RenderError::GpuWorkDropped when the GPU
did not run the copy (the buffer is not recycled and the renderer refuses further work).
Sourcepub fn finish(self) -> Result<Yuv420pPlanes, RenderError>
pub fn finish(self) -> Result<Yuv420pPlanes, RenderError>
Sourcepub fn pixel_layout(&self) -> Option<PixelLayout>
pub fn pixel_layout(&self) -> Option<PixelLayout>
The layout a texel readback packs into, None for a GPU-packed 8-bit 4:2:0 readback.
Sourcepub fn finish_into_planes(
self,
targets: &mut [PlaneTarget<'_>],
) -> Result<(), RenderError>
pub fn finish_into_planes( self, targets: &mut [PlaneTarget<'_>], ) -> Result<(), RenderError>
Packs the mapped frame into one target per plane of its layout, in storage order
(PixelLayout::planes).
§Errors
As Self::finish_into, and RenderError::TextureReadback for a wrong target count.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Yuv420pReadback
impl !RefUnwindSafe for Yuv420pReadback
impl !UnwindSafe for Yuv420pReadback
impl Send for Yuv420pReadback
impl Sync for Yuv420pReadback
impl Unpin for Yuv420pReadback
impl UnsafeUnpin for Yuv420pReadback
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