pub struct GpuReadback;Expand description
GPU → CPU readback helper.
The current implementation operates as a CPU stub (identity copy).
Replace the body of GpuReadback::download and GpuReadback::download_region with actual
WGPU buffer-mapping logic when a live device is available.
Implementations§
Source§impl GpuReadback
impl GpuReadback
Sourcepub fn download(width: u32, height: u32, gpu_data: &[u8]) -> Vec<u8> ⓘ
pub fn download(width: u32, height: u32, gpu_data: &[u8]) -> Vec<u8> ⓘ
Download a full frame from GPU-accessible memory to a CPU Vec<u8>.
On the CPU stub backend this is an identity copy of gpu_data.
§Arguments
width– Frame width in pixels.height– Frame height in pixels.gpu_data– GPU-accessible source buffer (RGBA packed, row-major).
§Returns
A Vec<u8> containing a copy of the readback data.
Sourcepub fn download_region(
src_width: u32,
x: u32,
y: u32,
w: u32,
h: u32,
gpu_data: &[u8],
) -> Vec<u8> ⓘ
pub fn download_region( src_width: u32, x: u32, y: u32, w: u32, h: u32, gpu_data: &[u8], ) -> Vec<u8> ⓘ
Download a sub-region of a frame.
src_width– Width of the full source frame in pixels.x,y– Top-left corner of the sub-region.w,h– Width/height of the sub-region in pixels.gpu_data– Full source frame data (RGBA, row-major).
Returns an empty Vec if the region is fully out of bounds.
Sourcepub fn expected_len(width: u32, height: u32) -> usize
pub fn expected_len(width: u32, height: u32) -> usize
Compute the expected byte length for a frame of width × height pixels
in RGBA format.
Auto Trait Implementations§
impl Freeze for GpuReadback
impl RefUnwindSafe for GpuReadback
impl Send for GpuReadback
impl Sync for GpuReadback
impl Unpin for GpuReadback
impl UnsafeUnpin for GpuReadback
impl UnwindSafe for GpuReadback
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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