Struct re_renderer::texture_info::Texture2DBufferInfo
source · pub struct Texture2DBufferInfo {
pub bytes_per_row_unpadded: u32,
pub bytes_per_row_padded: u32,
pub buffer_size_unpadded: BufferAddress,
pub buffer_size_padded: BufferAddress,
}
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: BufferAddress
Size required for an unpadded buffer.
buffer_size_padded: BufferAddress
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) -> Self
pub fn new(format: TextureFormat, extent: Extent3d) -> Self
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) -> Self
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: Pod>(&self, buffer: &[u8]) -> Vec<T>
pub fn remove_padding_and_convert<T: Pod>(&self, buffer: &[u8]) -> Vec<T>
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
§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