Skip to main content

DepthReadbackSurface

Struct DepthReadbackSurface 

Source
pub struct DepthReadbackSurface { /* private fields */ }
Expand description

Reusable GPU-to-CPU Depth32Float readback surface owning a staging buffer and persistent [0.0, 1.0] cache.

Implementations§

Source§

impl DepthReadbackSurface

Source

pub fn new(options: DepthReadbackOptions) -> Self

Source

pub fn options(&self) -> DepthReadbackOptions

Source

pub fn set_options(&mut self, options: DepthReadbackOptions)

Source

pub fn width(&self) -> u32

Source

pub fn height(&self) -> u32

Source

pub fn cached_depths(&self) -> &[f32]

Source

pub fn cached_bytes(&self) -> &[u8] ⓘ

Source

pub fn ensure_dimensions( &mut self, device: &Device, width: u32, height: u32, ) -> bool

Ensures the depth staging buffer and CPU cache match (width, height), clamping to at least 1x1. Returns true if the staging buffer was allocated or reallocated.

Source

pub fn copy_from_texture( &self, encoder: &mut CommandEncoder, depth_texture: &Texture, ) -> Result<(), ReadbackError>

Encodes a DepthOnly texture-to-staging-buffer copy into encoder.

Source

pub fn map_and_repack( &mut self, device: &Device, ) -> Result<&[f32], ReadbackError>

Synchronously maps the staging buffer, unpacks depth rows into Self::cached_depths, and unmaps.

Source

pub fn readback_sync( &mut self, device: &Device, queue: &Queue, depth_texture: &Texture, ) -> Result<&[f32], ReadbackError>

Ensures dimensions match depth_texture, submits a copy command, and reads back depths synchronously.

Auto Trait Implementations§

§

impl !RefUnwindSafe for DepthReadbackSurface

§

impl !UnwindSafe for DepthReadbackSurface

§

impl Forget for DepthReadbackSurface

§

impl Freeze for DepthReadbackSurface
where *const ArcInner<CoreBuffer> is !null: Freeze, PhantomData<ArcInner<CoreBuffer>>: Freeze, *const ArcInner<Mutex<MapContext>> is !null: Freeze, PhantomData<ArcInner<Mutex<MapContext>>>: Freeze, InternalBitFlags: Freeze, *const u8 is !null: Freeze, PhantomData<f32>: Freeze,

§

impl Move for DepthReadbackSurface

§

impl Send for DepthReadbackSurface
where Arc<CoreBuffer>: Send, Arc<Mutex<MapContext>>: Send, InternalBitFlags: Send, RawVecInner: Send,

§

impl Sync for DepthReadbackSurface
where Arc<CoreBuffer>: Sync, Arc<Mutex<MapContext>>: Sync, InternalBitFlags: Sync, RawVecInner: Sync,

§

impl Unpin for DepthReadbackSurface
where Arc<CoreBuffer>: Unpin, Arc<Mutex<MapContext>>: Unpin, InternalBitFlags: Unpin, *const u8 is !null: Unpin,

§

impl UnsafeUnpin for DepthReadbackSurface
where *const ArcInner<CoreBuffer> is !null: UnsafeUnpin, PhantomData<ArcInner<CoreBuffer>>: UnsafeUnpin, *const ArcInner<Mutex<MapContext>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<MapContext>>>: UnsafeUnpin, InternalBitFlags: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<f32>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,