Struct rerun::external::re_renderer::Texture2DBufferInfo
source · pub struct Texture2DBufferInfo {
pub bytes_per_row_unpadded: u32,
pub bytes_per_row_padded: u32,
pub buffer_size_unpadded: u64,
pub buffer_size_padded: u64,
}
Expand description
Utility for dealing with buffers containing raw 2D texture data.
Fields§
§bytes_per_row_unpadded: u32
How many bytes per row contain actual data.
bytes_per_row_padded: u32
How many bytes per row are required to be allocated in total.
Padding bytes are always at the end of a row.
buffer_size_unpadded: u64
Size required for an unpadded buffer.
buffer_size_padded: u64
Size required for a padded buffer as it is read/written from/to the GPU.
Implementations§
source§impl Texture2DBufferInfo
impl Texture2DBufferInfo
sourcepub fn new(format: TextureFormat, extent: Extent3d) -> Texture2DBufferInfo
pub fn new(format: TextureFormat, extent: Extent3d) -> Texture2DBufferInfo
Retrieves 2D texture buffer info for a given format & texture size.
If a single buffer is not possible for all aspects of the texture format, all sizes will be zero.
pub fn from_texture(texture: &Texture) -> Texture2DBufferInfo
pub fn num_rows(&self) -> u32
sourcepub fn remove_padding<'a>(&self, buffer: &'a [u8]) -> Cow<'a, [u8]>
pub fn remove_padding<'a>(&self, buffer: &'a [u8]) -> Cow<'a, [u8]>
Removes the padding from a buffer containing gpu texture data.
The passed in buffer is to be expected to be exactly of size Texture2DBufferInfo::buffer_size_padded
.
Note that if you’re passing in gpu data, there no alignment guarantees on the returned slice,
do NOT convert it using [bytemuck
]. Use Texture2DBufferInfo::remove_padding_and_convert
instead.
sourcepub fn remove_padding_and_convert<T>(&self, buffer: &[u8]) -> Vec<T>where
T: Pod,
pub fn remove_padding_and_convert<T>(&self, buffer: &[u8]) -> Vec<T>where
T: Pod,
Removes the padding from a buffer containing gpu texture data and remove convert to a given type.
The passed in buffer is to be expected to be exactly of size Texture2DBufferInfo::buffer_size_padded
.
The unpadded row size is expected to be a multiple of the size of the target type. (Which means that, while uncommon, it technically doesn’t need to be as big as a block in the pixel - this can be useful for e.g. packing wide bitfields)
Trait Implementations§
source§impl Clone for Texture2DBufferInfo
impl Clone for Texture2DBufferInfo
source§fn clone(&self) -> Texture2DBufferInfo
fn clone(&self) -> Texture2DBufferInfo
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for Texture2DBufferInfo
impl RefUnwindSafe for Texture2DBufferInfo
impl Send for Texture2DBufferInfo
impl Sync for Texture2DBufferInfo
impl Unpin for Texture2DBufferInfo
impl UnwindSafe for Texture2DBufferInfo
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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request