pub struct Texture {
pub(crate) context: Arc<dyn DynContext>,
pub(crate) id: ObjectId,
pub(crate) data: Box<dyn Any + Sync + Send>,
pub(crate) owned: bool,
pub(crate) descriptor: TextureDescriptor<Option<&'static str>, &'static [TextureFormat]>,
}
Expand description
Handle to a texture on the GPU.
It can be created with Device::create_texture
.
Corresponds to WebGPU GPUTexture
.
Fields§
§context: Arc<dyn DynContext>
§id: ObjectId
§data: Box<dyn Any + Sync + Send>
§owned: bool
§descriptor: TextureDescriptor<Option<&'static str>, &'static [TextureFormat]>
Implementations§
§impl Texture
impl Texture
pub unsafe fn as_hal<A, F, R>(&self, hal_texture_callback: F) -> R
pub unsafe fn as_hal<A, F, R>(&self, hal_texture_callback: F) -> R
Returns the inner hal Texture using a callback. The hal texture will be None
if the
backend type argument does not match with this wgpu Texture
§Safety
- The raw handle obtained from the hal Texture must not be manually destroyed
pub fn create_view(&self, desc: &TextureViewDescriptor<'_>) -> TextureView
pub fn create_view(&self, desc: &TextureViewDescriptor<'_>) -> TextureView
Creates a view of this texture.
pub fn destroy(&self)
pub fn destroy(&self)
Destroy the associated native resources as soon as possible.
pub fn as_image_copy(&self) -> ImageCopyTexture<&Texture>
pub fn as_image_copy(&self) -> ImageCopyTexture<&Texture>
Make an ImageCopyTexture
representing the whole texture.
pub fn size(&self) -> Extent3d
pub fn size(&self) -> Extent3d
Returns the size of this Texture
.
This is always equal to the size
that was specified when creating the texture.
pub fn width(&self) -> u32
pub fn width(&self) -> u32
Returns the width of this Texture
.
This is always equal to the size.width
that was specified when creating the texture.
pub fn height(&self) -> u32
pub fn height(&self) -> u32
Returns the height of this Texture
.
This is always equal to the size.height
that was specified when creating the texture.
pub fn depth_or_array_layers(&self) -> u32
pub fn depth_or_array_layers(&self) -> u32
Returns the depth or layer count of this Texture
.
This is always equal to the size.depth_or_array_layers
that was specified when creating the texture.
pub fn mip_level_count(&self) -> u32
pub fn mip_level_count(&self) -> u32
Returns the mip_level_count of this Texture
.
This is always equal to the mip_level_count
that was specified when creating the texture.
pub fn sample_count(&self) -> u32
pub fn sample_count(&self) -> u32
Returns the sample_count of this Texture
.
This is always equal to the sample_count
that was specified when creating the texture.
pub fn dimension(&self) -> TextureDimension
pub fn dimension(&self) -> TextureDimension
Returns the dimension of this Texture
.
This is always equal to the dimension
that was specified when creating the texture.
pub fn format(&self) -> TextureFormat
pub fn format(&self) -> TextureFormat
Returns the format of this Texture
.
This is always equal to the format
that was specified when creating the texture.
pub fn usage(&self) -> TextureUsages
pub fn usage(&self) -> TextureUsages
Returns the allowed usages of this Texture
.
This is always equal to the usage
that was specified when creating the texture.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Texture
impl !RefUnwindSafe for Texture
impl Send for Texture
impl Sync for Texture
impl Unpin for Texture
impl !UnwindSafe for Texture
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