Struct re_renderer::allocator::gpu_readback_belt::GpuReadbackBuffer
source · pub struct GpuReadbackBuffer {
chunk_buffer: Arc<DynamicResource<GpuBufferHandle, BufferDesc, Buffer>>,
range_in_chunk: Range<BufferAddress>,
}
Expand description
A reserved slice for GPU readback.
Readback needs to happen from a buffer/texture with copy-source usage, as we need to copy the data from the GPU to this CPU accessible buffer.
Fields§
§chunk_buffer: Arc<DynamicResource<GpuBufferHandle, BufferDesc, Buffer>>
§range_in_chunk: Range<BufferAddress>
Implementations§
source§impl GpuReadbackBuffer
impl GpuReadbackBuffer
sourcepub fn read_texture2d(
&mut self,
encoder: &mut CommandEncoder,
source: ImageCopyTexture<'_>,
copy_extents: Extent3d
) -> Result<(), GpuReadbackError>
pub fn read_texture2d( &mut self, encoder: &mut CommandEncoder, source: ImageCopyTexture<'_>, copy_extents: Extent3d ) -> Result<(), GpuReadbackError>
Populates the buffer with data from a single layer of a 2D texture.
Implementation note: Does 2D-only entirely for convenience as it greatly simplifies the input parameters. Additionally, we assume as tightly as possible packed data as this is by far the most common use.
sourcepub fn read_multiple_texture2d(
&mut self,
encoder: &mut CommandEncoder,
sources_and_extents: &[(ImageCopyTexture<'_>, Extent3d)]
) -> Result<(), GpuReadbackError>
pub fn read_multiple_texture2d( &mut self, encoder: &mut CommandEncoder, sources_and_extents: &[(ImageCopyTexture<'_>, Extent3d)] ) -> Result<(), GpuReadbackError>
Reads multiple textures into the same buffer.
This is primarily useful if you need to make sure that data from all textures is available at the same time.
Special care has to be taken to ensure that the buffer is large enough.
ATTENTION: Keep in mind that internal offsets need to be a multiple of the texture block size! While readback buffer starts are guaranteed to be aligned correctly, there might need to be extra padding needed between texture copies. This method will add the required padding between the texture copies if necessary. Panics if the buffer is too small.
Auto Trait Implementations§
impl Freeze for GpuReadbackBuffer
impl !RefUnwindSafe for GpuReadbackBuffer
impl Send for GpuReadbackBuffer
impl Sync for GpuReadbackBuffer
impl Unpin for GpuReadbackBuffer
impl !UnwindSafe for GpuReadbackBuffer
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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