Texture

Struct Texture 

Source
pub struct Texture<D>{
    pub view: TextureView,
    pub format: TextureFormat,
    pub size: D,
    pub usage: TextureUsages,
    /* private fields */
}

Fields§

§view: TextureView§format: TextureFormat§size: D§usage: TextureUsages

Implementations§

Source§

impl<D> Texture<D>

Source§

impl<D> Texture<D>

Source

pub fn bind_texture(&self) -> Binding<'_>

Create a textureview binding.

Source

pub fn bind(&self) -> Binding<'_>

Alias for bind_texture().

Source

pub fn bind_storage_texture(&self) -> Binding<'_>

Create a storage texture binding.

Source§

impl<D> Texture<D>

Source

pub fn resize(&mut self, size: D)

Resize the texture. Old contents are discarded (see resize_and_copy)

Source

pub fn resize_with_copy(&mut self, size: D)

Resize the texture and copy the contents

Source

pub fn write<T>(&self, size: D, data: &[T])
where T: Pod,

Source

pub fn write_block<T>(&self, texel: D, size: D, data: &[T])
where T: Pod,

Source

pub fn read_immediately(&self) -> Result<DownloadBuffer, BufferAsyncError>

Methods from Deref<Target = Texture>§

Source

pub unsafe fn as_hal<A, F>(&self, hal_texture_callback: F)
where A: HalApi, F: FnOnce(Option<&<A as Api>::Texture>),

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
Source

pub fn create_view(&self, desc: &TextureViewDescriptor<'_>) -> TextureView

Creates a view of this texture.

Source

pub fn destroy(&self)

Destroy the associated native resources as soon as possible.

Source

pub fn as_image_copy(&self) -> ImageCopyTexture<&Texture>

Make an ImageCopyTexture representing the whole texture.

Trait Implementations§

Source§

impl<D> Deref for Texture<D>

Source§

type Target = Texture

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<D> DerefMut for Texture<D>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<D> Freeze for Texture<D>
where D: Freeze,

§

impl<D> !RefUnwindSafe for Texture<D>

§

impl<D> !Send for Texture<D>

§

impl<D> !Sync for Texture<D>

§

impl<D> Unpin for Texture<D>
where D: Unpin,

§

impl<D> !UnwindSafe for Texture<D>

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<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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more